You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Ivan <xh...@gmail.com> on 2011/05/23 11:09:07 UTC

How to marshal/unmarshal HandlerType correctly ?

Hi,
    In the HandlerChain class of the jee module, we uses QName for the
type of serviceNamePattern and portNamePattern for better access (By
default, String type is used in the generated classes). But in the web
service spec, it is allowed to specify * and invalid name space
prefix.
    e.g.
     <handler-chain>
              <service-name-pattern
xmlns:ns1="http://hello.org">foo:HelloService</service-name-pattern>
              ......
     </handler-chain>

    Now, while parsing the DD above, an exception like
java.lang.IllegalArgumentException: prefix foo is not bound to a
namespace is thrown.
    Is there a way in JAXB to create a QName even the name space is
invalid ? I am thinking to have a XMLAdapter to do this from String,
but seems no way to look up the namespace by the prefix.
    Thoughts ? Thanks.
-- 
Ivan

Re: How to marshal/unmarshal HandlerType correctly ?

Posted by Ivan <xh...@gmail.com>.
I am thinking to change them back to string in the past, but it will
not work. As it needs to check whether there is a namespace uri
corresponding to the prefix in the string value.

2011/5/25 David Blevins <da...@gmail.com>:
> Those data types used to be strings.  That's probably why it worked before.
>
> I wouldn't lose any sleep if we changed them back to String from QName if it made things easier now.  Can always revisit it later.
>
> -David
>
>
> On May 24, 2011, at 7:39 AM, Ivan wrote:
>
>> I just committed some changes to trunk at revision: 1127089. Current
>> solution is to use a XmlAdapter to create the QName even if it is
>> illegal. Now, it is OK to unmarshal the XML file, but while
>> marshalling the object to XML texts, those namespace information is
>> lost ...
>> Not sure whether there is better way for this.
>>
>> 2011/5/23 Ivan <xh...@gmail.com>:
>>> Hi,
>>>    In the HandlerChain class of the jee module, we uses QName for the
>>> type of serviceNamePattern and portNamePattern for better access (By
>>> default, String type is used in the generated classes). But in the web
>>> service spec, it is allowed to specify * and invalid name space
>>> prefix.
>>>    e.g.
>>>     <handler-chain>
>>>              <service-name-pattern
>>> xmlns:ns1="http://hello.org">foo:HelloService</service-name-pattern>
>>>              ......
>>>     </handler-chain>
>>>
>>>    Now, while parsing the DD above, an exception like
>>> java.lang.IllegalArgumentException: prefix foo is not bound to a
>>> namespace is thrown.
>>>    Is there a way in JAXB to create a QName even the name space is
>>> invalid ? I am thinking to have a XMLAdapter to do this from String,
>>> but seems no way to look up the namespace by the prefix.
>>>    Thoughts ? Thanks.
>>> --
>>> Ivan
>>>
>>
>>
>>
>> --
>> Ivan
>
>



-- 
Ivan

Re: How to marshal/unmarshal HandlerType correctly ?

Posted by Ivan <xh...@gmail.com>.
I am thinking to change them back to string in the past, but it will
not work. As it needs to check whether there is a namespace uri
corresponding to the prefix in the string value.

2011/5/25 David Blevins <da...@gmail.com>:
> Those data types used to be strings.  That's probably why it worked before.
>
> I wouldn't lose any sleep if we changed them back to String from QName if it made things easier now.  Can always revisit it later.
>
> -David
>
>
> On May 24, 2011, at 7:39 AM, Ivan wrote:
>
>> I just committed some changes to trunk at revision: 1127089. Current
>> solution is to use a XmlAdapter to create the QName even if it is
>> illegal. Now, it is OK to unmarshal the XML file, but while
>> marshalling the object to XML texts, those namespace information is
>> lost ...
>> Not sure whether there is better way for this.
>>
>> 2011/5/23 Ivan <xh...@gmail.com>:
>>> Hi,
>>>    In the HandlerChain class of the jee module, we uses QName for the
>>> type of serviceNamePattern and portNamePattern for better access (By
>>> default, String type is used in the generated classes). But in the web
>>> service spec, it is allowed to specify * and invalid name space
>>> prefix.
>>>    e.g.
>>>     <handler-chain>
>>>              <service-name-pattern
>>> xmlns:ns1="http://hello.org">foo:HelloService</service-name-pattern>
>>>              ......
>>>     </handler-chain>
>>>
>>>    Now, while parsing the DD above, an exception like
>>> java.lang.IllegalArgumentException: prefix foo is not bound to a
>>> namespace is thrown.
>>>    Is there a way in JAXB to create a QName even the name space is
>>> invalid ? I am thinking to have a XMLAdapter to do this from String,
>>> but seems no way to look up the namespace by the prefix.
>>>    Thoughts ? Thanks.
>>> --
>>> Ivan
>>>
>>
>>
>>
>> --
>> Ivan
>
>



-- 
Ivan

Re: How to marshal/unmarshal HandlerType correctly ?

Posted by David Blevins <da...@gmail.com>.
Those data types used to be strings.  That's probably why it worked before.

I wouldn't lose any sleep if we changed them back to String from QName if it made things easier now.  Can always revisit it later.

-David


On May 24, 2011, at 7:39 AM, Ivan wrote:

