I'm trying to write a SOAP request to a 3rd party web service in VB. I've added a service reference which automatically added the following to the web.config:
<basicHttpBinding>
<binding name="Soap11">
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
Now I have to write the following request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>username</wsse:Username>
<wsse:Password>password</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<sch:Request>
</sch:Request>
</soapenv:Body>
</soapenv:Envelope>
I don't have a clue what to do next. I don't know how to provide the authentification details. All I've done is the following:
Dim myClient As New MyServiceReference.Client
Dim myRequest As New MyServiceReference.Request
Dim myResponse As New MyServiceReference.Response
myClient.ClientCredentials.UserName.UserName = "Bob"
myClient.ClientCredentials.UserName.Password = "Dole21"
myResponse = myClient.Lookup(myRequest)
Obviously, not a lot. This has produced the following (according to fiddler).
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Lookup xmlns="http://example.com/schemas"/></s:Body></s:Envelope>
Any help would be greatly appreciated. How do I add the authentication headers to the SOAP request? I've tried changing
security mode="Transport"
but it throws up a "The provided URI scheme 'http' is invalid; expected 'https'." error.