Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3316

Re: Java mapping to Edit Payload - Sender HTTP

$
0
0

Hi Anupam

 

Many thanks for your help so far i have now processed the  payload , but getting errors

 

Scenario is --> HTTP (SENDER)-PI-ECC

 

Please find below  HTTP post and pay load coming to PI via HTTP

 

POST Header

 

/sap/xi/adapter_plain?namespace=urn:stw:imi.imimobile.outSMS&interface=SMSRequest_Out&service=STW_IMI&sap-client=200&sap-l=En&sap-User=chet&sap-password=arora

Host: xx.xxx.xx.xxx

Content-Length: 699

charset: utf-8

Content-Type: application/x-www-form-urlencoded

 

PAYLOAD to PI

 

User=abc&password=def&TP_XML=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22+standalone%3D%22no%22%3F%3E%3C%21DOCTYPE+WIN_TPBOUND_MESSAGES+SYSTEM+%22tpbound_messages_v1.dtd%22%3E%3CWIN_TPBOUND_MESSAGES%3E%3CSMSTOTP%3E%3CSOURCE_ADDR%3E%2B447557259949%3C%2FSOURCE_ADDR%3E%3CTEXT%3ESevtest+dwj%40imi+test+20151204+-+1%3C%2FTEXT%3E%3CWINTRANSACTIONID%3E017314492267648647%3C%2FWINTRANSACTIONID%3E%3CDESTINATION_ADDR%3E62277%3C%2FDESTINATION_ADDR%3E%3CSERVICEID%3E1%3C%2FSERVICEID%3E%3CNETWORKID%3E1%3C%2FNETWORKID%3E%3CARRIVALDATETIME%3E%3CDD%3E04%3C%2FDD%3E%3CMMM%3EDEC%3C%2FMMM%3E%3CYYYY%3E2015%3C%2FYYYY%3E%3CHH%3E10%3C%2FHH%3E%3CMM%3E59%3C%2FMM%3E%3C%2FARRIVALDATETIME%3E%3C%2FSMSTOTP%3E%3C%2FWIN_TPBOUND_MESSAGES%3E&RequestID=44141449227102300

 

I am using Java url decoder, first to decode encoded URL

 

String result = java.net.URLDecoder.decode(url, "UTF-8");

 

Next step, I using a parser to convert values to target structure (shown below), but getting an error Error when parsing an XML document (Premature end of file.)

 

Please help me in getting correct code to implement the scenario i.e. decode, removing values shown in red and parsing please(capturing values shown in green in target structure) for the payload above

 

 

Source Raw XML (For understanding only)

USER=abc&Password=def&TP_XML=<?xml version="1.0" encoding="utf-8"

standalone="no"?><!DOCTYPE WIN_TPBOUND_MESSAGES SYSTEM

"tpbound_messages_v1.dtd">

<WIN_TPBOUND_MESSAGES>

<SMSTOTP>

<SOURCE_ADDR>+447740630138</SOURCE_ADDR>

<TEXT>bulktesth2</TEXT>

<WINTRANSACTIONID>357614643</WINTRANSACTIONID>

<DESTINATION_ADDR>82222</DESTINATION_ADDR>

<SERVICEID>2</SERVICEID>

<NETWORKID>2</NETWORKID>

<ARRIVALDATETIME>

<DD>19</DD>

<MMM>NOV</MMM>

<YYYY>2004</YYYY>

<HH>11</HH>

<MM>4</MM>

</ARRIVALDATETIME>

</SMSTOTP>

</WIN_TPBOUND_MESSAGES>&RequestID=1_5838512

 

Target structure

 

<?xml version="1.0" encoding="utf-8" ?>

<WIN_TPBOUND_MESSAGES>

<SMSTOTP>

<SOURCE_ADDR>+447740630138</SOURCE_ADDR>

<TEXT>bulktesth2</TEXT>

<WINTRANSACTIONID>357614643</WINTRANSACTIONID>

<DESTINATION_ADDR>82222</DESTINATION_ADDR>

<SERVICEID>2</SERVICEID>

<NETWORKID>2</NETWORKID>

<ARRIVALDATETIME>

<DD>19</DD>

<MMM>NOV</MMM>

<YYYY>2004</YYYY>

<HH>11</HH>

<MM>4</MM>

</ARRIVALDATETIME>

<USER>abc</USER>

<Password>def</Password>

<RequestID>1_5838512</RequestID>

</SMSTOTP>

</WIN_TPBOUND_MESSAGES>

 

And three captured values to be added to refined xml as shown above


Viewing all articles
Browse latest Browse all 3316

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>