dsiPDCXListener Integration Methods

Transcription

dsiPDCXListener Integration Methods
dsiPDCXListener Integration Methods
There are four different methods of integration to the dsiPDCXListener. To send a transaction via one of
these methods, append the method to the URL after the port. For example if you would like to integrate
to method1 and the listener is listening on port 9999 of the local computer, you would POST the
transaction to: http://127.0.0.1:9999/method1.
method1
•
•
POST Url = http://127.0.0.1:9999/method1
Content-Type: datacap/xml – Using this method you will send a Datacap XML fragment exactly as
you would to any other Datacap control. The XML is then forwarded exactly as you sent it. In this
method and content-type there is no reason to encode any of the data; it is sent as-is:
<?xml version="1.0"?>
<TStream>
<Admin>
<ComPort>0</ComPort>
<SecureDevice>NONE</SecureDevice>
<MerchantID>InStore</MerchantID>
<OperatorID>50</OperatorID>
<TranCode>ServerVersion</TranCode>
</Admin>
</TStream>
•
Content-Type: application/x-www-form-urlencoded – Using this method you will hardcode
Xml_String= and then send an encoded version of the Datacap XML payload:
Xml_String=%3C%3Fxml+version%3D%271.0%27%3F%3E++++++++++++++++++++++++++++++++++++++++%09
%3CTStream%3E+++++++++++++++++++++++++++++++++++++++++++++%09%3CAdmin%3E+++++++++++++++++
++++++++++++++++++++++++%09%09%3CComPort%3E0%3C%2FComPort%3E++++++++++++++++++++++++%09%0
9%3CSecureDevice%3ENONE%3C%2FSecureDevice%3E+++%09%09%3CMerchantID%3EInStore%3C%2FMerchan
tID%3E+++++++++++++%09%09%3COperatorID%3E50%3C%2FOperatorID%3E+++++++++++++++++%09%09%3CT
ranCode%3EServerVersion%3C%2FTranCode%3E+++++++++++++++++%09%3C%2FAdmin%3E+++++++++++++++
+++++++++++++++++++++++++%3C%2FTStream%3E
method2
•
•
•
•
POST Url = http://127.0.0.1:9999/WS_DSI/SOAP/method2
method2 is a SOAP option with Content-Type:text/xml
Set SoapAction in the http headers to:
http://soap.ws.dsiclient.dcap.com/SoapService/ProcessTransactionRequest/
The data inside <TransactionXmlString> is encoded:
<?xml version="1.0" encoding="UTF-8"?><S:Envelope
xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:ProcessTransaction
xmlns:ns2="http://soap.ws.dsiclient.datacap.com/"><TransactionXmlString>&lt;?xml
version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;TStream&gt;
&lt;Admin&gt;
&lt;MerchantID&gt;595901&lt;/MerchantID&gt; &lt;ComPort&gt;1&lt;/ComPort&gt;
&lt;SecureDevice&gt;NONE&lt;/SecureDevice&gt;
&lt;OperatorID&gt;100&lt;/OperatorID&gt;
&lt;TranCode&gt;ServerVersion&lt;/TranCode&gt;
&lt;/Admin&gt;
&lt;/TStream&gt;</TransactionXmlString><UserTrace>UT</UserTrace></ns2:ProcessTransaction>
</S:Body></S:Envelope>
dsipdcxlistener methods
© 2015 Mercury
Page 1 of 2
dsiPDCXListener Integration Methods
method3
•
•
•
•
POST Url = http://127.0.0.1:9999/WS_DSI/SOAP/method3
Method3 is also a SOAP option with Content-Type:text/xml
Set SoapAction in the http headers to:
http://soap.ws.dsiclient.dcap.com/SoapService/ProcessTransactionRequest/
The data inside <ProcessTransaction> is not encoded but uses a different namespace:
<?xml version="1.0" encoding="UTF-8"?> <S:Envelope
xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:ProcessTransaction
xmlns:ns2="http://soap.ws.dsiclient.datacap.com/"> <Dsi:TStream
xmlns:Dsi="http://schemas.dsi.tstream/"> <Dsi: Admin > <Dsi: ComPort>0</Dsi: ComPort>
<Dsi: SecureDevice>NONE</Dsi: SecureDevice> <Dsi: MerchantID>InStore</Dsi: MerchantID>
<Dsi:TranCode>ServerVersion</Dsi:TranCode> </Dsi:Admin> </Dsi:TStream>
</ns2:ProcessTransaction> </S:Body> </S:Envelope>
method4
•
•
•
POST Url = http://127.0.0.1:9999/method4
Method4 sends name/value pairs and Content-Type: application/x-www-form-urlencoded
The value in the name/value pair must be urlencoded:
TranCode=ServerVersion&OperatorID=50&MerchantID=InStore&ComPort=0&TStream=Admin&SecureDev
ice=NONE&
What values to send
There are examples for each method above, but basically the values sent correspond to the dsiPDCX
specification. If you choose to use one of the XML methods, the XML string you send to the dsiPDCX
control is exactly the same.
What to do with the response
Parse it, store it; basically do the same thing with the response that you would do with the dsiPDCX
integration.
Make sure to escape data when required
As noted above some of the method/content-type combos require that you urlencode data. Not
urlencoding data when it is required will create a very difficult troubleshooting scenario.
Make sure to send the correct content-type in http header
As the dsiPDCXListener is updated with new functionality, it is important to remember that it performs
actions based on the content-type sent by the developer. If a developer sends an unknown (or
incorrect) content-type there may be unexpected behavior.
Timeouts (connect and response)
Because the developer is not embedding a control within the POS application and calling out to a
separate application, please consider the ramifications of “abnormal processing.” For example, how
long will the POS wait for a response from the dsiPDCXListener? What will the POS do if a response was
not received?
dsipdcxlistener methods
© 2015 Mercury
Page 2 of 2