I haven't had to deal with SOAP directly since the first couple lectures I had on web services in college....after we understood what SOAP was (what made it valid, what it was used for, how to create it) and what WSDLs were all about we stopped looking at it.
Instead of working with SOAP and WSDLs manually, we depended on the tools that Java provided for creating and consuming web services. We let these tools deal with SOAP and WSDLs (understand that I was studying Java). In your case you should let .NET deal with the SOAP and WSDLs. You shouldn't be concerned with it (unless it has to do with security SOAP communications).
When you add a web reference to a web service in your application Visual Studio retrieves the WSDL. From this Visual Studio will dynamically create a class that can be used as a proxy to execute the methods provided by the web service.
This proxy class takes all of the SOAP and WSDL torture out of the experience of consuming web services. You use this class as you would any other .NET class and you should be able to execute the web methods without any problems. If there is a problem it's likely that an exception will be raised (which you can trap and deal with).
I don't know what you're trying to do with your Test Connection stuff.
Just to come up to speed with you I created a Web Service of my own and consume it in a button click.
The web service provides 2 methods: HelloWorld() and Greeting(string).
This is the web service code:
-
Imports System.Web.Services
-
Imports System.Web.Services.Protocols
-
Imports System.ComponentModel
-
-
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
-
' <System.Web.Script.Services.ScriptService()> _
-
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
-
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
-
<ToolboxItem(False)> _
-
Public Class Service1
-
Inherits System.Web.Services.WebService
-
-
<WebMethod()> _
-
Public Function HelloWorld() As String
-
Return "Hello World"
-
End Function
-
-
<WebMethod()> _
-
Public Function Greeting(ByVal name As String) As String
-
Return "Hello " + name + "!"
-
End Function
-
-
End Class
As you can see the Greeting function takes 1 parameter: a string containing a name. It returns a String with the greeting.
I added a reference to my project and in a button click event I consume the web service:
-
Private Sub showGreeting_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles showGreeting.Click
-
Dim proxy As New localhost.Service1
-
-
'personsName is a TextBox
-
greeting.Text = proxy.Greeting(personsName.Text)
-
End Sub
Please note that "localhost" is the namespace where my web service class (Service1) is located.
I tried to figure out how to access the SOAP directly but could not find a way to do it....and I don't why you would want to.
-Frinny