R
Ram Krishna Tripathi
Hello Friends,
I have made a small webservice.Webservice in working well.
I have a created a small webapplication program.
In it i have added a command button.
In the click event of command button , I am passing the input of webservice
in the SOAP envelope then it gives the soap fault in objHTTP.responseText()
in webapplication.
Soap fault and webapplication code are given at end.
So please tell me what could be reason for it.
Ram Krishna Tripathi
(e-mail address removed)
==
Web application code is as follows:-
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim objHTTP As New MSXML.XMLHTTPRequest
Dim strEnvelope As String
Dim strReturn As String
Dim objReturn As New MSXML.DOMDocument
Dim dblTax As Double
Dim strQuery As String
'Create the SOAP Envelope
strEnvelope = _
"<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>" & _
"<soap_web xmlns=""http://localhost/WebService1/Service1"">"
& _
"<variable>" + "hestring" + "</variable>" & _
"</soap_web>" & _
"</soap:Body>" & _
"</soap:Envelope>"
'Set up to post to our local server
objHTTP.open("post", "http://localhost/WebService1/Service1.asmx",
False)
'Set a standard SOAP/ XML header for the content-type
objHTTP.setRequestHeader("Content-Type", "text/xml")
' Response.Write()
'Set a header for the method to be called
objHTTP.setRequestHeader("SOAPMethodName",
"urn:tempuri.org/WebService1/Service1.asmx?op=soap_web")
'Make the SOAP call
objHTTP.send(strEnvelope)
'Get the return envelope
TextBox1.Text = objHTTP.responseText()
'Load the return envelope into a DOM
objReturn.loadXML(strReturn)
'/*'Query the return envelope
Try
strQuery = _
"SOAP:Envelope/SOAP:Body/soap_webResponse/soap_web"
TextBox1.Text = objReturn.selectSingleNode(strQuery).text
Catch ex As Exception
End Try
' Debug.Print(TextBox1.Text)
End Sub
End Class
=========
soap fault
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: Unable to
handle request without a valid action parameter. Please supply a valid soap
action.
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type,
HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
===
webservice function is:--
<WebMethod(Description:="DESCRIBING soap")> _
Public Function soap_web(ByVal variable As String) As String
Try
Return "VARIABLE"
Catch ES As Exception
End Try
End Function
I have made a small webservice.Webservice in working well.
I have a created a small webapplication program.
In it i have added a command button.
In the click event of command button , I am passing the input of webservice
in the SOAP envelope then it gives the soap fault in objHTTP.responseText()
in webapplication.
Soap fault and webapplication code are given at end.
So please tell me what could be reason for it.
Ram Krishna Tripathi
(e-mail address removed)
==
Web application code is as follows:-
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim objHTTP As New MSXML.XMLHTTPRequest
Dim strEnvelope As String
Dim strReturn As String
Dim objReturn As New MSXML.DOMDocument
Dim dblTax As Double
Dim strQuery As String
'Create the SOAP Envelope
strEnvelope = _
"<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>" & _
"<soap_web xmlns=""http://localhost/WebService1/Service1"">"
& _
"<variable>" + "hestring" + "</variable>" & _
"</soap_web>" & _
"</soap:Body>" & _
"</soap:Envelope>"
'Set up to post to our local server
objHTTP.open("post", "http://localhost/WebService1/Service1.asmx",
False)
'Set a standard SOAP/ XML header for the content-type
objHTTP.setRequestHeader("Content-Type", "text/xml")
' Response.Write()
'Set a header for the method to be called
objHTTP.setRequestHeader("SOAPMethodName",
"urn:tempuri.org/WebService1/Service1.asmx?op=soap_web")
'Make the SOAP call
objHTTP.send(strEnvelope)
'Get the return envelope
TextBox1.Text = objHTTP.responseText()
'Load the return envelope into a DOM
objReturn.loadXML(strReturn)
'/*'Query the return envelope
Try
strQuery = _
"SOAP:Envelope/SOAP:Body/soap_webResponse/soap_web"
TextBox1.Text = objReturn.selectSingleNode(strQuery).text
Catch ex As Exception
End Try
' Debug.Print(TextBox1.Text)
End Sub
End Class
=========
soap fault
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: Unable to
handle request without a valid action parameter. Please supply a valid soap
action.
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocol.SetContext(Type type,
HttpContext context, HttpRequest request, HttpResponse response)
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
===
webservice function is:--
<WebMethod(Description:="DESCRIBING soap")> _
Public Function soap_web(ByVal variable As String) As String
Try
Return "VARIABLE"
Catch ES As Exception
End Try
End Function