cancel
Showing results for 
Search instead for 
Did you mean: 

Removing XML Declarations from Sender Payload

Former Member
0 Kudos

Hi Experts,

I am trying to get an XML file from a website for exchange rates using sender Axis Adapter. I have developed my scenario via

In payload i have XML declarations, which causes an exception as " <faultstring>org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.</faultstring> ".

When i remove those XML declarations in SOAPUI and send the payload, it works successfully. But since i am getting the XML document from a Website, i cannot remove them from payload till it reaches to sender communication channel, I also have tried XMLAnonmyizerBean.  Is there any module in communication channel or anyway i can do to remove those declarations?

Note: I can see the same exception when communication channel gets payload from website  via Alert Configuration.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

javier_alcubilla
Contributor
0 Kudos

Hi Faruk

Try creating an adapter module that remove the information that is annoying to you

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0b39e65-981e-2b10-1c9c-fc3f8e674...

Regards

Javi

Former Member
0 Kudos

Hi,

I am afraid, i dont have authorization to deploy new jar files to server. Any other suggestions?

javier_alcubilla
Contributor
0 Kudos

It's possible to create the module and deploy it through SUM. Your basis team could do it

steve_coombes
Participant
0 Kudos

Hello Faruk

Michal's example appears to be accessing a RESTful web service, without the SOAP document structure. So he sends the XML message including the declaration.

Are you consuming a SOAP web service?

Kind regards

Steve

Former Member
0 Kudos

Hi Steve,

The URL to get the Xml is http://www.tcmb.gov.tr/kurlar/today.xml


I just used the instructions referring to Michal's example, which he said Axis Adapter can be used to retrieve an xml file.

Regards.

steve_coombes
Participant
0 Kudos

Thanks.

The URL returns XML and I've just found another of Michal's posts in which he says this is not easy in PI

http://scn.sap.com/people/michal.krawczyk2/blog/2010/01/22/pixi-how-to-get-an-xml-file-from-a-web-pa...

That is from 2010 so the situation might have changed.

The response also includes a reference to a stylesheet

<?xml-stylesheet type="text/xsl" href="isokur.xsl"?>

which is why it is rendered as HTML when you open it in a browser. I don't know if that would be a problem in PI. Probably not.

Is the problem reading the XML, or using it as a payload in another message? The data in the SOAP body in your example seems to be the response from the web site.

You should still be able to use Michal's Axis example. Do you have the enableREST parameter set to avoid using SOAP?

regards

Steve

Former Member
0 Kudos

Hi Steve,

Thanks.

I am trying to get the XML and send it to anotther system via RFC.

But in cc monitoring i get the error as "the processing instructions is not allowed in soap message".

The soap body in my example is the wsdl from sender agreement. I was trying it manually from soapui after getting error in cc monitoring.

Only parameter in sender axis adapter is enableRest =true , how can i set it to avoid to use soap? Or how can i find the necessary value to do that?

Regards.

steve_coombes
Participant
0 Kudos

Hello Faruk

I have never used the Axis adapter so don't have much to suggest. The AXIS installation does seem to depend on PI patch-level but if you can use the AXIS classes then it should just work.

But if Axis is returning a SOAP message I don't think you'll be able to remove the XML declaration from the SOAP body before it fails in PI, i.e. I don't think an adapter module would work.

Have you tried using a HTTP or SOAP (with 'Do not use SOAP envelope') communication channel.

Kind regards

Steve

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello,

I have changed my scenario, to get the necessary xml via ABAP and distribute it after,thanks.

Regards.

iaki_vila
Active Contributor
0 Kudos

Hi Faruk,

You can try with an XSL inside the adapter, but it looks weird to introduce in the body the XML declaration, if you try the Michals example, it doesn't introduce the XML declaration.

Regards.

Former Member
0 Kudos

Hi,

