Hi Scott.
This is a sample of the SOAP message that I would send:
<?xml version="1.0"?>
-<soapenv:Envelope
xmlns:soap="
http://servicegate.infolock.com/MSC/ServiceSys/SOAPHandler"
xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/">-<soapenv:Header>-<soap:RequestHeader><soap:Affiliation>af</soap:Affiliation><soap:Requestor>sv0</soap:Requestor><soap:TimeoutSeconds>10</soap:TimeoutSeconds></soap:RequestHeader></soapenv:Header>-<soapenv:Body>-<soap:SOAPRequest>-<RequestDocument>
<![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<msvauth:Servicegate-Authorization
xmlns:msvdict="
http://servicegate.infolock.com/ns/sv/v2.0/dictionary"
xmlns:msvbase="
http://servicegate.infolock.com/ns/sv/v2.0/basetypes"
xmlns:msvauth="
http://servicegate.infolock.com/ns/sv/v2.0/auth"
xmlns:msvtrx="
http://servicegate.infolock.com/ns/sv/v2.0/transaction"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://servicegate.infolock.com/ns/sv/v2.0/auth
http://servicegate.beta.infolock.com/public/auth/sv/v2.0/request.xsd"
DocVersion="2.0" Id="A1"> <msvtrx:SoftwareInfo>
<msvtrx:Name>Name0</msvtrx:Name> <msvtrx:Version>1.0</msvtrx:Version>
</msvtrx:SoftwareInfo> <msvtrx:Transaction Id="T1">
<msvtrx:Number>123456</msvtrx:Number> <msvtrx:Type>Sale</msvtrx:Type>
<msvtrx:AuthorizationType>Auth</msvtrx:AuthorizationType>
<msvtrx:TerminalId>10290000297</msvtrx:TerminalId>
<msvtrx:BatchNumber>100</msvtrx:BatchNumber>
<msvtrx:Currency>USD</msvtrx:Currency> <msvtrx:Time
TimeZone="US-CHICAGO">2012-05-04T18:13:51</msvtrx:Time> <msvtrx:CardInfo
Type="Avcard" Expiry="2014-07">
<msvtrx:CardNumber>6010295001064972</msvtrx:CardNumber> </msvtrx:CardInfo>
<msvtrx:Amount>105.00</msvtrx:Amount>
<msvtrx:PurchaseOrderNumber>PO1234</msvtrx:PurchaseOrderNumber>
<msvtrx:AircraftTailNumber>TAIL123456</msvtrx:AircraftTailNumber>
<msvtrx:Detail Id="D015"> <msvtrx:Number>1</msvtrx:Number>
<msvtrx:ItemCode>JetAFuel</msvtrx:ItemCode>
<msvtrx:Amount>100.00</msvtrx:Amount> <msvtrx:Rate
Type="PerUnit">5.000</msvtrx:Rate> <msvtrx:Quantity
Units="USGallon">20.000</msvtrx:Quantity> <msvtrx:DeliveryTime
TimeZone="US-CHICAGO">2012-05-04T18:13:51</msvtrx:DeliveryTime>
</msvtrx:Detail> <msvtrx:Detail Id="D016"> <msvtrx:Number>2</msvtrx:Number>
<msvtrx:ParentDetail Id="D015"/> <msvtrx:ItemCode>SalesTax</msvtrx:ItemCode>
<msvtrx:Amount>5.00</msvtrx:Amount> <msvtrx:Rate
Type="Percentage">5.0</msvtrx:Rate> </msvtrx:Detail> </msvtrx:Transaction>
</msvauth:Servicegate-Authorization> ]]>
</RequestDocument></soap:SOAPRequest></soapenv:Body></soapenv:Envelope>
Apologies in advance if this is obvious. I am a relative novice when it
comes to this SOAP stuff. I don't believe I would have to worry about
escaping my XML data in the "RequestDocument" element of the SOAP. The XML
is within CDATA. Correct?
-----Original Message-----
From: Scott Klement
Sent: Thursday, December 20, 2012 2:09 PM
To: RPG programming on the IBM i / System i
Subject: Re: HTTPAPI and Webservices
hi Robert,
Yes, I think you're right, Robert. For example, if your XML currently
looks like this:
<myXML>Data</myXML>
then in a wrapped SOAP message it'd look something like this:
<soap:Envelope xmlns:soap="
http://www.w3.org/2001/12/soap-envelope"
xmlns:tns="urn:WellingtonRoyceXmlWrapper">
<soap:Body>
<tns:YourRequest>
<tns:Data><myXML>Data</myXML></tns:Data>
</tns:YourRequest>
</soap:Body>
</soap:Envelope>
Granted, I made up some of the names ("YourRequest", "Data", the TNS
namespace) but that's the general idea. The original XML is escaped
into character entities and placed in a parameter of a SOAP message.
It shouldn't be hard to build this message in an RPG program, and send
it via HTTPAPI. The hardest part will be escaping the existing XML data
-- but it shouldn't be too bad. If you can't figure it out, let me know.
When the output message is sent back, you can use HTTPAPI's XML parser
to extract the original XML data -- it'll automatically "unescape" it
for you.
-SK
On 12/20/2012 11:53 AM, Robert J. Mullis wrote:
Thanks Scott.
My XML will stay the same. It is "wrapped" in a SOAP message for the web
service. If I understand everything correctly, I should still be able to
use my same HTTP process that I am using now. The only difference is that
I
will need to "wrap" the XML in a SOAP message, before sending it. When
the
XML is returned, I will need to remove the SOAP message "wrapper", before
I
can parse the XML. Is my assumption correct?
As an Amazon Associate we earn from qualifying purchases.