users@jax-rpc.java.net

RE: Bug when binding to SOAPElement

From: Kevin Jones <kevinj_at_develop.com>
Date: Tue, 25 Nov 2003 13:07:01 -0000

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