cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT mapping help

former_member10771
Active Participant
0 Kudos

Hi All,

How can I construct the response header . This is the response message I am getting from ECC. I need to add this <Xheader> and send it across to legacy back. This header is not present currently in PI in their WSDL so I need to construct this and add to the response while sending. Can someone please help with the same.

Response from ECC

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

<ns0:ExchangeRateByExchangeRateResponse_sync xmlns:ns0="http://sap.com/xi/APPL/SE/Global">

   <MessageHeader>

      <ID schemeID="" schemeAgencyID="" schemeAgencySchemeAgencyID=""/>

      <ReferenceID schemeID="" schemeAgencyID="" schemeAgencySchemeAgencyID=""/>

      <CreationDateTime/>

      <TestDataIndicator/>

      <ReconciliationIndicator/>

      <SenderBusinessSystemID/>

      <RecipientBusinessSystemID/>

      <SenderParty>

         <InternalID schemeID="" schemeAgencyID=""/>

         <StandardID schemeAgencyID=""/>

         <ContactPerson>

            <InternalID schemeID="" schemeAgencyID=""/>

            <OrganisationFormattedName/>

            <PersonFormattedName/>

            <PhoneNumber>

               <AreaID/>

               <SubscriberID/>

               <ExtensionID/>

               <CountryCode/>

               <CountryDiallingCode/>

               <CountryName languageCode=""/>

            </PhoneNumber>

         </ContactPerson>

      </SenderParty>

   </MessageHeader>

   <ExchangeRate>

      <ExchangeRate>

         <UnitCurrency/>

         <QuotedCurrency/>

      </ExchangeRate>

      <ExchangeRateTypeCode listVersionID="" listAgencyID="" listAgencySchemeID="" listAgencySchemeAgencyID=""/>

   </ExchangeRate>

   <Log>

      <BusinessDocumentProcessingResultCode/>

      <MaximumLogItemSeverityCode/>

      <Item>

         <TypeID/>

      </Item>

   </Log>

</ns0:ExchangeRateByExchangeRateResponse_sync>

Resposne to be sent to Legacy - Just want to have this header information added while sending it back.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:http="http:\\www.test.com\\POC">

   <soapenv:Header>

      <XHeader>

         <Name>?</Name>

         <Id>?</Id>

         <User>

            <UserType></UserType>

            <UserToken>?</UserToken>

         </User>

</XHeader>

   </soapenv:Header>

   <soapenv:Body>

      <MT_TAR>

         <N1>?</N1>

         <N2>?</N2>

      </MT_TAR>

   </soapenv:Body>

</soapenv:Envelope>

Accepted Solutions (1)

Accepted Solutions (1)

former_member10771
Active Participant
0 Kudos

Hi All ,


I have done this below XSLT code and I am able to get the header fields. Can you please let me know what modification is needed to get the target fields in soap envelope. I am able to construct the header here with this code I wrote.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<soap:Header>

<XHeader  xmlns="http:\\www.test.com\\POC">

<Name></Name>

<ID></ID>

  <User>

            <UserType>?</UserType>

            <UserToken>?</UserToken>

</User>

</XHeader>

</soap:Header>

<soap:Body>

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

</soap:Body></soap:Envelope>

</xsl:template>

</xsl:stylesheet>

former_member10771
Active Participant
0 Kudos

Hi All ,

Can you please let me know on the above query and how can I map the source field say

<CreationDateTime/>

      <TestDataIndicator/> to the

<Name></Name>

<ID></ID in target.

What modification is needed to get this and the body fields. This is my XSLT

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<soap:Header>

<XHeader  xmlns="http:\\www.test.com\\POC">

<Name></Name>

<ID></ID>

  <User>

            <UserType>?</UserType>

            <UserToken>?</UserToken>

</User>

</XHeader>

</soap:Header>

<soap:Body>

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

</soap:Body></soap:Envelope>

</xsl:template>

</xsl:stylesheet>

