J
Joseph Betts
Guest
Hello Progress4GL Developers,
I have the following XML response stored in a longchar variable called cBody after making a successful SOAP call to UPS:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<trk:TrackResponse xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:trk="http://www.ups.com/XMLSchema/XOLTWS/Track/v2.0"><common:Response xmlns:common="http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0">
<common:ResponseStatus>
<common:Code>1</common:Code>
<common
escription>Success</common
escription>
</common:ResponseStatus>
<common:TransactionReference/>
</common:Response>
<trk:Shipment>
<trk:InquiryNumber>
<trk:Code>01</trk:Code>
<trk
escription>ShipmentIdentificationNumber</trk
escription>
<trk:Value>MYTRACKERNUMBER</trk:Value>
</trk:InquiryNumber>
...
I now store this as as a X-DOCUMENT using the following line of code:
hDoc:LOAD("longchar",cBody2,FALSE).
Now I would like to check if my response has a tracking number, and if it does I would like to store the tracking number as a variable. It appears that this is possible: OpenEdge 11.7 Documentation
However this is what I have so far, and it doesn't seem to work. Nothing is outputted but no runtime errors:
....
hDoc:LOAD("longchar",cBody,FALSE).
DEFINE variable hNodeRef as HANDLE NO-UNDO.
CREATE X-NODEREF hNodeRef.
hDoc:GET-DOCUMENT-ELEMENT(hNodeRef).
IF hNodeRef:NAME = "trk:value" THEN
message hNoderef:GET-ATTRIBUTE("id") hNoderef:ATTRIBUTE-NAMES.
....
Continue reading...
I have the following XML response stored in a longchar variable called cBody after making a successful SOAP call to UPS:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<trk:TrackResponse xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:trk="http://www.ups.com/XMLSchema/XOLTWS/Track/v2.0"><common:Response xmlns:common="http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0">
<common:ResponseStatus>
<common:Code>1</common:Code>
<common


</common:ResponseStatus>
<common:TransactionReference/>
</common:Response>
<trk:Shipment>
<trk:InquiryNumber>
<trk:Code>01</trk:Code>
<trk


<trk:Value>MYTRACKERNUMBER</trk:Value>
</trk:InquiryNumber>
...
I now store this as as a X-DOCUMENT using the following line of code:
hDoc:LOAD("longchar",cBody2,FALSE).
Now I would like to check if my response has a tracking number, and if it does I would like to store the tracking number as a variable. It appears that this is possible: OpenEdge 11.7 Documentation
However this is what I have so far, and it doesn't seem to work. Nothing is outputted but no runtime errors:
....
hDoc:LOAD("longchar",cBody,FALSE).
DEFINE variable hNodeRef as HANDLE NO-UNDO.
CREATE X-NODEREF hNodeRef.
hDoc:GET-DOCUMENT-ELEMENT(hNodeRef).
IF hNodeRef:NAME = "trk:value" THEN
message hNoderef:GET-ATTRIBUTE("id") hNoderef:ATTRIBUTE-NAMES.
....
Continue reading...