cancel
Showing results for 
Search instead for 
Did you mean: 

Modify Namespace in payload

former_member609026
Participant
0 Kudos

Hi All,

This is inbound proxy scenario i.e Third party system --> PI --> SAP

I am using sap provided standard external definitions under both SI (inbound and outbound).

Below is the message header from third party

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

<n0:EPCISDocument schemaVersion="1.0" creationDate="2012-08-23T12:11:43+02:00">

   <EPCISBody>

      <EventList>

         <AggregationEvent>

Below is the message header that SAP can accept

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

<ns2:EPCISDocument schemaVersion="1.0" creationDate="2012-08-23T12:11:43+02:00" xmlns:ns2="http://sap.com/xi/PTA">

   <EPCISBody>

      <EventList>

         <AggregationEvent>

the only difference is the namespace (Marked it in colour).

how can i add namespace in payload to make this interface successful?

Note: I know it can be done by using XSLT Mapping  but I have to use standard sap SWC ( SCEMSRV ), can not use any mapping.

         I can not copy the objects in to separate software component.

Regards,

pradeep A.

Accepted Solutions (0)

Answers (2)

Answers (2)

nabendu_sen
Active Contributor
0 Kudos

Hi Pradeep,

You have to use Mapping (Graphical/XSLT/Java) if you want to handle this within PI. I don't think at adapter level it would be possible.

Options:

1. Generate XSD of that Standard Data Type and provide that to Third Party team so that they can use that namespace.

2. You can handle that at the Target SAP side.

3. If you want to handle that through Graphical Mapping, please find the below blog:

http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/11/05/message-mapping-play-around-with-...

Btwn, you can use Standard Content objects in your custom mapping or Enhance through Data Type Enhancement.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2006/11/14/xipi-data-type-enhancements-stand...

former_member609026
Participant
0 Kudos

Hi Sen,

i can not follow 3rd  and 4th points because i have to use graphical mapping and customized SWCV.

Reg point 2: Actually message fails at SXMB_MONI of target sap side because of the missing namespace. if you know how to handle it please let me know.

Reg point 1: can be implemented, i know that and kept it as my last option.

my total intention is to handle it in Communication channel.

looking for some more replys.

Error message in SMXB_MONI.

- <SAP:Error SOAP:mustUnderstand="" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">

<SAP:Category>XIProxy</SAP:Category> 

<SAP:Code area="ABAP">INTERFACE_SIGNATURE_ERROR</SAP:Code>

<SAP:P1>/SAPTRX/II_PTA_EVENTCAPTN_IN</SAP:P1>

<SAP:P2>EPCISDocument</SAP:P2>

<SAP:P3 /

<SAP:P4 />

<SAP:AdditionalText />

<SAP:ApplicationFaultMessage namespace="" />

<SAP:Stack>Information about the method parameters is missing for the interface /SAPTRX/II_PTA_EVENTCAPTN_IN (ABAP interface, request message EPCISDocument, request message namespace )</SAP:Stack>

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

Regards,

pradeep A. 

nabendu_sen
Active Contributor
0 Kudos

Hi Pradeep,

As per my understanding you wont be able to use Point 2 also, it requires Custom ABAP Program at Target SAP Side. I think you are using Standard Proxy at SAP side to handle this data.

Either you can go for Point 1 or you can write a Custom Java module which you can use at Sender Adapter to modify the namespace. But that's going to consume more effort. Not sure whether any other Standard SAP Module would be able to achieve your requirement.

former_member609026
Participant
0 Kudos

Hi All,

waiting for more suggestions and replys.

Regards,

pradeep A.

Former Member
0 Kudos

Hi Pradeep,

You can apply xslt mapping from message transformbean.

Please see this link:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/9e6c7911-0d01-0010-1aa3-8e1bb1551...

Regards,

Beena.

former_member609026
Participant
0 Kudos

Thanks Beena,

i already looking on the similar link.

http://scn.sap.com/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-...

Regards,

Pradeep A.

former_member609026
Participant
0 Kudos

Hi All,

check the input and output xml document attached to this mail.

The olny change that i am doing in PI is the change of namespace in the output under EPCISDocument (xmlns:ns0="http://sap.com/xi/PTA").

I already build the xsl but i have hardcoded the "creationDate" attribute which i was i don't want to.