The payload is coming from an external payload containing XML declaration, because of that i can not interfere the payload or its contents, i am just looking for a way to pass XML declarations or remove them through communication channel using modules?

Regards.

iaki_vila
Active Contributor
0 Kudos

Hi Faruk,

I haven't tried to remove a declaration in adapter level, it's only a possibility and i don't know if it works for you.

To introduce an XSL at adapter level: https://help.sap.com/saphelp_nw73/helpdata/en/57/0b2c4142aef623e10000000a155106/frameset.htm

XSL to remove declaration:


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

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

    <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>

    <xsl:template match="/">

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

    </xsl:template>

</xsl:stylesheet>

Regards.

former_member184720
Active Contributor
0 Kudos

Hi Faruk - If you have mapping then may be you could use replace string function to remove those declartions if they are constants..

Former Member
0 Kudos

Hi Hareesh,

When i test the payload with XML declarations "

<?xml version="1.0" encoding="ISO-8859-9"?>

<?xml-stylesheet type="text/xsl" href="isokur.xsl"?>" it works, the problem is that my sender communication channel wont let those declarations in SOAP Body Child. That is why i am getting error when sender communication channel uses necessary connection parameters and HTTPGetter class, and gets the payload with XML declarations, if i test the payload in SOAPUI without declarations it works, when i test payload with XML declarations, i get the exact same error which i do get from Alert Category.

Regards.

Former Member
0 Kudos

Hello,

What u have selected in payload extraction under soap axis adapter?

May be u can try to use SOAP ENvelope and then using XSLT mapping remove that declaration?

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Amit, i will try that and update you soon.

Thanks.

Former Member
0 Kudos

Hi Amit,

I tried XSLT mapping, but it does not even let me to process in SoapUI  when i have XML declarations inside of SOAP envelope.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

   <soapenv:Header/>

   <soapenv:Body>

   <?xml version="1.0" encoding="ISO-8859-9"?>

<?xml-stylesheet type="text/xsl" href="isokur.xsl"?>

<Tarih_Date Tarih="03.02.2014" Date="02/03/2014"><Currency Kod="USD" CurrencyCode="USD">

</soapenv:Body>

</soapenv:Envelope>

Any suggestions?

Former Member
0 Kudos

Hello,

AXIS protocol is not enabled in my system so i tried testing using SOAP adapter where i am passing

xml declaration inside SOAP body + checked do not use soap envelope + in the URL i have added nosoap = true and this is what i am getting in PI monitoring (pimon)

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

   <soapenv:Header/>

   <soapenv:Body>

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

      <test:Mt_Test>

         <!--1 or more repetitions:-->

         <Name>amit</Name>

      </test:Mt_Test>

   </soapenv:Body>

</soapenv:Envelope>

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi again,

Sorry, but it seems XML header in a soap body child is illegal, i have tried what you have done but for all my WS scenarios, i got the same error when i did add XML declaration to input payload..

Regards.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

How about wrapping it in a CDATA tag <![CDATA[]]>e.g

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

   <soapenv:Header/>

   <soapenv:Body><![CDATA[<?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="isokur.xsl"?><Tarih_Date Tarih="03.02.2014" Date="02/03/2014"><Currency Kod="USD" CurrencyCode="USD">]]>

     </soapenv:Body>

</soapenv:Envelope>

Hope this helps,

Mark

Former Member
0 Kudos

Hello,

I am not sure how u are testing, but when i am sending XML delcartion inside body with do not use soap envelope checkbox ticked in soap sender (along with with nosoap= true in end of the URL), i am getting SOAP message in PI, so it's passing through adapter and failing at mapping level.

BTW, did u tried accessing message from SOAP envelope inside AXIS adapter?

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Arit,

Unfortunately, there is  no  do not use soap envelope checkbox for Axis adapter and yes i have tried to take all soap envelope. Still the error remains as " message not processed: org.xml.sax.SAXException: Processing instructions are not allowed within SOAP messages" in CC monitoring.

Regards.