Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

issue with autogenerated xslt while converting it from xml to soap

Not applicable

We are trying to create a proxy for a soap service using the WSDL url.

The auto-generated xslt is not formatting the input json payload to the expected soap payload. (we also have json to xml policy attached which is working fine).

Below are the 2 issues which we are facing :
1. The attribute values (name, service, party) for the element "channels" are getting concatenated after xslt policy(getChannelAutomationStatus-add-namespace) gets executed.
2. the element "getChannelAutomationStatus" in the soap payload is expected to have namespace urn as <urn:getChannelAutomationStatus> but the soap payload created by xslt transform is <p0:getChannelAutomationStatus>

Below is the expected output:

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<yq1:getChannelAutomationStatus xmlns:yq1="urn:com:sap:netweaver:pi:monitoring">
<channels name="FTP_VENDOR" service="TEST" party=""/>
</yq1:getChannelAutomationStatus>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Below is the input xml:

<XSL name="getChannelAutomationStatus-add-namespace">
  <Source>request</Source>
  <ResourceURL>xsl://getChannelAutomationStatus-add-namespace.xslt</ResourceURL>
  <Parameters ignoreUnresolvedVariables="true"/>
</XSL>

What is the actual output:


<p0:getChannelAutomationStatus>
<po:channels>FTP_VENDOR_TEST</po:channels>
</p0:getChannelAutomationStatus>
Solved Solved
0 13 744
1 ACCEPTED SOLUTION

Hmmm, it sounds as though the auto-generated XSLT is broken! I'm sorry to hear that. We try to make sure the generated XSLT is correct in all cases, but in some cases it is not.

Can you please edit your question, and provide attachments?

Either:

  • the XSLT, as well as the expected input TO THAT XSLT. This is the interim XML that is generated as output from your JSONToXML policy.

OR

  • the entire API proxy bundle, and a sample input message.

BTW, let me comment on this statement:

the element "getChannelAutomationStatus" in the soap payload is expected to have namespace urn as <urn:getChannelAutomationStatus> but the soap payload created by xslt transform is <p0:getChannelAutomationStatus>

It is not necessary that the prefix be the same.

The strings "urn" or "p0" in the example given are known as XML namespace prefixes. The key for XML equivalence is that the XML namespace must be the same. It is not necessary that the prefix be the same, or even that a prefix be used on an element.

For illustration, the following three documents are equivalent:

1.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Header>
  </soap:Header>
  <soap:Body>
    <OperationName xmlns='urn:foo-bar-bam'>
      <ElementX/>
    </OperationName>
  </soap:Body>
</soap:Envelope>

2. 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
 <s:Header>
  </s:Header>
  <s:Body>
    <p0:OperationName xmlns:p0='urn:foo-bar-bam'>
      <p0:ElementX/>
    </p0:OperationName>
  </s:Body>
</s:Envelope>

3.
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:p0='urn:foo-bar-bam'>
 <Header>
  </Header>
  <Body>
    <p0:OperationName>
      <p0:ElementX/>
    </p0:OperationName>
  </Body>
</Envelope>


View solution in original post

13 REPLIES 13
Top Solution Authors