Can any one modified the code attached to this mail.

Regards,

pradeep A.

Input File

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

<EPCISDocument schemaVersion="1.0" creationDate="2012-08-23T12:11:43+02:00" xmlns:ns0="urn:epcglobal:epcis:xsd:1">

   <EPCISHeader>

      <StandardBusinessDocumentHeader xmlns="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader">

         <HeaderVersion/>

         <Sender>

            <Identifier Authority=""/>

            <ContactInformation>

               <Contact/>

               <EmailAddress/>

               <FaxNumber/>

               <TelephoneNumber/>

               <ContactTypeIdentifier/>

            </ContactInformation>

         </Sender>

         <Receiver>

            <Identifier Authority=""/>

            <ContactInformation>

               <Contact/>

               <EmailAddress/>

               <FaxNumber/>

               <TelephoneNumber/>

               <ContactTypeIdentifier/>

            </ContactInformation>

         </Receiver>

         <DocumentIdentification>

            <Standard/>

            <TypeVersion/>

            <InstanceIdentifier/>

            <Type/>

            <MultipleType/>

            <CreationDateAndTime/>

         </DocumentIdentification>

         <Manifest>

            <NumberOfItems/>

            <ManifestItem>

               <MimeTypeQualifierCode/>

               <UniformResourceIdentifier/>

               <Description/>

               <LanguageCode/>

            </ManifestItem>

         </Manifest>

         <BusinessScope>

            <Scope>

               <Type/>

               <InstanceIdentifier/>

               <Identifier/>

               <ScopeInformation/>

            </Scope>

         </BusinessScope>

      </StandardBusinessDocumentHeader>

      <extension/>

   </EPCISHeader>

   <EPCISBody>

      <EventList>

         <ObjectEvent>

            <eventTime/>

            <recordTime/>

            <eventTimeZoneOffset/>

            <baseExtension/>

            <epcList>

               <epc type=""/>

            </epcList>

            <action/>

            <bizStep/>

            <disposition/>

            <readPoint>

               <id/>

               <extension/>

            </readPoint>

            <bizLocation>

               <id/>

               <extension/>

            </bizLocation>

            <bizTransactionList>

               <bizTransaction type=""/>

            </bizTransactionList>

            <extension/>

            <SAPExtension >

               <SAPEventExtension>

                  <ParameterName/>

                  <ParameterValue/>

               </SAPEventExtension>

               <SAPEPCExtension>

                  <EPC type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPEPCExtension>

               <SAPBizTransactionExtension>

                  <bizTransaction type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPBizTransactionExtension>

            </SAPExtension>

         </ObjectEvent>

         <AggregationEvent>

            <eventTime/>

            <recordTime/>

            <eventTimeZoneOffset/>

            <baseExtension/>

            <parentID type=""/>

            <childEPCs>

               <epc type=""/>

            </childEPCs>

            <action/>

            <bizStep/>

            <disposition/>

            <readPoint>

               <id/>

               <extension/>

            </readPoint>

            <bizLocation>

               <id/>

               <extension/>

            </bizLocation>

            <bizTransactionList>

               <bizTransaction type=""/>

            </bizTransactionList>

            <extension/>

            <SAPExtension >

               <SAPEventExtension>

                  <ParameterName/>

                  <ParameterValue/>

               </SAPEventExtension>

               <SAPEPCExtension>

                  <EPC type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPEPCExtension>

               <SAPBizTransactionExtension>

                  <bizTransaction type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPBizTransactionExtension>

            </SAPExtension>

         </AggregationEvent>

         <QuantityEvent>

            <eventTime/>

            <recordTime/>

            <eventTimeZoneOffset/>

            <baseExtension/>

            <epcClass/>

            <quantity/>

            <bizStep/>

            <disposition/>

            <readPoint>

               <id/>

               <extension/>

            </readPoint>

            <bizLocation>

               <id/>

               <extension/>

            </bizLocation>

            <bizTransactionList>

               <bizTransaction type=""/>

            </bizTransactionList>

            <extension/>

            <SAPExtension >

               <SAPEventExtension>

                  <ParameterName/>

                  <ParameterValue/>

               </SAPEventExtension>

               <SAPEPCExtension>

                  <EPC type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPEPCExtension>

               <SAPBizTransactionExtension>

                  <bizTransaction type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPBizTransactionExtension>

            </SAPExtension>

         </QuantityEvent>

         <TransactionEvent>

            <eventTime/>

            <recordTime/>

            <eventTimeZoneOffset/>

            <baseExtension/>

            <bizTransactionList>

               <bizTransaction type=""/>

            </bizTransactionList>

            <parentID type=""/>

            <epcList>

               <epc type=""/>

            </epcList>

            <action/>

            <bizStep/>

            <disposition/>

            <readPoint>

               <id/>

               <extension/>

            </readPoint>

            <bizLocation>

               <id/>

               <extension/>

            </bizLocation>

            <extension/>

            <SAPExtension >

               <SAPEventExtension>

                  <ParameterName/>

                  <ParameterValue/>

               </SAPEventExtension>

               <SAPEPCExtension>

                  <EPC type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPEPCExtension>

               <SAPBizTransactionExtension>

                  <bizTransaction type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPBizTransactionExtension>

            </SAPExtension>

         </TransactionEvent>

         <extension/>

      </EventList>

      <extension/>

   </EPCISBody>

   <extension>1</extension>

