I searched the web and experts-exchange for this problem and none of the solutions given seems to work in my case.
I am using a VB.NET Client with an ASP.NET Web Service.
The VB.NET client code to send the XML request is as follows........
Dim xmlHTTP As MSXML2.XMLHTTP40 = New MSXML2.XMLHTTP40
Dim xmlDoc As MSXML2.DOMDocument = New MSXML2.DOMDocument
Dim url As String = "
http://localhost/VoicesService/Service1.asmx"
Dim strRequest As String
Dim a As Integer = 2
Dim b As Integer = 3
strRequest = "<?xml version = '1.0' ?>" & _
"<soap:Envelope " & _
"xmlns:xsi='
http://www.w3.org/2001/XMLSchema-instance' " & _
"xmlns:xsd='
http://www.w3.org/2001/XMLSchema' " & _
"xmlns:soap='
http://schemas.xmlsoap.org/soap/envelope/'>
" & _
"<soap:Body>" & _
"<Add xmlns='
http://tempuri.org/'>" & _
"<a>" & a & "</a>" & _
"<b>" & b & "</b>" & _
"</Add></soap:Body></soap:
Envelope>"
xmlHTTP.open("POST", url, False)
xmlHTTP.setRequestHeader("
SOAPAction
", "
http://tempuri.org/Add")
xmlHTTP.setRequestHeader("
Content-Ty
pe", "text/xml; charset=UTF-8")
xmlHTTP.setRequestHeader("
Content-Le
ngth", "" & strRequest.Length)
If xmlDoc.loadXML(strRequest)
Then
xmlHTTP.send(xmlDoc.xml)
txtDisplay.AppendText(xmlH
TTP.respon
seText)
txtDisplay.AppendText(vbCr
Lf)
Else
txtDisplay.AppendText(xmlD
oc.parseEr
ror.reason
)
txtDisplay.AppendText(xmlD
oc.parseEr
ror.line)
End If
xmlHTTP = Nothing
..........................
..........
..........
..........
..........
..........
.......
And the Web Service code is
Imports System.Data.Odbc
Imports System.Web.Services
Imports System.Web.Services.Protoc
ols
Imports System.Web.Services.Descri
ption
<System.Web.Services.WebSe
rvice(Name
space:="
http://tempuri.org/VoicesService/Service1"
), _
SoapDocumentService(SoapBi
ndingUse.L
iteral, _
SoapParameterStyle.Wrapped
, _
RoutingStyle:=SoapServiceR
outingStyl
e.SoapActi
on)> _
Public Class Service1
Inherits System.Web.Services.WebSer
vice
<WebMethod()> _
Public Function Add(ByVal a As Integer, ByVal b As Integer)
Return a + b
End Function
End Class
Any sugesstions why the SOAPAction is not recongnized by the server.
Regards,
Cannibal Corpse
Start Free Trial