cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Issue please help

Former Member
0 Kudos

I have an XSLT where I want to strip out the SOAP envelope and just have the body.I am using the following code:

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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:test.com:xi:test" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<xsl:template match="/">

<SubmitInstallOrder xmlns:="urn:test.com:xi:test">

<InstallOrder>

<RetailerID>

<xsl:value-of select="//soap:Envelope/soap:Body/SubmitInstallOrder/InstallOrder/RetailerID"/>

</RetailerID>

</InstallOrder>

</SubmitInstallOrder>

</xsl:template>

</xsl:stylesheet>

and my input xml is the following:

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

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

<soap:Header>

<AccountInfoHeader xmlns="http://services.apple.com">

<UserName/>

<Password>2</Password>

</AccountInfoHeader>

</soap:Header>

<soap:Body>

<SubmitInstallOrder xmlns="http://services.apple.com">

<InstallOrder xmlns="">

<RetailerID>1</RetailerID>

<Fascia>2</Fascia>

<DualSiteID>3</DualSiteID>

<OrderID>4</OrderID>

<InstallAfterDate>5</InstallAfterDate>

<InstallBeforeDate>6</InstallBeforeDate>

<InstallIncludeDays>7</InstallIncludeDays>

<InstallAfterTime>8</InstallAfterTime>

<InstallBeforeTime>9</InstallBeforeTime>

<OrderType>10</OrderType>

<TerminalCD>11</TerminalCD>

<NetworkType>12</NetworkType>

<Notes>13</Notes>

</InstallOrder>

</SubmitInstallOrder>

</soap:Body>

</soap:Envelope>

My problem is the result is being produced but the field RetailerID is actually empty... so for some reason it isn't mapping...

Could someone please provide me some help.

By the way is there another function that I could use to get the entire body out without having to go through each field manually?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi thanks for your help..

When I try the below to just get all child elements I get the following error:

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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:test.com:xi:test" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<xsl:template match="/">

<SubmitInstallOrder xmlns:="urn:test.com:xi:test">

<InstallOrder>

<RetailerID>

<xsl:copy-of select="/soap:Envelope/soap:Body"/>

</RetailerID>

</InstallOrder>

</SubmitInstallOrder>

</xsl:template>

</xsl:stylesheet>

javax.xml.transform.TransformerException: com.sap.engine.lib.xml.util.NestedException: com.sap.engine.lib.xml.util.NestedException: Error while sending attributes to DocHandler -> javax.xml.transform.TransformerException: Namespace fixup failed -> com.sap.engine.lib.xml.util.NestedException: Error while sending attributes to DocHandler -> javax.xml.transform.TransformerException: Namespace fixup failed

Former Member
0 Kudos

Um, strange because I've tested the XSLTs I gave in my own XML editor ... There's sthg I do not understand, why do you use such notation :

xmlns:="urn:test.com:xi:test"

it should be xmlns="urn:test.com:xi:test" (no ":" if no specific namespace provided) ...

Chris

Former Member
0 Kudos

Hi,

Due to the use of default namespace (xmlns="..") and empty namespace (xmlns="") in the source xml document, xpath must be tweaked a little bit to retrieve your value :

<xsl:value-of select="/soap:Envelope/soap:Body/*[name()='SubmitInstallOrder']/InstallOrder/RetailerID"/>

If you want to copy Body section and all its children, you can use this :

<xsl:copy-of select="/soap:Envelope/soap:Body"/>

Hope this helps

Chris

Former Member
0 Kudos

and when Itry the following I get another error...

<xsl:value-of select="/soap:Envelope/soap:Body/*name()='SubmitInstallOrder'/InstallOrder/RetailerID"/>

Is there something that I amissing?

GabrielSagaya
Active Contributor
0 Kudos

please try with that

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

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:test.com:xi:test" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<xsl:template match="SubmitInstallOrder/InstallOrder">

<SubmitInstallOrder xmlns:="urn:test.com:xi:test">

<InstallOrder>

<RetailerID>

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

</RetailerID>

</InstallOrder>

</SubmitInstallOrder>

</xsl:template>

</xsl:stylesheet>