users@jax-rpc.java.net

RE: Bug when binding to SOAPElement

From: Kevin Jones <kevinj_at_develop.com>
Date: Mon, 8 Dec 2003 13:16:16 -0000

> It sounds like the problems is that you are using an
> undeclared prefix. Prefixes aren't actually bound to
> namespaces unless a namespace attribute is specifically added
> to the same or an enclosing scope as the usage of the prefix.

Right - but the undeclared prefix is yours :) If you look at the
serialized XML

<ns:getBookPrice xmlns:b="urn:com-develop-ejws-data:types"
    xmlns:ns0="urn:com-develop-ejws-data:types"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <isbn>111-222</isbn>
</ns:getBookPrice>

You'll see that 'ns' is undefined. It looks like that there's somewhere
in your code for detaching the SOAPElelment from the rest of the
SOAPMessage that you either set the wrong prefix on the element or you
declare the wrong prefix for the namespace.

I can send you the code that shows this if somebody wants to confirm
internally that this is a bug

Kevin Jones
http://kevinj.develop.com

> -----Original Message-----
> From: Doug Kohlert [mailto:Doug.Kohlert_at_Sun.COM]
> Sent: 03 December 2003 00:07
> To: users_at_jax-rpc.dev.java.net
> Subject: Re: Bug when binding to SOAPElement
>
>
> Kevin,
> Here is the response that I got from our resident expert in this area.
>
> "Again, can somebody (from Sun) confirm that the SOAPElement
> is not part of an NS aware DOM? "
>
> No, the opposite is true. Our internal SOAPElement
> implementation is based on the Xerces namespace aware Element
> implementation.
>
>
> Kevin Jones wrote:
> > Talking to myself again :)
> >
> > This is the XML that I serialize:
> >
> > <ns:getBookPrice xmlns:b="urn:com-develop-ejws-data:types"
> > xmlns:ns0="urn:com-develop-ejws-data:types"
> > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > <isbn>111-222</isbn>
> > </ns:getBookPrice>
> >
> > It turns out the element (getBookPrice) *is* in a
> namespace. However,
> > when a DOM is serialized xmlsns:prefixes are only
> serialized *if* they
> > have also been added as an attribute to an element (totally against
> > the InfoSet spec but there you go). So in the XML presented
> here the
> > DOM does know that the ns prefix is bound to the urn:com...
> namespace
> > but doesn't serialize that information. (I'd just written
> an on-line
> > piece about this very problem so should have realised this straight
> > away :) ).
> >
> > However I still have a weird problem - I can't run namespace aware
> > Xpath expressions against the node that is passed to me. I have to
> > create an NS aware DOM, import the node into it then run
> Xpath. Again,
> > can somebody (from Sun) confirm that the SOAPElement is not
> part of an
> > NS aware DOM?
> >
> > Kevin Jones
> > http://kevinj.develop.com
> >
> >
> >>-----Original Message-----
> >>From: Kevin Jones [mailto:kevinj_at_develop.com]
> >>Sent: 24 November 2003 18:21
> >>To: users_at_jax-rpc.dev.java.net
> >>Subject: RE: Bug when binding to SOAPElement
> >>
> >>
> >>Looking at the code inside the generated Tie it does this:
> >>
> >>javax.xml.soap.SOAPElement = null;
> >>Object mySOAPElementObj = state.getRequest().getBody().getValue();
> >>
> >>
> >>Breaking these steps down:
> >>
> >>State.getRequest gives me a request from which I can call
> >>getMessage. This gives me the input message which is fine (it
> >>looks like the one I posted in the original email).
> >>
> >>Request.getBody().getValue() gives me the 'value' of the
> >>'body' of the message and this is the thing that has the bug.
> >>It looks like the namespace prefix is being transposed
> >>incorrectly inside this code. Can anybody confirm this?
> >>
> >>Thanks,
> >>
> >>Kevin Jones
> >>http://kevinj.develop.com
> >>
> >>
> >>>-----Original Message-----
> >>>From: Kevin Jones [mailto:kevinj_at_develop.com]
> >>>Sent: 23 November 2003 11:21
> >>>To: users_at_jax-rpc.dev.java.net
> >>>Subject: Bug when binding to SOAPElement
> >>>
> >>>
> >>>I have a schema that looks like this
> >>>
> >>><complexType name="AuthorOrISBNType">
> >>> <choice>
> >>> <sequence>
> >>> <element name="author" type="string" nillable="true"/>
> >>> <element name="title" type="string" nillable="true"/>
> >>> </sequence>
> >>> <element name="isbn" type="string"/>
> >>> </choice>
> >>></complexType>
> >>>
> >>><element name="getBookPrice" type="tns:AuthorOrISBNType"/>
> >>>
> >>>The wsdl has the appropriate bits referencing the element.
> >>>
> >>>My generated method looks like
> >>>
> >>>public javax.xml.soap.SOAPElement
> >>>getBookPrice(javax.xml.soap.SOAPElement parameters);
> >>>
> >>>And the SOAP I send looks like
> >>>
> >>><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
> >>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>> xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
> >>> xmlns:ns0="urn:com-develop-ejws-data:types">
> >>> <env:Body>
> >>> <ns0:getBookPrice
> xmlns:b="urn:com-develop-ejws-data:types">
> >>> <isbn>111-222</isbn>
> >>> </ns0:getBookPrice>
> >>> </env:Body>
> >>></env:Envelope>
> >>>
> >>>However in the getBooksPrice method I see this
> >>>
> >>><ns:getBookPrice xmlns:b="urn:com-develop-ejws-data:types"
> >>> xmlns:ns0="urn:com-develop-ejws-data:types"
> >>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> >>> <isbn>111-222</isbn>
> >>></ns:getBookPrice>
> >>>
> >>>Notice that getBookPrice is in 'ns' and not 'ns0' or 'b'
> >>
> >>and 'ns' is
> >>
> >>>not bound to a namespace.
> >>>
> >>>getBookPrice doesn't have a parent so the ns prefix isn't
> >>
> >>bound there.
> >>
> >>>This is in JWSDP 1.3.
> >>>
> >>>Am I missing something obvious?
> >>>
> >>>
> >>>Kevin Jones
> >>>http://kevinj.develop.com
> >>>
> >>>
> >>>
> >>
> >>------------------------------------------------------------
> ---------
> >>
> >>>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> >>>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
> >>>
> >>>
> >>
> >>
> >>------------------------------------------------------------
> ---------
> >>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> >>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
> >>
> >>
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> > For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
> >
> >
>
>
> --
> Doug Kohlert
> Java Software Division
> Sun Microsystems, Inc.
> phone: 503 345-9806
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net