[Stackoverflow] [Progress OpenEdge ABL] How to send a SOAP headers in Progress 4GL

Status
Not open for further replies.
J

Joseph Betts

Guest
Hello Progress 4GL Developers,

I would like to consume the UPS Tracking API in an ABL session.
I have ran the WSDLAnalyser for the UPS WSDL and have followed the documentation.

Here is an example of the request in XML that I wish to send (including header):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0" xmlns:v2="http://www.ups.com/XMLSchema/XOLTWS/Track/v2.0" xmlns:v11="http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0">
<soapenv:Header>
<v1:UPSSecurity>
<v1:UsernameToken>
<v1:Username>MYUSERNAME</v1:Username>
<v1:password>MYPASSWORD</v1:password>
</v1:UsernameToken>
<v1:ServiceAccessToken>
<v1:AccessLicenseNumber>MYLICENSENUMBER</v1:AccessLicenseNumber>
</v1:ServiceAccessToken>
</v1:UPSSecurity>
</soapenv:Header>
<soapenv:Body>
<v2:TrackRequest>
<v2:ReferenceNumber>
<v2:Code>MYCODE</v2:Code>
<v2:Value>MYORDERNUM</v2:Value>
</v2:ReferenceNumber>
</v2:TrackRequest>
</soapenv:Body>
</soapenv:Envelope>


This request works as expected when sent using SOAPUI to test the request. Here is my Progress4GL code so far to try and make the same request:

{us/mf/mfdtitle.i}
{/qond/apps/mfgpro/customizations/mfg/work/src/us/xx/xxwhsxml.i}

define variable hs as handle no-undo.
define variable hp as handle no-undo.
DEFINE VARIABLE cBody AS LONGCHAR NO-UNDO.
DEFINE VARIABLE cBody2 AS LONGCHAR NO-UNDO.

cBody = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0" xmlns:v2="http://www.ups.com/XMLSchema/XOLTWS/Track/v2.0" xmlns:v11="http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0">
<soapenv:Header>
<v1:UPSSecurity>
<v1:UsernameToken>
<v1:Username>MYUSERNAME</v1:Username>
<v1:password>MYPASSWORD</v1:password>
</v1:UsernameToken>
<v1:ServiceAccessToken>
<v1:AccessLicenseNumber>MYLICENSENUMBER</v1:AccessLicenseNumber>
</v1:ServiceAccessToken>
</v1:UPSSecurity>
</soapenv:Header>
<soapenv:Body>
<v2:TrackRequest>
<v2:ReferenceNumber>
<v2:Code>MYCODE</v2:Code>
<v2:Value>MYORDERNUM</v2:Value>
</v2:ReferenceNumber>
</v2:TrackRequest>
</soapenv:Body>
</soapenv:Envelope>'.

create server hs.
hs:connect( "-WSDL /home/jbetts/track/Track.wsdl -Port TrackPort -TargetNamespace http://www.ups.com/WSDL/XOLTWS/Track/v2.0 -nohostverify -nosessionreuse" ).

run TrackPortType set hp on server hs.
run ProcessTrack in hp ( input cBody, output cBody2 ).

delete procedure hp.
hs:disconnect().
delete object hs.


I think the problem is that I need to send the header in a certain way when I run the ProcessTrack procedure (using SET-CALLBACK-PROCEDURE) but I'm not sure how.

Thanks in advance!

Continue reading...
 
Status
Not open for further replies.
Top