SOAPToObject - how to call?

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

SOAPToObject - how to call?

Postby AndyWBell » Tue Feb 02, 2010 7:18 am

Hi

I'm using BCB 2007 to call a webservice. I've used the WSDL importer to create the class needed to access the Service. I have created a TXMLDocument and loaded into it the XML for the request. I have a THTTPRIO on my form.

Now I want to call the SOAPToObject method on the generated WSDL class but the documentation is incredibly vague... I might be able to work out the right XMLNodes for the first two parameters, but the third parameter - the Converter - has me stumped.

The documentation mentions, for THTTPRIO->Converter "That is, when the THTTPRIO object has been typecast to an invokable interface, it implements each method call by using Converter to marshal the call from an internal format into an encoding protocol, and to unmarshal any return values after that call is executed." But I don't really get what that means :oops: and cannot find a parameter that the compiler will accept.

Any clues would be appreciated.

Andy
AndyWBell
 
Posts: 5
Joined: Tue Feb 02, 2010 7:11 am

Re: SOAPToObject - how to call?

Postby arisme » Wed Feb 03, 2010 2:20 am

AndyWBell wrote:Any clues would be appreciated.

I will try to provide as many clues as I can. It has been several years since I wrestled with BCB SOAP, and I need to refresh myself somewhat to provide useful responses, so you may have to be patient at times.

In the meantime, are you by any chance coming to C/C++ from Delphi, or trying to create a BCB application that is mimicking a Delphi web service client?

AndyWBell wrote:...but the documentation is incredibly vague...

Your description is generous - personally, I found it useless. I spent hours, days and weeks hunting the web for answers to simple questions without success. In the end, it came together, but more out of my own understanding than any documentation.

AndyWBell wrote:The documentation mentions, for THTTPRIO->Converter "That is, when the THTTPRIO object has been typecast to an invokable interface, it implements each method call by using Converter to marshal the call from an internal format into an encoding protocol, and to unmarshal any return values after that call is executed." But I don't really get what that means...

A crude and general description of "marshalling" is to gather a set of data into a layout and format that can then be be used directly by a procedure. "Unmarshalling" is the reverse process - the marshalled data is distributed into its various holding locations.

In this case, it would seem that they go from an internal format to an XML packet (SOAP request) that will be sent to the server. And in the reverse direction when the XML packet (SOAP response) is received from the server.

I cannot help directly with the SOAPToObject method (at the moment), as I have never used it. I am not certain that you need to use it either - but no doubt this will resolve itself in due course.

Aris
arisme
BCBJ Master
BCBJ Master
 
Posts: 357
Joined: Thu Jun 07, 2007 9:35 pm
Location: UK

Re: SOAPToObject - how to call?

Postby AndyWBell » Wed Feb 03, 2010 6:01 am

Aris

What I'm trying to achieve is this:

Send an XML request to a web service, get the response and extract and display any meaningful info from it. A bit like SoapUI except we want to process the return XML before displaying it.

I've not done this before - I'm not trying to convert a Delphi app.

I probably am jumping through unnecessary steps in loading the XML into an Object and then trying to convert it back into XML to send to the Web Service but I don't know (from the 'documentation') how to approach this more directly.

I appreciate your responding to my pleas for help :D

Andy
AndyWBell
 
Posts: 5
Joined: Tue Feb 02, 2010 7:11 am

Re: SOAPToObject - how to call?

Postby arisme » Wed Feb 03, 2010 10:59 am

AndyWBell wrote:I probably am jumping through unnecessary steps in loading the XML into an Object and then trying to convert it back into XML to send to the Web Service but I don't know (from the 'documentation') how to approach this more directly.

Maybe this will clear some of the fog:-

In principle, SOAP is a fairly straightforward means of holding a dialogue with a web services server. i.e.

User ==> XML request ==> HTTP transport ==> Web services server ==> XML response ==> HTTP transport ==> User