> I just committed some changes to trunk at revision: 1127089. Current
> solution is to use a XmlAdapter to create the QName even if it is
> illegal. Now, it is OK to unmarshal the XML file, but while
> marshalling the object to XML texts, those namespace information is
> lost ...
> Not sure whether there is better way for this.
> 
> 2011/5/23 Ivan <xh...@gmail.com>:
>> Hi,
>>    In the HandlerChain class of the jee module, we uses QName for the
>> type of serviceNamePattern and portNamePattern for better access (By
>> default, String type is used in the generated classes). But in the web
>> service spec, it is allowed to specify * and invalid name space
>> prefix.
>>    e.g.
>>     <handler-chain>
>>              <service-name-pattern
>> xmlns:ns1="http://hello.org">foo:HelloService</service-name-pattern>
>>              ......
>>     </handler-chain>
>> 
>>    Now, while parsing the DD above, an exception like
>> java.lang.IllegalArgumentException: prefix foo is not bound to a
>> namespace is thrown.
>>    Is there a way in JAXB to create a QName even the name space is
>> invalid ? I am thinking to have a XMLAdapter to do this from String,
>> but seems no way to look up the namespace by the prefix.
>>    Thoughts ? Thanks.
>> --
>> Ivan
>> 
> 
> 
> 
> -- 
> Ivan


Re: How to marshal/unmarshal HandlerType correctly ?

Posted by David Blevins <da...@gmail.com>.
Those data types used to be strings.  That's probably why it worked before.

I wouldn't lose any sleep if we changed them back to String from QName if it made things easier now.  Can always revisit it later.

-David


On May 24, 2011, at 7:39 AM, Ivan wrote:

> I just committed some changes to trunk at revision: 1127089. Current
> solution is to use a XmlAdapter to create the QName even if it is
> illegal. Now, it is OK to unmarshal the XML file, but while
> marshalling the object to XML texts, those namespace information is
> lost ...
> Not sure whether there is better way for this.
> 
> 2011/5/23 Ivan <xh...@gmail.com>:
>> Hi,
>>    In the HandlerChain class of the jee module, we uses QName for the
>> type of serviceNamePattern and portNamePattern for better access (By
>> default, String type is used in the generated classes). But in the web
>> service spec, it is allowed to specify * and invalid name space
>> prefix.
>>    e.g.
>>     <handler-chain>
>>              <service-name-pattern
>> xmlns:ns1="http://hello.org">foo:HelloService</service-name-pattern>
>>              ......
>>     </handler-chain>
>> 
>>    Now, while parsing the DD above, an exception like
>> java.lang.IllegalArgumentException: prefix foo is not bound to a
>> namespace is thrown.
>>    Is there a way in JAXB to create a QName even the name space is
>> invalid ? I am thinking to have a XMLAdapter to do this from String,
>> but seems no way to look up the namespace by the prefix.
>>    Thoughts ? Thanks.
>> --
>> Ivan
>> 
> 
> 
> 
> -- 
> Ivan


Re: How to marshal/unmarshal HandlerType correctly ?

Posted by Ivan <xh...@gmail.com>.
I just committed some changes to trunk at revision: 1127089. Current
solution is to use a XmlAdapter to create the QName even if it is
illegal. Now, it is OK to unmarshal the XML file, but while
marshalling the object to XML texts, those namespace information is
lost ...
Not sure whether there is better way for this.

2011/5/23 Ivan <xh...@gmail.com>:
> Hi,
>    In the HandlerChain class of the jee module, we uses QName for the
> type of serviceNamePattern and portNamePattern for better access (By
> default, String type is used in the generated classes). But in the web
> service spec, it is allowed to specify * and invalid name space
> prefix.
>    e.g.
>     <handler-chain>
>              <service-name-pattern
> xmlns:ns1="http://hello.org">foo:HelloService</service-name-pattern>
>              ......
>     </handler-chain>
>
>    Now, while parsing the DD above, an exception like
> java.lang.IllegalArgumentException: prefix foo is not bound to a
> namespace is thrown.
>    Is there a way in JAXB to create a QName even the name space is
> invalid ? I am thinking to have a XMLAdapter to do this from String,
> but seems no way to look up the namespace by the prefix.
>    Thoughts ? Thanks.
> --
> Ivan
>



-- 
Ivan

Re: How to marshal/unmarshal HandlerType correctly ?

Posted by Ivan <xh...@gmail.com>.
I just committed some changes to trunk at revision: 1127089. Current
solution is to use a XmlAdapter to create the QName even if it is
illegal. Now, it is OK to unmarshal the XML file, but while
marshalling the object to XML texts, those namespace information is
lost ...
Not sure whether there is better way for this.

2011/5/23 Ivan <xh...@gmail.com>:
> Hi,
>    In the HandlerChain class of the jee module, we uses QName for the
> type of serviceNamePattern and portNamePattern for better access (By
> default, String type is used in the generated classes). But in the web
> service spec, it is allowed to specify * and invalid name space
> prefix.
>    e.g.
>     <handler-chain>
>              <service-name-pattern
> xmlns:ns1="http://hello.org">foo:HelloService</service-name-pattern>
>              ......
>     </handler-chain>
>
>    Now, while parsing the DD above, an exception like
> java.lang.IllegalArgumentException: prefix foo is not bound to a
> namespace is thrown.
>    Is there a way in JAXB to create a QName even the name space is
> invalid ? I am thinking to have a XMLAdapter to do this from String,
> but seems no way to look up the namespace by the prefix.
>    Thoughts ? Thanks.
> --
> Ivan
>



-- 
Ivan