1. Ashok Kumar Pattanaik
  2. PowerBuilder
  3. Tuesday, 21 May 2019 16:42 PM UTC

Hello Team,

We are migrating our application from PB12.5.2 to PB2017 R3 version to support TLS12. using existing SOAP service. Due to budjetc and other factors, we are not migrating from SOAP to RestFul service.

I have mentioned below the codes in PB12.5 and codes after migrated to PB2017  R3.

PB12.5.2

In PB12.5.2 version we were passing input to WSDL generated structure objects to the method and response data from webservice was writing to the structure contain list of data.

After a success proxy objects generated from WSDL, it list out all objects in the specified PBL.

Ex...

intf__genericparmvalueINPUT[] contain list of variables along with type

intf__genericparmvalueOUTPUT[] contain list of output data returned by the method

intf__genericparmvalueOUTPUT[] =   webservice.retrievegenericparamdetails( intf__genericparmvalueINPUT[])

 

PB2017 R3

lnv_HttpClient = Create httpClient
lnv_HttpClient.SecureProtocol = SECURE_PROTOCOL_TLS12

lnv_HttpClient.SetRequestHeader("Connection", "Keep-Alive")
//lnv_HttpClient.SetRequestHeader("User-Agent", "Keep-Alive")
lnv_HttpClient.SetRequestHeader("Content-Type", "text/xml; charset=utf-8")
lnv_HttpClient.SetRequestHeader("SOAPAction", ls_methodName[i])
lnv_HttpClient.SetRequestHeader("Content-Length", string(len(ls_body)))

li_rc = lnv_HttpClient.sendrequest('POST',ls_url, ls_body)

li_ret = lnv_HttpClient.getresponsebody(  ls_data)

//////////////////////////////////////////////////////////////////

Issue here, it returning string data where I am expecting it should set value to intf__genericparmvalueOUTPUT[].

My question, how will I send structure data to HTTPClient sendRequest method and how will I read the response long list XML data from service?

Thanks,

Ashok

 

Marco Meoni Accepted Answer Pending Moderation
  1. Tuesday, 21 May 2019 18:23 PM UTC
  2. PowerBuilder
  3. # 1

for some funny reason, the ls_soapRequest string in my code has been mangled .   ;-)

I attach a screenshot

Best,

.m 

 

 

Attachments (1)
Comment
  1. Kevin Ridley
  2. Tuesday, 21 May 2019 19:20 PM UTC
This message software cannot seem to handle "less than" symbols with "greater than" symbols. Every time I try to post anything with xml it either totally removes them and what's inside, or just shows what's inside. There must be some switch where it's processing whatever it thinks is xml instead of just showing it.
  1. Helpful
There are no comments made yet.
Marco Meoni Accepted Answer Pending Moderation
  1. Tuesday, 21 May 2019 18:19 PM UTC
  2. PowerBuilder
  3. # 2

Hi,

you need to create the XML document to POST to the SOAP service.

For example:

s_soapRequest = '' + &
'' + &
' ' + &
' ' + &
' 2' + &
' 3' + &
'
' + &
'
' + &
'
'

lnv_httpclient.SetRequestHeader("Content-Type", "text/xml;charset=UTF-8")

lnv_httpclient.sendRequest('POST', ls_url, ls_soapRequest)

Replace my simple 2-value body with your complex-nested structure of objects.

Best,

.m

 

Comment
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 21 May 2019 18:15 PM UTC
  2. PowerBuilder
  3. # 3

Your SetRequestHeader calls look correct. The ls_body variable in the SendRequest function is supposed to contain XML. The XML would have any required options and function arguments. You need to get an example of what the XML needs to look like and build ls_body from that.

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.