cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT Mapping again.....

Former Member
0 Kudos

Hi Everybody,

In my implementation R/3 to Webservice, after I am done with all the mappings, the final message I get is:

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

<ns1:DPSrequestToken xmlns:ns1="http://tempuri.org/message/">

<Logon_payload><?xml version="1.0" encoding="UTF-8"?> <b><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken><wsse:Username>user</wsse:Username><wsse:Password>pass</wsse:Password></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header><SOAP-ENV:Body> <m:DPSrequestToken xmlns:m="https://tpvs.hmrc.gov.uk/dpsauthentication"><m:version>1</m:version><m:vendorID>0142</m:vendorID></m:DPSrequestToken></SOAP-ENV:Body></SOAP-ENV:Envelope></b> </Logon_payload>

</ns1:DPSrequestToken>

However I want to send only the highlighted part and not the elements Logon_payload and DPSrequestToken, as the data inside Logon_payload excluding <i><?xml version="1.0" encoding="UTF-8" ?></i> is exactly what the webservice expects.

Could someone pls advice??

Regards,

Ashish

Accepted Solutions (1)

Accepted Solutions (1)

agasthuri_doss
Active Contributor
0 Kudos

Dear Ashish,

I hope this will help you

/people/durairaj.athavanraja/blog/2005/07/12/send-sms-to-india-from-abap

In this they have ignored the messages as you mentioned

Regards

Agasthuri Doss

Answers (1)

Answers (1)

former_member206604
Active Contributor
0 Kudos

Hi Ashish,

The XML dose'nt look like a valid XML.

The processing instruction <?xml version="1.0" encoding="UTF-8"?> is appearing in between the XML. The XSLT processor will say not a welformed XML. So you have to go for some string manipulation using JAVA or ABAP mapping. If you still wanted to do with XSLT then try some how to remove that processing instruction that is after the Logon_payload tag and use the following XSLT.

<?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" xmlns:ns1="http://tempuri.org/message/">

<xsl:template match="/">

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

</xsl:template>

</xsl:stylesheet>

Thanks,

Prakash

Former Member
0 Kudos

Thanks once again Prakash,

Is it possible to send data directly outside XI without putting it into a element???

The structure that i have mentioned below is valid:

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

<ns1:DPSrequestToken xmlns:ns1="http://tempuri.org/message/">

<Logon_payload><?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken><wsse:Username>user</wsse:Username><wsse:Password>pass</wsse:Password></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header><SOAP-ENV:Body> <m:DPSrequestToken xmlns:m="https://tpvs.hmrc.gov.uk/dpsauthentication"><m:version>1</m:version><m:vendorID>0142</m:vendorID></m:DPSrequestToken></SOAP-ENV:Body></SOAP-ENV:Envelope> </Logon_payload>

</ns1:DPSrequestToken>

This is the final output of the BPM before it has to go to the WEB SERVICE. But I want only the data between the tags as shown in bold. The final data should start from <SOAP-ENV>....</SOAP-ENV>

Pls advice.

Regards,

Ashish

former_member206604
Active Contributor
0 Kudos

Hi,

The problem is with the XML strucutre, its is not a wel formed whereever you send it it will give you an error.

Ok tell me this how did you get this XML, I guess using some mapping program and that is the culprit to generate this invalid XML document. Or are you getting it from some source. Please give in details lets try to solve this.

Thanks,

Prakash

Former Member
0 Kudos

I have got this structure hard coded using ABAP proxy straight from R/3 system. I am using proxy because wsdl data contains "wsse:" data, which is not recognised in XI and XI gives the error. So i have been adviced by my technical heads to use ABAP proxy.

Yes you r right i have got this final data after mapping. And this data is shown in the SXMB_MONI after the mapping is performed and before the data goes to SOAP adapter.

Regards,

Ashish

former_member206604
Active Contributor
0 Kudos

Hi,

Can you please be little more detail... So you are try to say that the XML process instruction is added after the mapping right? If so then the problem is with that mapping, can you please post the detail of the mapping. If we rectify that mapping then everything should be fine. There is no need for one more XSLT mapping. Please post as much details as you can so that it will be easy to solve.

Thanks,

Prakash

Former Member
0 Kudos

Prakash, I dont have the structure right now with me. Will do that first thing in the morning.

Anyways yesterday XSLT mapping issue was solved. thanks a lot once again for that. But could you just briefly explain what this code does. It's actually unfair on my part to implement things without understanding them.

<?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" indent="no"/>

<xsl:template match="/|comment()|processing-instruction()">

<xsl:copy>

<xsl:apply-templates/>

</xsl:copy>

</xsl:template>

<xsl:template match="*">

<xsl:element name="{local-name()}">

<xsl:apply-templates select="@*|node()"/>

</xsl:element>

</xsl:template>

<xsl:template match="@*">

<xsl:attribute name="{local-name()}">

<xsl:value-of select="."/>

</xsl:attribute>

</xsl:template>

</xsl:stylesheet>

With Best Regards,

Ashish

Former Member
0 Kudos

Or could you suggest me some documentation on xslt which would help me understand the code

Ashish

former_member206604
Active Contributor
0 Kudos

Hi Ashish,

There is nothing great in this XSLT. The whole logic is based on the function local-name(). This will return only the local name of the node instead of the expanded name with namespaces etc.

Eg: <SOAP:Envelope>

The expanded name = SOAP:Envelope

The Local name = Envelope

Hope this helps...

Check this URL for XSLT

http://www.topxml.com/xsl/default.asp

http://www.w3schools.com/xsl/xsl_languages.asp

Regards,

Prakash