SOAP Webservice - WSDL consuming

dan_miles86

New member
Joined
Dec 17, 2014
Messages
4
Programming Experience
Beginner
Hi all,

I'm trying to make a really basic application at its lead me to need to comsume my first web service.

I've been given a WSDL which I can use nicely though SOAP UI but really struggling to include it in my application.

I've imported it by going through the add service reference menu on my project but I'm stuck on what next. Does anyone know an example or how to that covers off this part of the process?

Thank you :D
 
Thanks John,

Where I'm getting stuck is all the parameters that need to be set for the call to be successful. Maybe that's something non-specific to we services I need to understand first?
 
The proxy methods signatures say what type of parameter you need to supply when calling that method. What values that need to be set here is service specific, look in the service documentation for this.
 
Thanks again.

I've made some progress, managed to define the required paratmers and URI. However I now get the following message and no idea where to go from here? Is there away to see the complete SOAP request that's been generated so I can see what's going on? The WSDL works perfectly in SOAPUI.

An unhandled exception of type 'System.ServiceModel.FaultException' occurred in mscorlib.dll
Additional information: javax.jbi.messaging.MessagingException: HTTPBC-E00798: Message normalization failed
 
You can view the request/response with Fiddler or similar web debugging tool.
 
Its HTTPS so don't think I can see this way.
While I haven't tried that, Fiddler does support https debugging.
Is there anyway to extract this info from VS before encryption?
There exist something called Message Inspectors, I haven't searched web to see if there are VB.Net samples available.
One example here: c# - Intercept SOAP messages from and to a web service at the client - Stack Overflow That's also C# code, and I took the liberty of converting it to VB.Net (attached). A sample usage also converted:
        Dim client As New ServiceReference1.ConvertTemperatureSoapClient("ConvertTemperatureSoap")
        Dim requestInterceptor = New InspectorBehavior()
        client.Endpoint.Behaviors.Add(requestInterceptor)
        Dim tempF = client.ConvertTemp(20, ServiceReference1.TemperatureUnit.degreeCelsius, ServiceReference1.TemperatureUnit.degreeFahrenheit)
        Dim requestXML = requestInterceptor.LastRequestXML
        Dim responseXML = requestInterceptor.LastResponseXML
        client.Close()

Tested this with a service I found (here http://www.webservicex.net/ConvertTemperature.asmx?WSDL) and it showed in/out messages.
 

Attachments

  • inspect.vb.txt
    1.9 KB · Views: 50
Back
Top