</EPCISDocument>

Output File:

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

<EPCISDocument schemaVersion="1.0" creationDate="2012-08-23T12:11:43+02:00" xmlns:ns0="http://sap.com/xi/PTA">

   <EPCISHeader>

      <StandardBusinessDocumentHeader xmlns="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader">

         <HeaderVersion/>

         <Sender>

            <Identifier Authority=""/>

            <ContactInformation>

               <Contact/>

               <EmailAddress/>

               <FaxNumber/>

               <TelephoneNumber/>

               <ContactTypeIdentifier/>

            </ContactInformation>

         </Sender>

         <Receiver>

            <Identifier Authority=""/>

            <ContactInformation>

               <Contact/>

               <EmailAddress/>

               <FaxNumber/>

               <TelephoneNumber/>

               <ContactTypeIdentifier/>

            </ContactInformation>

         </Receiver>

         <DocumentIdentification>

            <Standard/>

            <TypeVersion/>

            <InstanceIdentifier/>

            <Type/>

            <MultipleType/>

            <CreationDateAndTime/>

         </DocumentIdentification>

         <Manifest>

            <NumberOfItems/>

            <ManifestItem>

               <MimeTypeQualifierCode/>

               <UniformResourceIdentifier/>

               <Description/>

               <LanguageCode/>

            </ManifestItem>

         </Manifest>

         <BusinessScope>

            <Scope>

               <Type/>

               <InstanceIdentifier/>

               <Identifier/>

               <ScopeInformation/>

            </Scope>

         </BusinessScope>

      </StandardBusinessDocumentHeader>

      <extension/>

   </EPCISHeader>

   <EPCISBody>

      <EventList>

         <ObjectEvent>

            <eventTime/>

            <recordTime/>

            <eventTimeZoneOffset/>

            <baseExtension/>

            <epcList>

               <epc type=""/>

            </epcList>

            <action/>

            <bizStep/>

            <disposition/>

            <readPoint>

               <id/>

               <extension/>

            </readPoint>

            <bizLocation>

               <id/>

               <extension/>

            </bizLocation>

            <bizTransactionList>

               <bizTransaction type=""/>

            </bizTransactionList>

            <extension/>

            <SAPExtension >

               <SAPEventExtension>

                  <ParameterName/>

                  <ParameterValue/>

               </SAPEventExtension>

               <SAPEPCExtension>

                  <EPC type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPEPCExtension>

               <SAPBizTransactionExtension>

                  <bizTransaction type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPBizTransactionExtension>

            </SAPExtension>

         </ObjectEvent>

         <AggregationEvent>

            <eventTime/>

            <recordTime/>

            <eventTimeZoneOffset/>

            <baseExtension/>

            <parentID type=""/>

            <childEPCs>

               <epc type=""/>

            </childEPCs>

            <action/>

            <bizStep/>

            <disposition/>

            <readPoint>

               <id/>

               <extension/>

            </readPoint>

            <bizLocation>

               <id/>

               <extension/>

            </bizLocation>

            <bizTransactionList>

               <bizTransaction type=""/>

            </bizTransactionList>

            <extension/>

            <SAPExtension >

               <SAPEventExtension>

                  <ParameterName/>

                  <ParameterValue/>

               </SAPEventExtension>

               <SAPEPCExtension>

                  <EPC type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPEPCExtension>

               <SAPBizTransactionExtension>

                  <bizTransaction type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPBizTransactionExtension>

            </SAPExtension>

         </AggregationEvent>

         <QuantityEvent>

            <eventTime/>

            <recordTime/>

            <eventTimeZoneOffset/>

            <baseExtension/>

            <epcClass/>

            <quantity/>

            <bizStep/>

            <disposition/>

            <readPoint>

               <id/>

               <extension/>

            </readPoint>

            <bizLocation>

               <id/>

               <extension/>

            </bizLocation>

            <bizTransactionList>

               <bizTransaction type=""/>

            </bizTransactionList>

            <extension/>

            <SAPExtension >

               <SAPEventExtension>

                  <ParameterName/>

                  <ParameterValue/>

               </SAPEventExtension>

               <SAPEPCExtension>

                  <EPC type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPEPCExtension>

               <SAPBizTransactionExtension>

                  <bizTransaction type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPBizTransactionExtension>

            </SAPExtension>

         </QuantityEvent>

         <TransactionEvent>

            <eventTime/>

            <recordTime/>

            <eventTimeZoneOffset/>

            <baseExtension/>

            <bizTransactionList>

               <bizTransaction type=""/>

            </bizTransactionList>

            <parentID type=""/>

            <epcList>

               <epc type=""/>

            </epcList>

            <action/>

            <bizStep/>

            <disposition/>

            <readPoint>

               <id/>

               <extension/>

            </readPoint>

            <bizLocation>

               <id/>

               <extension/>

            </bizLocation>

            <extension/>

            <SAPExtension >

               <SAPEventExtension>

                  <ParameterName/>

                  <ParameterValue/>

               </SAPEventExtension>

               <SAPEPCExtension>

                  <EPC type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPEPCExtension>

               <SAPBizTransactionExtension>

                  <bizTransaction type=""/>

                  <NameValuePair>

                     <ParameterName/>

                     <ParameterValue/>

                  </NameValuePair>

               </SAPBizTransactionExtension>

            </SAPExtension>

         </TransactionEvent>

         <extension/>

      </EventList>

      <extension/>

   </EPCISBody>

   <extension>1</extension>

