Hello,
We need to call some Web Server API via SAP PI.
We were provided sample VB code below to call it via HTTP.
We want to do this using SAP PI HTTP Adapter but not sure if it supports exactly this type of call.
SAP PI Adapter only support POST and XML payload passed in a Message Body.
What we see here is that in example below they are passing long URL that consist of some parameters and XML as well.
We think we can use URL Escaping to take care of the special characters but not sure whether we should use prolog/epilog features here and whether it will be supported at all.
Thank you,
Forest.
Sub Main()
Dim customer_id As String
customer_id = "12345"
Dim api_url As String
api_url = "https://api.ourhost.com/page.asp"
Dim url_encoded_call As String
url_encoded_call = "<?xml%20version=""1.0""%20encoding=""utf-8""%20?><request><req_id>83945003</req_id><req_data></req_data></request>"
Dim cgiXml As Object
Dim whole_url As String
Dim theResponse As String
whole_url = api_url & "?cid=" & customer_id & "&rdat=" & url_encoded_call
Set cgiXml = CreateObject("MSXML2.XMLHTTP")
cgiXml.Open "POST", whole_url, False
cgiXml.setRequestHeader "Content-type", "text/xml"
cgiXml.send
theResponse = cgiXml.responseText
Debug.Print theResponse
End Sub
They alsohave example in java with "Content-Type" set to "application/x-www-form-urlencoded" but
idea is the same - they pass whole string of parameters and XML.