I am working on invoking a SOAP web service using httpClient, but when I call the PostDataStart function, I get the return code -1, which according to https://www.appeon.com/support/documents/appeon_online_help/pb2017r3/powerscript_reference/ch10s456.html, is a general error.
Here's my code:
httpClient lo_client
Constant Integer SECURE_PROTOCOL_TLS12 = 5
integer i
String lo_xml_request
lo_xml_request = ''
lo_xml_request = lo_xml_request + ""
lo_xml_request = lo_xml_request + "<" + web_method + "xmlns=" + xml_namespace + 'xmlns:i="http://www.w3.org/2001/XMLSchema-instance">'
lo_xml_request = lo_xml_request + arguments[1]
for i = 2 to UpperBound(arguments[]) - 1
lo_xml_request = lo_xml_request + "<" + arguments[i] + ">"
lo_xml_request = lo_xml_request + arguments[i + 1]
lo_xml_request = lo_xml_request + ""
i++
next
lo_xml_request = lo_xml_request + ""
lo_xml_request = lo_xml_request + ""
lo_xml_request = lo_xml_request + ""
lo_client = Create httpClient
lo_client.SecureProtocol = SECURE_PROTOCOL_TLS12
lo_client.SetRequestHeader("Content-Type", "text/xml; charset=utf-8")
lo_client.SetRequestHeader("SOAPAction", soap_action)
if (lo_client.PostDataStart(url) = 1 ) then
lo_client.PostData(string(lo_xml_request), 1024)
else
return false
end if
return true
Am I doing something wrong that would cause the PostDataStart function to return -1?
I added lo_client.SetRequestHeader("Content-Length", string(len(lo_xml_request))) and 1 was returned!
Thanks Chris