</EPCISDocument>

XSLT code:

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

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" encoding="UTF-8"/>


<xsl:template match="/EPCISDocument">


<ns0:EPCISDocument schemaVersion="1.0" creationDate="2012-08-23T12:11:43+02:00" xmlns:ns0="http://sap.com/xi/PTA">

<xsl:copy-of select="node()|@*"/>


</ns0:EPCISDocument>


</xsl:template>

</xsl:stylesheet>

former_member609026
Participant
0 Kudos

Hi All,

Waiting for some replys.

Regards,

pradeep A.

GabrielSagaya
Active Contributor
0 Kudos

Can you use the XSLT code from Zameer's reply in order to have the additional namespace

http://scn.sap.com/thread/3202784

Former Member
0 Kudos

Hi Pradeep,

You can add attributes using

<xsl:copy-of select="@*"/> as below:

<xsl:template match="/EPCISDocument"> 


<ns0:EPCISDocument  xmlns:ns0="http://sap.com/xi/PTA">

<xsl:copy-of select="@*"/>

<xsl:copy-of select="node()|@*"/>


</ns0:EPCISDocument>


</xsl:template>

However when I tried to run your xsl, getting same old namespace for header and body elements also.

Regards,

Beena

former_member609026
Participant
0 Kudos

Hi All,

i know using XML Anonymizer Bean in Communication Channel is to remove/change name space prefix in XML payload.

can i use it to add a new namepace?

http://www.saptechnical.com/Tutorials/XI/XMLPayload/Index.htm

Regards,

pradeep A.

nabendu_sen
Active Contributor
0 Kudos

Hi Pradeep,

Please check the below SAP Document.

http://help.sap.com/saphelp_nw04/helpdata/en/45/d169186a29570ae10000000a114a6b/content.htm

"anonymizer.acceptNamespaces" can be used only to keep namespaces which are coming from Sender.

In your case, its not coming from Sender but you want to add before submitting message to Receiver.