Issue Details (XML | Word | Printable)

Key: JAXB-758
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Iaroslav Savytskyi
Reporter: cistox
Votes: 5
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
jaxb

Wrong behaviour with xsd:any and a payload with default namespace

Created: 19/May/10 12:51 AM   Updated: 18/Sep/13 09:04 AM
Component/s: runtime
Affects Version/s: 2.2
Fix Version/s: not determined

Time Tracking:
Not Specified

Environment:

Operating System: All
Platform: All


Issuezilla Id: 758
Tags:
Participants: bshrom, cistox, cistox, fontana.damiano, Iaroslav Savytskyi, Martin Grebac and Pavel Bucek


 Description  « Hide

Hello,
I am working with Metro 2.1 nightly, JAXB 2.2 and WS-Transfer.
WS-Transfer elements like Put, Create, ... are providing an xsd:any content
where I need to add the original payload to be transferred.
Actually JAXB is erroneously modifying the namespace of a payload with default
namespace.

xsd:Any allows almost any content and expecially using skip processing such
content must be ignored.
There is no reason to add the outer namespace (e.g. the namespace of a
ws-transfer "Put" element) to the inner payload.

Payload's integrity is required to be preserved as it could represent an Invoice
with an incorporated digital signature.
This means the receiver must be able to validate the signature against the
payload content (and this is not possible if the payload is modified on-the-road).
The transport should not change the payload at all...

Actually I noted that JAXB has a strange behaviour with either "lax" and "skip"
processing of the xsd:any if the payload has a default namespace declared into
its root (xmlns="...").

Example using LAX or SKIP processing
----------------------------------------------------
Generated by JAXB:

<ns4:Put xmlns:ns4="[WS-Transfer NS]">
<Invoice xmlns="" xmlns:ns4="[WS-Transfer NS]" xmlns="[original default NS]" />
</ns4:Put>

This is how it should be with the original payload:

<ns4:Put xmlns:ns4="[WS-Transfer NS]">
<Invoice xmlns="[original default NS]"/>
</ns4:Put>

I believe that xsd:Any "skip" processing should completely ignore the xml
content and thus the way namespaces are declared in the payload should be
untouched...

The same is for "lax" processing if the payload is not using elements from
declared namespaces in the context (as it is usually for a business payload).

Example using <jaxb:dom/> xs:annotation
----------------------------------------------------
I made this exercise to avoid a dependancy between Put and its xs:any content.
I dreamed to see the payload untouched after this change but I was wrong.

<xs:element name="Put">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="1" maxOccurs="unbounded" namespace="##other"
processContents="skip">
<xs:annotation><xs:appinfo>
<jaxb:dom/>
</xs:appinfo></xs:annotation>
</xs:any>
</xs:sequence>
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
</xs:element>

Generated by JAXB:

<ns4:Put xmlns:ns4="[WS-Transfer NS]">
<Invoice:Invoice xmlns:Invoice="[original default NS]" xmlns:ns4="[WS-Transfer
NS]" xmlns="[original default NS]" />
</ns4:Put>

NOTE: The behaviour is changed a few here, but the namespace "xmlns:Invoice" is
really undesired and not useful at all.

This is how the Put should be with the original payload:

<ns4:Put xmlns:ns4="[WS-Transfer NS]">
<Invoice xmlns="[original default NS]"/>
</ns4:Put>

Payloads with a default namespace are a common case, I really hope this is not a
real limit of JAXB.

Please can you suggest a workaround ?

Thank you in advance for any help

Best regards

Roberto Cisternino



No work has yet been logged on this issue.