1. Bjarne Anker
  2. PowerBuilder
  3. Saturday, 3 March 2018 08:20 AM UTC

Hi.

Is there any examples on how to invoke and consume a SOAP web service using the httpclient object?

Today, we use the proxy object like this:

long ll_ret
decimal ldc_saldo
SoapConnection DGSConnection
transactionsservice TransClient
try
DGSConnection = create SoapConnection
ll_ret = DGSConnection.CreateInstance(TransClient,"transactionsservice",ls_url + "?token=" + ls_token)
if ll_ret <> 0 then
messagebox("Error", "Unable to logon Transactions web service.")
ldc_saldo = 0
else
ls_xml = TransClient.GetCustomerBalance(al_clientNo,al_customerNo)
end if
catch(SoapException ex)
if ex.text = "Invalid token" then
ls_token = of_get_token_dgs()
else
Messagebox("Error",ex.text )
return 0
end if
FINALLY
 
But it would be much more efficient to call the method GetCustomerBalance directly, if possible.
Something like this:
 
ls_endpoint = ls_url + "/GetCutomerBalance?token=" + ls_token + "&clientNo=" + string(al_clientNo) + "&customerNo=" + string(al_customerNo)
http = create httpclient 
ll_ret = http.sendrequest('GET', ls_endpoint) 
 
Is this at all possible, or is proxy objects the only way?
 
Regards,
 
Bjarne Anker
 
Marco Meoni Accepted Answer Pending Moderation
  1. Saturday, 3 March 2018 09:37 AM UTC
  2. PowerBuilder
  3. # 1

Hi Bjarne,

the PowerBuilder 2017 R2 Keynote from Chris Pollach contains an example, go to minute 7'30".

https://www.appeon.com/elevate

Of course you need first to expose your web service with a REST API, which is not possible with current PB2017 R2 (but you can use C#, Java, etc...).
Cheers,
Marco

Comment
There are no comments made yet.
Govinda Lopez @Appeon Accepted Answer Pending Moderation
  1. Monday, 5 March 2018 16:38 PM UTC
  2. PowerBuilder
  3. # 2

Hi Bjarne,

 

All documentation about HTTPOBJECT is available here too: https://www.appeon.com/support/documents/appeon_online_help/pb2017r2/objects_and_controls/ch02s35.html

 

Regards,

Comment
There are no comments made yet.
Bruce Armstrong Accepted Answer Pending Moderation
  1. Monday, 5 March 2018 19:21 PM UTC
  2. PowerBuilder
  3. # 3

It's entirely possible, it would just be a lot of work.  The request would have to be a POST rather than a GET, because you would need to put together the XML soap request and send it as data.  For example:

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding"
>

<soap:Body>
  <m:GetPrice xmlns:m="https://www.w3schools.com/prices">
    <m:Item>Apples</m:Item>
  </m:GetPrice>
</soap:Body>
</soap:Envelope>

 

Comment
  1. Bjarne Anker
  2. Wednesday, 7 March 2018 09:25 AM UTC
Hi Bruce.



 



I installed SOAP-UI, and I find the XML which is sent in the POST.



I will look into it and see if I can get it to work.



 



Thanks for the feedback.



 



Regards,



 



Bjarne 

  1. Helpful
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.