Question How to call a WebService (with and without a parameter) ?

Origami

Member
Joined
Jan 12, 2011
Messages
8
Programming Experience
5-10
Hello,

My question may sound trivial to you, but it's been days since I try to call a WebService from a Windows Form in VB.Net.

Let me give you some details.

I've a WSDL (http://78.193.XX.XXX:2002/HelloWorldService?wsdl) that holds 2 Web Services :
- getAllWorkSpaces (doesn't use parameter)
- getAllCalls (with one parameter).

When I test those WS in SoapUI, they work and return some results, as exected, under an XML format
There is no Password/login, so it should work OK.

Now, I want to be able to call those WS from VB.NET (I'm using Visual Studio 2008).
Here are the steps I've done :
- In the Project, I do "Add a Service Reference".
- In the Address field, I enter the URL of the WSDL, then click on Go.
- The WS's top level is displayed, and when I click on +, I've "HelloWorldServiceEndpoint". And when I click on this, I've my 2 WS displayed on the right panel (GetAllCalls and getAllWorkSpaces). So far, so good.
- If I look under the Object Browser the information on this Service Reference, I find the following lines :
* getAllCallsRequest
* getAllCallsResponse
* getAllWorkSpacesRequest
* getAllWorkSpacesResponse
* -- there are other Classes, but I don't know what they do --


Now, this is where I'm stucked. How do I call those 2 Web Services from VB ?
The first WS (getAllWorkSpaces) doesn't use any parameterbut for the second (getAllCalls), there is a parameter (Num_ID). How do I pass this parameter to the WS ?

And how do I get the results ?

I googled "VB.Net consume WebService", but couldn't find one single page that clearly explains this.

Thanks in advance for your help and answers.
 
Hello,

you need to declare the webservice first (even after having it as a web reference):

i.e.: dim ws As New GetAllCalls.GetAllCalls (don't know how your webservice is called)

and then you should be able to access all the webService properties like with any other class

i.e.: ws.url
 
Hi Gerardo79.

Thanks for your reply. It gave me the clue to the problem. I was trying to use the getAllWorkSpacesRequest and getAllWorkSpacesResponse in the code, while I simply had to find the Class that hold all the "basic" WebServices.

It's now working.

But could anyone explain me why the WSDL holds the get***Query and get***Response and what are they used for ? Just for my personnal knowledge.

Thanks
 
Back
Top