Hi Ashok,
I think the issue is with the schema that was built for you when you provided your sample XML. I used your sample source and the schema that was built for me, for the type attribute was
type:
type: string
xml:
attribute: true
prefix: xsi
name: '@type'
Note that the namespace uri is missing, I corrected that by adding it in manually
type:
type: string
xml:
attribute: true
prefix: xsi
namespace: >-
http://www.w3.org/2001/XMLSchema-instance
name: '@type'
After correcting that, the map I believe works as expected
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<sig:authSignatureRequest xmlns:sig="http://www.vasco.com/IdentikeyServer/IdentikeyTypes/Signature">
<componentType/>
<user>
<userID>Steve</userID>
</user>
<push xsi:type="sometype" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<signatureFields>
<dataField/>
</signatureFields>
</push>
</sig:authSignatureRequest>
</soapenv:Body>
</soapenv:Envelope>
I further refined my test to uncheck the namespace inlining option which is enabled by default. This produced the same with the actual namespace declaration on the root element
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sig="http://www.vasco.com/IdentikeyServer/IdentikeyTypes/Signature" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<sig:authSignatureRequest>
<componentType/>
<user>
<userID>Steve</userID>
</user>
<push xsi:type="foo">
<signatureFields>
<dataField/>
</signatureFields>
</push>
</sig:authSignatureRequest>
</soapenv:Body>
</soapenv:Envelope>
Here's a screen shot of my simple JSON -> XML mapping with your schema
You should open a PMR on the definition builder from sample XML as the missing namespace uri would be a defect.
Best Regards,
Steve Linn
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
------------------------------
Original Message:
Sent: Thu August 31, 2023 09:36 AM
From: Ashok Beshra
Subject: Mapping XML attribute with namespace in APIC assembly map policy
Hi Team...
We are trying to map an XML attribute with default namespace xsi using map policy in API Connect assembly. We have provided a sample example of XML in the map policy as below to create the elements for mapping. The issue is, we are not seeing the default namespace 'xsi:' getting appened from the map output. Please let us know how can we map XML with default name space using map policy.
Sample XML input in the map policy for creating elements
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sig="http://www.vasco.com/IdentikeyServer/IdentikeyTypes/Signature" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<sig:authSignatureRequest xmlns:prov="http://www.vasco.com/IdentikeyServer/IdentikeyTypes/Signature">
<componentType>?</componentType>
<user xsi:type="BASIC-TYPES:UserInput">
<userID>?</userID>
</user>
<push xsi:type="SIGNATURE-TYPES:PushSignatureRequest">
Mapping response output from map policy:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<sig:authSignatureRequest xmlns:sig="http://www.vasco.com/IdentikeyServer/IdentikeyTypes/Signature">
<componentType>ABC</componentType>
<user type="">
<userID>ABC</userID>
</user>
<push type="">
<signatureFields>
<dataField>
<key/>
<value/>
</dataField>
</signatureFields>
</push>
</sig:authSignatureRequest>
</soapenv:Body>
</soapenv:Envelope>
------------------------------
Ashok Beshra
------------------------------