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 625
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

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>


Thanks a lot Dino. I've attached the requested files.

OK, I've got the XSLT file. The XML file that was included there is the configuration for the XSL policy. You already posted that above. That's not quite what I need.

To figure out the problem, I need the XML that is the output of the JSONToXML Step. Can you provide that? IT will probably look something like this:

<Root>
    <getChannelAutomationStatus>...</getChannelAutomationStatus>
</Root>

??

If not, then provide the input JSON and the entire API proxy.

Step: Executing Rest service using JSON.

Json body:
{"channels":[{"@name":"FTP_VENDOR","@service":"TEST","@party":""}]}


Output of JSON to XML:

<?xml version="1.0" encoding="UTF-8"?>
<channels name="FTP_Vendor" service="Test" party=""/>

It is the above xml output which is been provided to SOAP and then in the final result it is getting concatenated

ok, thanks, I see as output:

<soapenv:Envelope xmlns:p0="urn:com:sap:netweaver:pi:monitoring"
                  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:tns="urn:com:sap:netweaver:pi:monitoring">
   <soapenv:Header/>
   <soapenv:Body>
      <p0:getChannelAutomationStatus>
         <p0:channels>FTP_VendorTest</p0:channels>
      </p0:getChannelAutomationStatus>
   </soapenv:Body>
</soapenv:Envelope>
<br>

...which I think is what you reported. One moment....

OK - try the attached XSLT.

try-this.zip

I get:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:p0="urn:com:sap:netweaver:pi:monitoring"
            xmlns:tns="urn:com:sap:netweaver:pi:monitoring">
   <s:Header/>
   <s:Body>
      <p0:getChannelAutomationStatus>
         <p0:channels name="FTP_Vendor" service="Test" party=""/>
      </p0:getChannelAutomationStatus>
   </s:Body>
</s:Envelope>

Hey @Srinandan Sridhar - the autogenerated XSLT seems to fall down when the input XML includes attributes. also I noticed some Warnings from Saxon when I ran the sheet on my own.

What can we do?

Former Community Member
Not applicable

Can I please get a link or a zip containing the WSDL and XSDs?

Krishna, any update?

Not applicable

@Srinandan Sridhar @Dino :

I am attaching the wsdl. We would like to know why the auto-generated xslt is breaking ? If it's a bug do we need to raise it as a case to apigee ?

Best Regards,

Kris

Kris, Let me synch with Nandan on this WSDL. We'll get back to you.

Separately: can you confirm that the modified XSL I attached below, actually works for you?

Sorry for delayed response. The modified XSL works for us. Did you get any update from Nandan for this?

Hi @Srinandan Sridhar - Any response for Krishna?

@Srinandan Sridhar @Dino: any updates please ?