I have a java + spring boot app. I'm using jaxws-maven-plugin to generate sources based on .wsdl and .xsd files. I'm sending a soap request receiving response. Unfortunately the response is not 100% the same as expected example that I have from the client.
Expected response:
<soapenv:Envelope">
<soapenv:Body>
<wst13:SecResponse">
<wst13:SecToken>
<saml:Assertion ID="A-123"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<saml:AttributeStatement>
<saml:Attribute Name="ClientID">
<saml:AttributeValue xsi:type="xsd:string">hello</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>
</wst13:RequestedSecurityToken>
</wst13:RequestSecurityTokenResponse>
</soapenv:Body>
</soapenv:Envelope>
Actual response:
<soapenv:Envelope">
<soapenv:Body>
<wst13:SecResponse">
<wst13:SecToken>
<saml:Assertion ID="A-123"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
<saml:AttributeStatement>
<saml:Attribute Name="ClientID">
<saml:AttributeValue
xsi:type="xsd:string"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">hello</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>
</wst13:RequestedSecurityToken>
</wst13:RequestSecurityTokenResponse>
</soapenv:Body>
</soapenv:Envelope>
You can see the difference in saml:Assertion element (see at namespaces defined in this element), and saml:AttributeValue element (also see at namespaces defined in this element).
So the question is how can I move the xsi and xsd namecpaces definition from saml:AttributeValue to saml:Assertion element?
What I already tried:
- I created my own namespace mapper (extends NamespacePrefixMapper) to be able to overwrite generated namespace prefixes. Also in this class I was able to move my xmlns:xsi to the root element but I don't want to move it to the root element, but to saml:Assertion element...
- I tried also add marshaller listener, but it looks that it works like above method or I don't know how I can use this listener in a proper way.