I'm trying to get some data uploaded to a server run by a 3rd party, and I was having issues, do I broke it down to it's most basic, and was trying to work with the dneonline calculator through a SOAP request. Here is my code:
Code: Select all
NewMap Header.s()
Header("POST") = "http://www.dneonline.com/calculator.asmx HTTP/1.1"
Header("Accept-Encoding:") = "gzip,deflate"
Header("Content-Type:") = "text/xml;charset=UTF-8"
Header("SOAPAction:") = #DQUOTE$ + "http://tempuri.org/Add" + #DQUOTE$
Header("Host:") = "www.dneonline.com"
Header("Proxy-Connection:") = "Keep-Alive"
Header("User-Agent:") = "Apache-HttpClient/4.5.5 (Java/12.0.1)"
If Not InitNetwork()
MessageRequester("Help!","Unable to initialize network!")
End 100
EndIf
Soap.s = "<soapenv:Envelope xmlns:soapenv=" + #DQUOTE$ + "http://schemas.xmlsoap.org/soap/envelope/" + #DQUOTE$ + " xmlns:tem=" + #DQUOTE$ + "http://tempuri.org/" + #DQUOTE$ + ">" +
"<soapenv:Header/>" +
"<soapenv:Body>" +
"<tem:Add>" +
"<tem:intA>5</tem:intA>" +
"<tem:intB>3</tem:intB>" +
"</tem:Add>" +
"</soapenv:Body>" +
"</soapenv:Envelope>"
; Header("Content-Length:") = Len(Soap)
PostString.s = "http://www.dneonline.com/calculator.asmx"
Debug "About to send the request"
ForEach Header()
Debug MapKey(Header()) + ": " + Header()
Next
Debug "-------------------------------------"
Debug Soap
Debug "-------------------------------------"
Running = HTTPRequest(#PB_HTTP_Post, PostString, Soap, 0, Header())
If Running
Debug "Status Code: " + HTTPInfo(Running, #PB_HTTP_StatusCode)
FullResponse.s = HTTPInfo(Running, #PB_HTTP_Response)
Debug " "
Debug FullResponse
FinishHTTP(Running)
Debug FindString(FullResponse, "name=" + #DQUOTE$ + "F9errCode")
ResponseCode.s = Mid(FullResponse, FindString(FullResponse,"<AddResult>")+11)
ResponseCode = Left(ResponseCode, FindString(ResponseCode, "</AddResult>")-1)
Else
Debug "Woa, you gotsa sometin wrong..."
Debug Running
EndIf
- About to send the request
User-Agent:: Apache-HttpClient/4.5.5 (Java/12.0.1)
Host:: http://www.dneonline.com
Content-Type:: text/xml;charset=UTF-8
SOAPAction:: "http://tempuri.org/Add"
Accept-Encoding:: gzip,deflate
Proxy-Connection:: Keep-Alive
-------------------------------------
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"><soapenv:Header/>< ... v:Envelope>
-------------------------------------
Status Code: 400
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request</h2>
<hr><p>HTTP Error 400. The request is badly formed.</p>
</BODY></HTML>
0
Thanks in advance for your time.
Stevinga