former_member10771
Active Participant
0 Kudos

Hi All,

Can anyone please provide me some details on above query

iaki_vila
Active Contributor
0 Kudos

Hi Amit,

Sorry i'm a bit confused you want to map CreationDateTime to Name and TestDataIndicator To ID ?

Regards.

iaki_vila
Active Contributor
0 Kudos

Hi Amit,

If Im right you would need only two xsl:value-of and to define the ns0 namespace:


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://sap.com/xi/APPL/SE/Global">

    <xsl:template match="/">

        <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

            <soap:Header>

                <XHeader xmlns="http:\\www.test.com\\POC">

                    <Name><xsl:value-of select="/ns0:ExchangeRateByExchangeRateResponse_sync/MessageHeader/CreationDateTime"/></Name>

                    <ID><xsl:value-of select="/ns0:ExchangeRateByExchangeRateResponse_sync/MessageHeader/TestDataIndicator"/></ID>

                    <User>

                        <UserType>?</UserType>

                        <UserToken>?</UserToken>

                    </User>

                </XHeader>

            </soap:Header>

            <soap:Body>

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

            </soap:Body>

        </soap:Envelope>

    </xsl:template>

</xsl:stylesheet>

But according with your first post i think you are getting a wrong soap:Body, are you sure that the result in this tag is that you want?

Regards

former_member10771
Active Participant
0 Kudos

Hi Inaki,


Actually I want to modiy the XSLT code to see if I can map the header values from the response to the newly created header (Xheader ). Now my XSLT code is creating a Xheader and then the body and all the values are present under the body.

Say for Ex :-

      <SenderBusinessSystemID/> SAP

      <RecipientBusinessSystemID/> Legacy

These values are coming from response message , how can I add these to the Xheader fields or say map to any of the fields in header like date or time for example.

I am getting these values under the Body. Is there any way I can get them in the Xheader. I hope I am able to clarify else I will send a screenshot if it is not clear.


Rest is working perfectly fine.

former_member10771
Active Participant
0 Kudos

Thanks Inaki. I got the result as expected.


Thanks for the help.I will modify it for remaining structure accordingly.

former_member10771
Active Participant
0 Kudos

Hi Inaki,

Just needed one more clarification the scenario is working fine.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:http="http:\\www.test.com\\POC">

   <soapenv:Header>

      <XHeader>

         <Name>?</Name>

         <Id>?</Id>

         <User>

            <UserType></UserType>

            <UserToken>?</UserToken>

         </User>

</XHeader>

   </soapenv:Header>

   <soapenv:Body>

      <MT_TAR>

         <N1>?</N1>

         <N2>?</N2>

      </MT_TAR>

   </soapenv:Body>

</soapenv:Envelope>

This is my source message which I am sending to PI and removing the header using XSLT mapping as below

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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:http="http:\www.test.com\POC" exclude-result-prefixes="soapenv http">

  <xsl:output method="xml"/>

  <xsl:template match="/">

  <ns1:ZpiTest xmlns:ns1="urn:sap-com:document:sap:soap:functions:mc-style">

  <Num1>

  <xsl:value-of select="/soapenv:Envelope/soapenv:Body/http:MT_SRC/N1"/>

  </Num1>

  <Num2>

  <xsl:value-of select="/soapenv:Envelope/soapenv:Body/http:MT_SRC/N2"/>

  </Num2>

  </ns1:ZpiTest>

  </xsl:template>

</xsl:stylesheet>

Is there any way I can have the header information

<XHeader>

         <Name>?</Name>

         <Id>?</Id>

         <User>

            <UserType></UserType>

            <UserToken>?</UserToken>

         </User>

</XHeader> stored in PI somewhere and during response attach the same to the target message in XSLT.

Will this dynamic configuration with XSLT work if I modify above XSLT code to store this <Xheader> and in response attach that to the response message by referring to dynamic configuration from source xslt. Is this possible.

Answers (0)