I have created an API PROXY in Apigee which converts REST to SOAP to REST. There is one operation which accepts method PUT and APigee build the SOAP XML request based on the XSLT defined. This XSLT is auto generated when i imported my WSDL. Now I see issue , when I send the request then all the data including HEADERs goes inside the BODY.
Here is sample XSLT ( Auto Generated by Apigee using my WSDL)
```
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cmpnspc="mynamespace" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sysInfo="http://mynamespace.com/schemas/SOASolutions/SystemInfo_4" xmlns:xlmime="http://www.w3.org/2004/11/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" version="1.0">
<xsl:output encoding="utf-8" indent="yes" method="xml" omit-xml-declaration="yes"/>
<!-- Stylesheet to inject namespaces into a document in specific places -->
<xsl:template match="/">
<soapenv:Envelope>
<soapenv:Header/>
<soapenv:Body>
<xsl:choose>
<!-- Handle 'Root' wrapper added by JSON to XML policy -->
<xsl:when test="normalize-space(/Root)">
<cmpnspc:company>
<xsl:apply-templates select="node()|@*"/>
</cmpnspc:company>
</xsl:when>
<!-- Handle 'Array' wrapper added by JSON to XML policy -->
<xsl:when test="normalize-space(/Array)">
<cmpnspc:company>
<xsl:apply-templates select="node()|@*"/>
</cmpnspc:company>
</xsl:when>
<!-- If the root element is not what was in the schema, add it -->
<xsl:when test="not(normalize-space(/company))">
<cmpnspc:company>
<xsl:apply-templates select="node()|@*"/>
</cmpnspc:company>
</xsl:when>
<!-- everything checks out, just copy the xml-->
<xsl:otherwise>
<xsl:apply-templates select="node()|@*"/>
</xsl:otherwise>
</xsl:choose>
</soapenv:Body>
</soapenv:Envelope>
</xsl:template>
<xsl:template match="/Root/*" name="copy-root">
<xsl:element name="cmpnspc:{local-name()}">
<xsl:copy-of select="namespace::*"/>
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
<xsl:template match="/Array/*" name="copy-array">
<xsl:element name="cmpnspc:{local-name()}">
<xsl:copy-of select="namespace::*"/>
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
<xsl:template match="*[not(local-name()='Root') and not(local-name()='Array')]" name="copy-all">
<xsl:element name="cmpnspc:{local-name()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="node()"/>
</xsl:element>
</xsl:template>
<!-- template to copy the rest of the nodes -->
<xsl:template match="comment() | processing-instruction()">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>
```
I am not expert on XSLT but is there anyway i can format my JSON request so that HEADER data go in HEADER tag and BODY data go in only BODY tag?
here is the request which i am sending
{
"Header": {
"HEADER_DATA": {
"token": {
"PWD": "test"
}
},
"HEADER_DATA": {
"Assertion": {
"Version": 1,
"schemaLocation": "dsdsd",
"xsi": "sdsdsd",
"AttributeStatement": {
"Attribute": {
"AttributeValue": "test",
"Name": "test"
}
}
},
"saml": "sdsdd",
"wsse": "sdsdsd"
}
},
"BODY_DATA": {
"ServiceContext": {
"slId": "sdds",
"TID": "2323"
}
}
}