cancel
Showing results for 
Search instead for 
Did you mean: 

Remove header by XSLT Mapping

arijit_mukherjee2
Participant
0 Kudos

Hello Experts,

I have an incoming XML coming through HTTP protocol which consiste of Header and the data is like below.

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

<soapenv:Envelope xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/

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

<PurchaseOrder>

</PurchaseOrder>

Footer

I need only the lines in bold.

Can any one help

Regards,

Arijit

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

Why don't you use Sender SOAP Channel instead of HTTP Sender, that will automatically remove the soap envelope and you will just receive the actual xml in your payload. This will avoid the use of XSLT mapping.

Thanks

Rajeev Gupta

RaghuVamseedhar
Active Contributor
0 Kudos

Hi Arijit,

You cannot use XSLT mapping for this input payload. Reason: this XML is not well formed: XML declaration <? ?> should occur only once, there should be only one root element. XSLT cannot take not well formed XML as input.

<?xml version="1.0" encoding="utf-8"?>
  <soapenv:Envelope xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ 
  <?xml version="1.0" encoding="utf-8"?>
   <PurchaseOrder>
   </PurchaseOrder>

So I suggest you to use Java Mapping and do String manipulations to remove the extra wrapper.

Regards,

Raghu_Vamsee

Former Member
0 Kudos

I agree with Raghu, but I Hope that it is only a Sample XML Code

arijit_mukherjee2
Participant
0 Kudos

Hi Raghu,

Actually the partner want to send this file to PI with"xx.msgdata" extension not ".xml" and the data inside it what I posted. I am not sure whether PI would be able to accept this kind of file with Sender HTTP connection. Any help?

Regards,

Arijit

Former Member
0 Kudos

Please, better explain your scenario architecture.

Why do you use Http adapter?

RaghuVamseedhar
Active Contributor
0 Kudos

> Actually the partner want to send this file to PI with"xx.msgdata" extension not ".xml" and the data inside it what I posted. I am not sure whether PI would be able to accept this kind of file with Sender HTTP connection.

Arijit,

SAP PI can handle any kind of file txt, xml, csv, pdf, doc, jpg. Most of the cases with pdf and jgp will be pass through scenario.

So PI can handle xx.msgdata, if it has text characters, we can perform transformation, if required.

Regards,

Raghu_Vamsee

Former Member
0 Kudos

To get only the message body, you can use the follow xslt code:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="UTF-8" method="xml"/>
    <xsl:template match="*">
      <xsl:copy-of select="soap:Body/*"/>
    </xsl:template>
</xsl:stylesheet>

anupam_ghosh2
Active Contributor
0 Kudos

Hi Arijit,

This is an invalid XML. Parser is producing errors for this XML.

Please check.

regards

Anupam

_______________________________________________________________________________________________________

Hi Arijit,

Could you please kindly post the complete target structure? Here you need java mapping to remove the extra envelop, then put the result in the target XML. Could you please specify what version of PI you are working with?

The sender communication channel will consist of File adapter. The contents of the file will directly flow to java mapping and no need to use FCC. The java mapping code with remove the envelop and produce the target XML. To do this follow the blog http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/4018. [original link is broken] [original link is broken] [original link is broken]

If you need help in java mapping code. Please post the complete target XML and your PI version since java mapping is different in PI 7.0 and PI 7.1.Alternatively you can follow these links for java mapping help (if required)

http://wiki.sdn.sap.com/wiki/display/XI/ParametrizedJavaMappinginPI+7.1

http://wiki.sdn.sap.com/wiki/display/XI/BeginnersguidetoJavamappingusingDOMparserinSAPXI

regards

Anupam

__________________________________________________________________________________________________________

Edited by: anupamsap on Sep 1, 2011 8:59 AM

arijit_mukherjee2
Participant
0 Kudos

Hi Anupam,

The target is ORDERS.ORDERS02 Idoc.

Regards,

Arijit

anupam_ghosh2
Active Contributor
0 Kudos

Hi Arijit,

Your scenario is therfore File to idoc. In the sender side you need sender file adapter and in receiver side you need idoc adapter. (I am not sure why you have mentioned as sender HTTP connection, I was expecting an FTP etc).

Secondly i had two queries in my earlier post.

1. what is the version of the PI you are working?

2. what is the target xml?

Now here the data flows in this way

File with soap envelop -


> java mapping----


>XML without SOAP(Target XML) -


> java/ message mapping -


> idoc.

In my earlier post I have pointed out what should be the method to create the target XML. Once you are able to do that other steps wont be that difficult. You have provided as answer the final idoc details and you did not mention the version of PI you are working on. One small request, as we are unable to see the screen you are working on, it will be nice if you are able to present complete details, so that the forum members can assist you further. By complete details I do not mean unnecessary information but relevant ones so that the scenario is clear to the members.

regards

Anupam

former_member200962
Active Contributor
0 Kudos

You can use the XSLT code mentioned here:

You need to add the source, target namspaces as per your requirement and also name of the target fields.

You will get the value present in the PurchaseOrder tags