Hi all,
I need to access a Soap server.
This is the example provided by the documentation (located at https://testfe.solutiondocondemand.com/solutiondoc_hub.asmx):
POST /solutiondoc_hub.asmx HTTP/1.1
Host: testfe.solutiondocondemand.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetFileElectronicInvoiceOutcome xmlns="http://tempuri.org/">
<paramAuth>
<CustomerCode>string</CustomerCode>
<Password>base64Binary</Password>
</paramAuth>
<paramFileOutcome>
<IdOutcome>string</IdOutcome>
</paramFileOutcome>
</GetFileElectronicInvoiceOutcome>
</soap12:Body>
</soap12:Envelope>
This is the subroutine that attempts to access:
But I get this error:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><env:Header xmlns:env="http://www.w3.org/2003/05/soap-envelope"><wsa:Action>http://schemas.xmlsoap.org/ws/2004/08/addressing/fault</wsa:Action><wsa:MessageID>urn:uuid:4ce183a1-5eb5-4c3a-bd06-5cef5cd466bf</wsa:MessageID><wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To><wsse:Security><wsu:Timestamp wsu:Id="Timestamp-f5f20aa7-4351-40b1-ab2c-daaf63cc1e82"><wsu:Created>2018-12-12T18:10:02Z</wsu:Created><wsu:Expires>2018-12-12T19:10:02Z</wsu:Expires></wsu:Timestamp></wsse:Security></env:Header><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Sender</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">System.Web.Services.Protocols.SoapHeaderException: WSE012: The input was not a valid SOAP message because the following information is missing: action.
at Microsoft.Web.Services3.Utilities.AspNetHelper.SetDefaultAddressingProperties(SoapContext context, HttpContext httpContext)
at Microsoft.Web.Services3.WseProtocol.CreateRequestSoapContext(SoapEnvelope requestEnvelope)
at Microsoft.Web.Services3.WseProtocol.FilterRequest(SoapEnvelope requestEnvelope)
at Microsoft.Web.Services3.WseProtocol.RouteRequest(SoapServerMessage message)
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)</soap:Text></soap:Reason></soap:Fault></soap:Body></soap:Envelope>
Does anyone have any suggestions to give me?
Thank you
I attach the simple project.
I need to access a Soap server.
This is the example provided by the documentation (located at https://testfe.solutiondocondemand.com/solutiondoc_hub.asmx):
POST /solutiondoc_hub.asmx HTTP/1.1
Host: testfe.solutiondocondemand.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetFileElectronicInvoiceOutcome xmlns="http://tempuri.org/">
<paramAuth>
<CustomerCode>string</CustomerCode>
<Password>base64Binary</Password>
</paramAuth>
<paramFileOutcome>
<IdOutcome>string</IdOutcome>
</paramFileOutcome>
</GetFileElectronicInvoiceOutcome>
</soap12:Body>
</soap12:Envelope>
This is the subroutine that attempts to access:
B4X:
Private Sub GetResponsoFA As ResumableSub
Dim jGF As HttpJob
Dim Richiesta As String
Dim ResJ As String
DateTime.DateFormat="yyyy-MM-dd HH:mm:ss"
Dim S As String = "D9E7F08E4A07E3D86CDCA0EB0452A45E"
Dim Bytes() As Byte = s.GetBytes("UTF8")
Dim I As Int
S=""
For I = 0 To Bytes.Length-1
S=S & NumberFormat(Bytes(I),2,0)
Next
Richiesta="" & _
"<?xml version='1.0' encoding='utf-8'?>" & _
"<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>" & _
"<soap12:Body>" & _
"<GetFileElectronicInvoiceOutcome xmlns='http://tempuri.org/GetFileElectronicInvoiceOutcome'>" & _
"<paramAuth>" & _
"<CustomerCode>'0000001Test0001978'</CustomerCode>" & _
"<Password>cid:" & S & "</Password>" & _
"</paramAuth>" & _
"<paramFileOutcome>" & _
"<IdOutcome>'5680101'</IdOutcome>" & _
"</paramFileOutcome>" & _
"</GetFileElectronicInvoiceOutcome>" & _
"</soap12:Body>" & _
"</soap12:Envelope>"
Richiesta=Richiesta.Replace("'","""")
jGF.Initialize("GetWS", Me)
jGF.PostString(UrlTest,Richiesta)
jGF.GetRequest.SetContentType("application/soap+xml; charset=utf-8")
Wait For (jGF) JobDone(j As HttpJob)
If j.Success Then
ResJ = j.GetString
' Log(j.GetString)
TxtRes.Text=ResJ
Else
Log(j.ErrorMessage)
j.Release
Log("Error Trades " & j.ErrorMessage)
TxtRes.Text=j.ErrorMessage
Return False
End If
j.Release
Return True
End Sub
But I get this error:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><env:Header xmlns:env="http://www.w3.org/2003/05/soap-envelope"><wsa:Action>http://schemas.xmlsoap.org/ws/2004/08/addressing/fault</wsa:Action><wsa:MessageID>urn:uuid:4ce183a1-5eb5-4c3a-bd06-5cef5cd466bf</wsa:MessageID><wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To><wsse:Security><wsu:Timestamp wsu:Id="Timestamp-f5f20aa7-4351-40b1-ab2c-daaf63cc1e82"><wsu:Created>2018-12-12T18:10:02Z</wsu:Created><wsu:Expires>2018-12-12T19:10:02Z</wsu:Expires></wsu:Timestamp></wsse:Security></env:Header><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Sender</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">System.Web.Services.Protocols.SoapHeaderException: WSE012: The input was not a valid SOAP message because the following information is missing: action.
at Microsoft.Web.Services3.Utilities.AspNetHelper.SetDefaultAddressingProperties(SoapContext context, HttpContext httpContext)
at Microsoft.Web.Services3.WseProtocol.CreateRequestSoapContext(SoapEnvelope requestEnvelope)
at Microsoft.Web.Services3.WseProtocol.FilterRequest(SoapEnvelope requestEnvelope)
at Microsoft.Web.Services3.WseProtocol.RouteRequest(SoapServerMessage message)
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)</soap:Text></soap:Reason></soap:Fault></soap:Body></soap:Envelope>
Does anyone have any suggestions to give me?
Thank you
I attach the simple project.
Attachments
Last edited: