WS-Addressing: xsd:whitespace handling

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

WS-Addressing: xsd:whitespace handling

Bhun Kho
Hi cxf mailing list,

Is the absence of whitespace collapse in of the MessageID-value obtained from the MessageContext
a bug or intended behavior? (See below)

Thanks in advance,
Bhun.

--

The WS-A MessageID from a message is obtainable under the 'javax.xml.ws.addressing.context.inbound' property of the the MessageContext and returned as AttributedURIType.

I expected the AttributedURIType.value to comply with the schema after having applied the whitespace handling rules [1], but the element content is neither trimmed nor collapsed.

I don't have an unit test (yet), but I do have a modified version of distribution/src/main/release/samples/ws_addressing available, [2] with the
following modifications
- the client is modified to send the MessageID with value  "     a  \n\n\n\nb   b\n\n\n\n  a     "
-the service modified to print the MessageID between '|BEGIN|' and '|END|'

The server modification when run prints the MessageID sent from the client as:
{code}
|BEGIN|     a  



b   b



  a     |END|
{code}

But I would've expected the AttributedURIType.value to be returned after the xsd:whitespace='collapse' applied:

{code}
|BEGIN|a b b a|END|
{code}

The 'collapse' as defied in https://www.w3.org/TR/xmlschema-1/#d0e1654

{quote}
preserve
No normalization is done, the value is the ·normalized value·
replace
All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return) are replaced > with #x20 (space).
collapse
Subsequent to the replacements specified above under replace, contiguous sequences of #x20s are collapsed to a single #x20, and initial and/or final #x20s are deleted.
{quote}

---

[1] Excerpt from the schema's in the cxf-project:

{code}
 <!-- !/schemas/wsdl/ws-addr.xsd -->

<xs:element name="MessageID" type="tns:AttributedURIType"/>
<xs:complexType name="AttributedURIType">
 <xs:simpleContent>
 <xs:extension base="xs:anyURI">
 <xs:anyAttribute namespace="##other" processContents="lax"/>
 </xs:extension>
 </xs:simpleContent>
</xs:complexType>

<!-- !/schemas/wsdl/XMLSchema.xsd -->
<xs:simpleType name="anyURI" id="anyURI">
    <xs:restriction base="xs:anySimpleType">
      <xs:whiteSpace value="collapse"  fixed="true"
        id="anyURI.whiteSpace"/>
    </xs:restriction>
   </xs:simpleType>
{code}

[2] Branch with the modification of 3.4.0-SNAPSHOT master https://github.com/kimholan/cxf/commit/abbbafbb5887d01eb2331454abcf6ee1304e0c8f

---
Reply | Threaded
Open this post in threaded view
|

Re: WS-Addressing: xsd:whitespace handling

coheigea
Administrator
Hi,

Is schema validation enabled?
https://cxf.apache.org/faq.html#FAQ-HowcanIturnonschemavalidationforjaxwsendpoint
?
If yes, and it's still keeping the formatting, it looks like a bug.

Colm.

On Sat, May 2, 2020 at 9:41 AM Bhun Kho <[hidden email]> wrote:

> Hi cxf mailing list,
>
> Is the absence of whitespace collapse in of the MessageID-value obtained
> from the MessageContext
> a bug or intended behavior? (See below)
>
> Thanks in advance,
> Bhun.
>
> --
>
> The WS-A MessageID from a message is obtainable under the
> 'javax.xml.ws.addressing.context.inbound' property of the the
> MessageContext and returned as AttributedURIType.
>
> I expected the AttributedURIType.value to comply with the schema after
> having applied the whitespace handling rules [1], but the element content
> is neither trimmed nor collapsed.
>
> I don't have an unit test (yet), but I do have a modified version of
> distribution/src/main/release/samples/ws_addressing available, [2] with the
> following modifications
> - the client is modified to send the MessageID with value  "     a
> \n\n\n\nb   b\n\n\n\n  a     "
> -the service modified to print the MessageID between '|BEGIN|' and '|END|'
>
> The server modification when run prints the MessageID sent from the client
> as:
> {code}
> |BEGIN|     a
>
>
>
> b   b
>
>
>
>   a     |END|
> {code}
>
> But I would've expected the AttributedURIType.value to be returned after
> the xsd:whitespace='collapse' applied:
>
> {code}
> |BEGIN|a b b a|END|
> {code}
>
> The 'collapse' as defied in https://www.w3.org/TR/xmlschema-1/#d0e1654
>
> {quote}
> preserve
> No normalization is done, the value is the ·normalized value·
> replace
> All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return)
> are replaced > with #x20 (space).
> collapse
> Subsequent to the replacements specified above under replace, contiguous
> sequences of #x20s are collapsed to a single #x20, and initial and/or final
> #x20s are deleted.
> {quote}
>
> ---
>
> [1] Excerpt from the schema's in the cxf-project:
>
> {code}
>  <!-- !/schemas/wsdl/ws-addr.xsd -->
>
> <xs:element name="MessageID" type="tns:AttributedURIType"/>
> <xs:complexType name="AttributedURIType">
>  <xs:simpleContent>
>  <xs:extension base="xs:anyURI">
>  <xs:anyAttribute namespace="##other" processContents="lax"/>
>  </xs:extension>
>  </xs:simpleContent>
> </xs:complexType>
>
> <!-- !/schemas/wsdl/XMLSchema.xsd -->
> <xs:simpleType name="anyURI" id="anyURI">
>     <xs:restriction base="xs:anySimpleType">
>       <xs:whiteSpace value="collapse"  fixed="true"
>         id="anyURI.whiteSpace"/>
>     </xs:restriction>
>    </xs:simpleType>
> {code}
>
> [2] Branch with the modification of 3.4.0-SNAPSHOT master
> https://github.com/kimholan/cxf/commit/abbbafbb5887d01eb2331454abcf6ee1304e0c8f
>
> ---
>
Reply | Threaded
Open this post in threaded view
|

Re: WS-Addressing: xsd:whitespace handling

Bhun Kho
Hi Colm,

Yes, it's enabled by means of the @SchemaValidation-annotation.
Does it matter if I'm using the @ServiceMode(MESSAGE), like below?

@Stateless
@WebContext(...)
@SchemaValidation
@WebServiceProvider(...)
@ServiceMode(MESSAGE)
@HandlerChain(file = "/handler-chain.xml")
@TransactionAttribute(REQUIRES_NEW)
@Addressing(required = true, responses = ANONYMOUS)
public class SoapService
        implements Provider<Source> {

    @Override
    public Source invoke(Source source) {

    }

}


Thanks in advance,

Bhun.

________________________________
From: Colm O hEigeartaigh <[hidden email]>
Sent: Wednesday, May 6, 2020 2:40:19 PM
To: CXF Dev List
Subject: Re: WS-Addressing: xsd:whitespace handling

Hi,

Is schema validation enabled?
https://cxf.apache.org/faq.html#FAQ-HowcanIturnonschemavalidationforjaxwsendpoint
?
If yes, and it's still keeping the formatting, it looks like a bug.

Colm.

On Sat, May 2, 2020 at 9:41 AM Bhun Kho <[hidden email]> wrote:

> Hi cxf mailing list,
>
> Is the absence of whitespace collapse in of the MessageID-value obtained
> from the MessageContext
> a bug or intended behavior? (See below)
>
> Thanks in advance,
> Bhun.
>
> --
>
> The WS-A MessageID from a message is obtainable under the
> 'javax.xml.ws.addressing.context.inbound' property of the the
> MessageContext and returned as AttributedURIType.
>
> I expected the AttributedURIType.value to comply with the schema after
> having applied the whitespace handling rules [1], but the element content
> is neither trimmed nor collapsed.
>
> I don't have an unit test (yet), but I do have a modified version of
> distribution/src/main/release/samples/ws_addressing available, [2] with the
> following modifications
> - the client is modified to send the MessageID with value  "     a
> \n\n\n\nb   b\n\n\n\n  a     "
> -the service modified to print the MessageID between '|BEGIN|' and '|END|'
>
> The server modification when run prints the MessageID sent from the client
> as:
> {code}
> |BEGIN|     a
>
>
>
> b   b
>
>
>
>   a     |END|
> {code}
>
> But I would've expected the AttributedURIType.value to be returned after
> the xsd:whitespace='collapse' applied:
>
> {code}
> |BEGIN|a b b a|END|
> {code}
>
> The 'collapse' as defied in https://www.w3.org/TR/xmlschema-1/#d0e1654
>
> {quote}
> preserve
> No normalization is done, the value is the ·normalized value·
> replace
> All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return)
> are replaced > with #x20 (space).
> collapse
> Subsequent to the replacements specified above under replace, contiguous
> sequences of #x20s are collapsed to a single #x20, and initial and/or final
> #x20s are deleted.
> {quote}
>
> ---
>
> [1] Excerpt from the schema's in the cxf-project:
>
> {code}
>  <!-- !/schemas/wsdl/ws-addr.xsd -->
>
> <xs:element name="MessageID" type="tns:AttributedURIType"/>
> <xs:complexType name="AttributedURIType">
>  <xs:simpleContent>
>  <xs:extension base="xs:anyURI">
>  <xs:anyAttribute namespace="##other" processContents="lax"/>
>  </xs:extension>
>  </xs:simpleContent>
> </xs:complexType>
>
> <!-- !/schemas/wsdl/XMLSchema.xsd -->
> <xs:simpleType name="anyURI" id="anyURI">
>     <xs:restriction base="xs:anySimpleType">
>       <xs:whiteSpace value="collapse"  fixed="true"
>         id="anyURI.whiteSpace"/>
>     </xs:restriction>
>    </xs:simpleType>
> {code}
>
> [2] Branch with the modification of 3.4.0-SNAPSHOT master
> https://github.com/kimholan/cxf/commit/abbbafbb5887d01eb2331454abcf6ee1304e0c8f
>
> ---
>
Reply | Threaded
Open this post in threaded view
|

Re: WS-Addressing: xsd:whitespace handling

coheigea
Administrator
Could you raise a JIRA, including a test-case please?

Colm.

On Wed, May 6, 2020 at 6:59 PM Bhun Kho <[hidden email]> wrote:

> Hi Colm,
>
> Yes, it's enabled by means of the @SchemaValidation-annotation.
> Does it matter if I'm using the @ServiceMode(MESSAGE), like below?
>
> @Stateless
> @WebContext(...)
> @SchemaValidation
> @WebServiceProvider(...)
> @ServiceMode(MESSAGE)
> @HandlerChain(file = "/handler-chain.xml")
> @TransactionAttribute(REQUIRES_NEW)
> @Addressing(required = true, responses = ANONYMOUS)
> public class SoapService
>         implements Provider<Source> {
>
>     @Override
>     public Source invoke(Source source) {
>
>     }
>
> }
>
> Thanks in advance,
>
> Bhun.
> ------------------------------
> *From:* Colm O hEigeartaigh <[hidden email]>
> *Sent:* Wednesday, May 6, 2020 2:40:19 PM
> *To:* CXF Dev List
> *Subject:* Re: WS-Addressing: xsd:whitespace handling
>
> Hi,
>
> Is schema validation enabled?
>
> https://cxf.apache.org/faq.html#FAQ-HowcanIturnonschemavalidationforjaxwsendpoint
> ?
> If yes, and it's still keeping the formatting, it looks like a bug.
>
> Colm.
>
> On Sat, May 2, 2020 at 9:41 AM Bhun Kho <[hidden email]> wrote:
>
> > Hi cxf mailing list,
> >
> > Is the absence of whitespace collapse in of the MessageID-value obtained
> > from the MessageContext
> > a bug or intended behavior? (See below)
> >
> > Thanks in advance,
> > Bhun.
> >
> > --
> >
> > The WS-A MessageID from a message is obtainable under the
> > 'javax.xml.ws.addressing.context.inbound' property of the the
> > MessageContext and returned as AttributedURIType.
> >
> > I expected the AttributedURIType.value to comply with the schema after
> > having applied the whitespace handling rules [1], but the element content
> > is neither trimmed nor collapsed.
> >
> > I don't have an unit test (yet), but I do have a modified version of
> > distribution/src/main/release/samples/ws_addressing available, [2] with
> the
> > following modifications
> > - the client is modified to send the MessageID with value  "     a
> > \n\n\n\nb   b\n\n\n\n  a     "
> > -the service modified to print the MessageID between '|BEGIN|' and
> '|END|'
> >
> > The server modification when run prints the MessageID sent from the
> client
> > as:
> > {code}
> > |BEGIN|     a
> >
> >
> >
> > b   b
> >
> >
> >
> >   a     |END|
> > {code}
> >
> > But I would've expected the AttributedURIType.value to be returned after
> > the xsd:whitespace='collapse' applied:
> >
> > {code}
> > |BEGIN|a b b a|END|
> > {code}
> >
> > The 'collapse' as defied in https://www.w3.org/TR/xmlschema-1/#d0e1654
> >
> > {quote}
> > preserve
> > No normalization is done, the value is the ·normalized value·
> > replace
> > All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return)
> > are replaced > with #x20 (space).
> > collapse
> > Subsequent to the replacements specified above under replace, contiguous
> > sequences of #x20s are collapsed to a single #x20, and initial and/or
> final
> > #x20s are deleted.
> > {quote}
> >
> > ---
> >
> > [1] Excerpt from the schema's in the cxf-project:
> >
> > {code}
> >  <!-- !/schemas/wsdl/ws-addr.xsd -->
> >
> > <xs:element name="MessageID" type="tns:AttributedURIType"/>
> > <xs:complexType name="AttributedURIType">
> >  <xs:simpleContent>
> >  <xs:extension base="xs:anyURI">
> >  <xs:anyAttribute namespace="##other" processContents="lax"/>
> >  </xs:extension>
> >  </xs:simpleContent>
> > </xs:complexType>
> >
> > <!-- !/schemas/wsdl/XMLSchema.xsd -->
> > <xs:simpleType name="anyURI" id="anyURI">
> >     <xs:restriction base="xs:anySimpleType">
> >       <xs:whiteSpace value="collapse"  fixed="true"
> >         id="anyURI.whiteSpace"/>
> >     </xs:restriction>
> >    </xs:simpleType>
> > {code}
> >
> > [2] Branch with the modification of 3.4.0-SNAPSHOT master
> >
> https://github.com/kimholan/cxf/commit/abbbafbb5887d01eb2331454abcf6ee1304e0c8f
> >
> > ---
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: WS-Addressing: xsd:whitespace handling

Bhun Kho
Done. I hope the test is any good.


https://issues.apache.org/jira/browse/CXF-8285


Bye!

________________________________
From: Colm O hEigeartaigh <[hidden email]>
Sent: Friday, May 8, 2020 1:26:51 PM
To: Bhun Kho
Cc: CXF Dev List
Subject: Re: WS-Addressing: xsd:whitespace handling

Could you raise a JIRA, including a test-case please?

Colm.

On Wed, May 6, 2020 at 6:59 PM Bhun Kho <[hidden email]> wrote:

> Hi Colm,
>
> Yes, it's enabled by means of the @SchemaValidation-annotation.
> Does it matter if I'm using the @ServiceMode(MESSAGE), like below?
>
> @Stateless
> @WebContext(...)
> @SchemaValidation
> @WebServiceProvider(...)
> @ServiceMode(MESSAGE)
> @HandlerChain(file = "/handler-chain.xml")
> @TransactionAttribute(REQUIRES_NEW)
> @Addressing(required = true, responses = ANONYMOUS)
> public class SoapService
>         implements Provider<Source> {
>
>     @Override
>     public Source invoke(Source source) {
>
>     }
>
> }
>
> Thanks in advance,
>
> Bhun.
> ------------------------------
> *From:* Colm O hEigeartaigh <[hidden email]>
> *Sent:* Wednesday, May 6, 2020 2:40:19 PM
> *To:* CXF Dev List
> *Subject:* Re: WS-Addressing: xsd:whitespace handling
>
> Hi,
>
> Is schema validation enabled?
>
> https://cxf.apache.org/faq.html#FAQ-HowcanIturnonschemavalidationforjaxwsendpoint
> ?
> If yes, and it's still keeping the formatting, it looks like a bug.
>
> Colm.
>
> On Sat, May 2, 2020 at 9:41 AM Bhun Kho <[hidden email]> wrote:
>
> > Hi cxf mailing list,
> >
> > Is the absence of whitespace collapse in of the MessageID-value obtained
> > from the MessageContext
> > a bug or intended behavior? (See below)
> >
> > Thanks in advance,
> > Bhun.
> >
> > --
> >
> > The WS-A MessageID from a message is obtainable under the
> > 'javax.xml.ws.addressing.context.inbound' property of the the
> > MessageContext and returned as AttributedURIType.
> >
> > I expected the AttributedURIType.value to comply with the schema after
> > having applied the whitespace handling rules [1], but the element content
> > is neither trimmed nor collapsed.
> >
> > I don't have an unit test (yet), but I do have a modified version of
> > distribution/src/main/release/samples/ws_addressing available, [2] with
> the
> > following modifications
> > - the client is modified to send the MessageID with value  "     a
> > \n\n\n\nb   b\n\n\n\n  a     "
> > -the service modified to print the MessageID between '|BEGIN|' and
> '|END|'
> >
> > The server modification when run prints the MessageID sent from the
> client
> > as:
> > {code}
> > |BEGIN|     a
> >
> >
> >
> > b   b
> >
> >
> >
> >   a     |END|
> > {code}
> >
> > But I would've expected the AttributedURIType.value to be returned after
> > the xsd:whitespace='collapse' applied:
> >
> > {code}
> > |BEGIN|a b b a|END|
> > {code}
> >
> > The 'collapse' as defied in https://www.w3.org/TR/xmlschema-1/#d0e1654
> >
> > {quote}
> > preserve
> > No normalization is done, the value is the ·normalized value·
> > replace
> > All occurrences of #x9 (tab), #xA (line feed) and #xD (carriage return)
> > are replaced > with #x20 (space).
> > collapse
> > Subsequent to the replacements specified above under replace, contiguous
> > sequences of #x20s are collapsed to a single #x20, and initial and/or
> final
> > #x20s are deleted.
> > {quote}
> >
> > ---
> >
> > [1] Excerpt from the schema's in the cxf-project:
> >
> > {code}
> >  <!-- !/schemas/wsdl/ws-addr.xsd -->
> >
> > <xs:element name="MessageID" type="tns:AttributedURIType"/>
> > <xs:complexType name="AttributedURIType">
> >  <xs:simpleContent>
> >  <xs:extension base="xs:anyURI">
> >  <xs:anyAttribute namespace="##other" processContents="lax"/>
> >  </xs:extension>
> >  </xs:simpleContent>
> > </xs:complexType>
> >
> > <!-- !/schemas/wsdl/XMLSchema.xsd -->
> > <xs:simpleType name="anyURI" id="anyURI">
> >     <xs:restriction base="xs:anySimpleType">
> >       <xs:whiteSpace value="collapse"  fixed="true"
> >         id="anyURI.whiteSpace"/>
> >     </xs:restriction>
> >    </xs:simpleType>
> > {code}
> >
> > [2] Branch with the modification of 3.4.0-SNAPSHOT master
> >
> https://github.com/kimholan/cxf/commit/abbbafbb5887d01eb2331454abcf6ee1304e0c8f
> >
> > ---
> >
>