cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP Adapter help. Editing payload on a receiver Http message

Former Member
0 Kudos

HI,

I have a HTTP to HTTP scenario where I am changing the xml tag name of the incoming payload since the data coming in is not per the W3 standards.

But before sending this data back out I have to change the tag name back to original.

I was able to take care of the incoming message with the help of William Lee's blog.

Now the problem I am facing is where to edit the payload before it is sent out to the external system.

Thanks

Nikhil

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member192343
Active Contributor
0 Kudos

Hi, please clarify your task.

Do you want to send synchronous message by http, change tag in payload, send response back to the soursce system and change tag again? If yes, then you can do it in request and response parts of message mapping.

Former Member
0 Kudos

Hi

to clarify the requirement.

we have a standard xml for pharma related data called PML. the issue in that this PML contains a tag called xml, this prevents us from importing the pml xsd into PI due to W3 standards not met.

To facilitate this I have created a new SICF service where the handler class is changing the xml tag name to 'ABC'. this help with the processing in PI.

but now when we send this data back to the target system then this tag needs to be named back to XML from 'ABC' so that the target system can process it. In our case target system is a SAP system and we are calling a standard HTTP service.


I just needed help to figure out where can i change this back in PI before it hits the target SAP system.

Hope this helps in some clarification.

Thanks

Nikhil

former_member192343
Active Contributor
0 Kudos

Is it <? xml   ... ?> statement at first line?

Can you share PML XML example?

Former Member
0 Kudos

Hi Mikhail,

here is a sample PML . The tag I am talking about is <pmlcore:XML>

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

<pmlcore:Sensor xmlns:pmlcore="urn:autoid:specification:interchange:PMLCore:xml:schema:1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:autoid:specification:interchange:PMLCore:xml:schema:1 ./PML/SchemaFiles/Interchange/PMLCore.xsd">

<pmluid:ID xmlns:pmluid="urn:autoid:specification:universal:Identifier:xml:schema:1">XXXXX

</pmluid:ID>

<pmlcore:Observation>

<pmlcore:DateTime>

1111-11-11T00:00:00.000

</pmlcore:DateTime>

<pmlcore:Command>

IN

</pmlcore:Command>

<pmlcore:Tag>

<pmluid:ID xmlns:pmluid="urn:autoid:specification:universal:Identifier:xml:schema:1" schemeID="">

1111111111111111111

</pmluid:ID>

<pmlcore:Data>

<pmlcore:XML>

<EPCStatus>

WS

</EPCStatus>

<Memory>

<DataField fieldName="zLOT">

100

</DataField>

<DataField fieldName="zNDC">

11111-11-111

</DataField>

<DataField fieldName="zPackagedDate">

1111-01-11T00:00:00.1223917-04:00

</DataField>

<DataField fieldName="zExpDate">

1111-01-11T00:00:00.1223917-04:00

</DataField>

</Memory>

</pmlcore:XML>

</pmlcore:Data>

</pmlcore:Tag>

<pmlcore:Data>

Hope this help with the issue

Thanks

Nikhil

Former Member
0 Kudos

HI ,

The code I have written to change the tag name from XML to PMLXML is as below .

   DATA: lv_xml type string.
DATA: lv_xmldata TYPE xstring.
DATA: lt_xml_info TYPE TABLE OF smum_xmltb.
DATA: lwa_xml_info LIKE LINE OF lt_xml_info.
DATA: lt_bapireturn type table of BAPIRET2.
DATA: lv_xmlout type xstring.
DATA: lv_finalout type string.
DATA: lv_content   TYPE string.


lv_xml = server->request->get_cdata( ).

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
   EXPORTING
     TEXT           = lv_xml
*   MIMETYPE       = ' '
*   ENCODING       =
  IMPORTING
    BUFFER         = lv_xmldata
  EXCEPTIONS
    FAILED         = 1
    OTHERS         = 2
           .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'SMUM_XML_PARSE'
   EXPORTING
     XML_INPUT       = lv_xmldata
   TABLES
     XML_TABLE       = lt_xml_info
     RETURN          = lt_bapireturn
           .


loop at lt_xml_info into lwa_xml_info where CNAME = 'XML' .

lwa_xml_info-CNAME = 'pmlxml'.

modify lt_xml_info from lwa_xml_info.

endloop.


CALL FUNCTION 'SMUM_XML_CREATE_X'
  IMPORTING
    XML_OUTPUT       = lv_xmlout
   TABLES
    XML_TABLE        = lt_xml_info
           .

CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
   EXPORTING
     IM_XSTRING        = lv_xmlout
*   IM_ENCODING       = 'UTF-8'
  IMPORTING
    EX_STRING         = lv_finalout
           .

server->request->set_cdata( lv_finalout ).


I need to do exact opposite of this before sending the data out to the target SAP system.


Thanks

Nikhil