The dialogue is always initiated by the user. The requests that the user can make are specified by the WSDL.

There is a requirement that the XML request packets and the XML response packets follow a specified format, again laid out in the WSDL.

For human convenience and readabillity, an XML file is usually displayed as an indented series of lines down a page. However, for transmission, the content of the XML packet is arranged as a single contiguous string of characters. I have constructed XML packets ready for transmission by adding all the XML elements to an AnsiString in the required order with my own code.

When the XML response arrives, again it is a single character string. However. it can be fed into a TXMLDocument and that provides very easy access to the data that was carried in the response.

The complications arise when you try to establish how to do this simple set of steps within the complexity of the generalized procedures and structures of BCB.

AndyWBell wrote:A bit like SoapUI except we want to process the return XML before displaying it.

All the SOAP operations are handled within your code, and you can make as much or as little as you want visible to the user.

AndyWBell wrote:I'm not trying to convert a Delphi app.

That question of mine was prompted by your reference to SOAPToObject. That, and the reverse method ObjectToSOAP, were originally added to Delphi. There are a fair number of references to that pair on the net, but all by Delphi users. I do not think you will need to bother with either of those methods in your application.

Aris
arisme
BCBJ Master
BCBJ Master
 
Posts: 357
Joined: Thu Jun 07, 2007 9:35 pm
Location: UK

Re: SOAPToObject - how to call?

Postby AndyWBell » Thu Feb 04, 2010 7:51 am

Thanks - this has helped a lot!

One weird thing remains - the various TimeOut's for component THTTPReqResp seem to do nothing - I sometimes get that its Execute method throws a timeout exception and sometimes it doesn't and no matter how big I set the TimeOut settings the exception is still thrown...

Andy
AndyWBell
 
Posts: 5
Joined: Tue Feb 02, 2010 7:11 am

Re: SOAPToObject - how to call?

Postby AndyWBell » Thu Feb 04, 2010 8:44 am

Fixed the timeout with the info on this page:

http://shenoyatwork.blogspot.com/2006/1 ... -soap.html

Thanks for your help with this - my app is now up and running!

Andy
AndyWBell
 
Posts: 5
Joined: Tue Feb 02, 2010 7:11 am

Re: SOAPToObject - how to call?

Postby arisme » Thu Feb 04, 2010 9:26 am

AndyWBell wrote: - my app is now up and running!

That is excellent news - very well done.

And thanks very much for the updates - it is always good to know that a topic thread has ended with everybody living happily ever after.

I hereby appoint you as BCB Journal Forum SOAP Expert in Chief.

More seriously, would you consider writing up your experiences with the project in an article for the BCB Journal?

If you have browsed the Journal, you will have noticed that the articles are not major research papers - just practical descriptions around working code. And extremely useful for someone like you trying to develop an application.

If you are willing to consider an article, please contact Damon for guidance and an article template. Tell him I sent you...

Aris
arisme
BCBJ Master
BCBJ Master
 
Posts: 357
Joined: Thu Jun 07, 2007 9:35 pm
Location: UK

Re: SOAPToObject - how to call?

Postby AndyWBell » Thu Feb 04, 2010 2:29 pm

Aris

I will certainly consider it. I have a spare week in February when I may be able to document what I needed to do and how I did it. My application makes heavy use of DevExpress's controls for the GUI, so some of my code would need amending for an article...

Andy
AndyWBell
 
Posts: 5
Joined: Tue Feb 02, 2010 7:11 am

Re: SOAPToObject - how to call?

Postby arisme » Thu Feb 04, 2010 5:56 pm

Andy wrote:I have a spare week in February when I may be able to document what I needed to do and how I did it.

Thanks. Very much appreciated.

Aris
arisme
BCBJ Master
BCBJ Master
 
Posts: 357
Joined: Thu Jun 07, 2007 9:35 pm
Location: UK


Return to Technical

Who is online

Users browsing this forum: No registered users and 2 guests

cron