Access web service return data

vbnet2006

New member
Joined
Dec 8, 2006
Messages
4
Programming Experience
Beginner
I am calling a web service which returns SOAP data and am not sure how to access the return data. I have had a look around the web and havn't found anything overly usefull.
As it is SOAP data, i am going to be using the Soap formatter.

VB.NET:
Dim XMLSoapReturn As New Soap.SoapFormatter
 
XMLSoapReturn = WebService.StoreClient(ClientCode.Text)

From here i take it i need to use the deserialize function in SoapFormatter, but all examples i have found are deserializing from a text file.
Anyone who has used SOAP with vb.net, i would be very grateful of any help.
Much appreciated.
 
Why not just Add Webreference to the service and use this to create a strong type instance to access the service members. See the "Using a webservice" section in this article: http://abstractvb.com/code.asp?A=1004
 
The people i am working with havn't set up the web service yet, we just have a spec. When i access the StoreClient web service for example, they said they will return SOAP data which will consist of a response code and a response message.
 
Webservice is a standard that use SOAP enveloping. In .Net you don't have to worry about this when consuming the webservice (or when writing the service yourself for that matter, also described in that tutorial). You need a (to a degree) working webservice to make the consumer.
 
Ok the info from the link has helped me understand a little better. What if a webmethod function has many variables you need to access? You wouldn't be able to simply call the function.
 
A webmethod can only return one value. That return value may be an array or a complex type, for example a custom type defined by the service. Linking to the webservice you will see what the type of the return is.
 
They are implementing in Perl. So i imagine if they return an array, we can simply say:

VB.NET:
[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] ReturnArray [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Array = WebService.StoreClient(ClientCode.Text)
[/SIZE]
 
Array class is not used for this. You check what type array is returned from webservice method and declare this type specifically. Examples:
VB.NET:
Dim ar() As Object = ws.method(param)
Dim ar() As String = ws.method(param)
Dim ar() As wsReferencedNamespace.customtype = ws.method(param)
Dim ar() As Byte = ws.method(param)
 
Back
Top