I created an API Proxy for a WS, using JSONtoXML and XSL to deal with it's transformation.
I created using the UI, using the policies generated.
I configured the JSONtoXML to:
<NullValue>NULL</NullValue> <NamespaceBlockName>#namespaces</NamespaceBlockName> <DefaultNamespaceNodeName>#default</DefaultNamespaceNodeName> <NamespaceSeparator>:</NamespaceSeparator> <TextNodeName>TEXT</TextNodeName> <AttributeBlockName>#attrs</AttributeBlockName> <InvalidCharsReplacement>_</InvalidCharsReplacement> <ArrayItemElementName>Item</ArrayItemElementName>
In my request I need a custom namespace, I do so by:
{ "request": { "#namespaces": { "xsi": "http://www.w3.org/2001/XMLSchema-instance" }, "#attrs": { "xsi:type": "CustomType" } } }
It adds the desired namespace, but it also adds an empty namespace:
<request xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
I don't need a default namespace in this situation and this empty xmlns is causing and erro in the WS to process the message.
Debugging the request in trace tab, I saw that the request was correct until passthrough the XSL Policy, so this policy is the one adding the empty xmlns attribute to my request xml.
Do I really need to remove it with manually or there is a configuration I'm not aware of?
I found the solution in the post above.
https://andrearegoli.wordpress.com/2015/12/31/remove-xslt-auto-generated-empty-namespace-xmlns/
Basically I had to force the parent namespace in the elements:
<xsl:element name="{local-name()}" namespace="parentNamespace">
So XSL removed the empty xmlns
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |