You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by huntc <hu...@mac.com> on 2008/10/03 16:21:10 UTC

doc/lit/bare service - how to unmarshall the elementnsimpl

Hi there,

I have a doc/lit/bare service defined and my service is invoked with the
bare payload - the payload appears to be a W3C Element class (actually a
Xerces ElementNSImpl). This is reasonable I suppose; after all I did declare
the parameter to be bare so I guess CXF leaves it to me to unmarshall it. 

My first question is then - should CXF leave it to me to unmarshall the
parameter?

If the answer to the above is "yes" then can someone please provide me with
a pointer as to how to go about that (I'm wondering here if I can use the
same jaxb context as CXF is using - the context should know how to
unmarshall the data as my WSDL provides a complete definition).

Here's my interface:


@WebService(targetNamespace =
"http://schemas.blueglue.com.au/hrwebservices")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface IndicativeDataService {
	void upload(
			@WebParam(name = "IndicativeData", targetNamespace =
"http://ns.hr-xml.org/2007-04-15") IndEmployeeRosterType data);
}


The WSDL looks great - just what I want - here's the message declaration:


  &lt;wsdl:message name="upload"&gt;
    &lt;wsdl:part name="IndicativeData" element="ns1:IndicativeData"&gt;
    &lt;/wsdl:part&gt;
  &lt;/wsdl:message&gt;


...and here's the referenced element (in the same wsdl):


    &lt;xs:element name="IndicativeData" nillable="true"
type="tns:IndEmployeeRosterType"/&gt;


Here is the lovely invocation; again, just what I want:


&lt;soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:hrw="http://schemas.blueglue.com.au/hrwebservices"
xmlns:ns="http://ns.hr-xml.org/2007-04-15"&gt;
   &lt;soapenv:Header/&gt;
   &lt;soapenv:Body&gt;
      &lt;hrw:upload&gt;
         &lt;ns:IndicativeData&gt;
            &lt;ns:Employer/&gt;
            &lt;ns:Employee changeType="Add"&gt;
               &lt;ns:PersonInfo&gt;
                  &lt;ns:PersonId
idOwner="urn:x-au-com-blueglue:tjh-person"&gt;
                     &lt;ns:IdValue&gt;123&lt;/ns:IdValue&gt;
                  &lt;/ns:PersonId&gt;
                  &lt;ns:PersonName&gt;
                     &lt;ns:GivenName&gt;Jimmy&lt;/ns:GivenName&gt;
                     &lt;ns:FamilyName&gt;Mathers&lt;/ns:FamilyName&gt;
                  &lt;/ns:PersonName&gt;
               &lt;/ns:PersonInfo&gt;
            &lt;/ns:Employee&gt;
         &lt;/ns:IndicativeData&gt;
      &lt;/hrw:upload&gt;
   &lt;/soapenv:Body&gt;
&lt;/soapenv:Envelope&gt;

Thanks for your help. Even confirming that "bare" parameters are passed
through unmarshalled will be helpful.

Kind regards,
Christopher

-- 
View this message in context: http://www.nabble.com/doc-lit-bare-service---how-to-unmarshall-the-elementnsimpl-tp19798742p19798742.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: doc/lit/bare service - how to unmarshall the elementnsimpl

Posted by Daniel Kulp <dk...@apache.org>.
The w3c Element is what JAXB unmarshals to if there isn't a real java 
class that it knows about that is bound to the element name.   This 
USUALLY occurs if the parameter is an interface or some other class that 
JAXB cannot handle.   The other time is if you have a subclass, but the 
interface uses the superclass. 

As you found, the XmlSeeAlso annotation allows adding extra classes to 
the JAXB context to make sure it knows everything that is needed.

Dan


On Sunday 05 October 2008, huntc wrote:
> Hi Glen,
>
> Thank you for your message.
>
> The problem was that, before specifying the see-also annotation, the
> data passed to my service came through as a null object.
>
> On closer inspection within the debugger the object being passed to me
> was actually an ElementNSImpl type  i.e. something that had not been
> unmarshalled.
>
> Kind regards,
> Christopher



-- 
J. Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: doc/lit/bare service - how to unmarshall the elementnsimpl

Posted by huntc <hu...@mac.com>.
Hi Glen,

Thank you for your message.

The problem was that, before specifying the see-also annotation, the data
passed to my service came through as a null object.

On closer inspection within the debugger the object being passed to me was
actually an ElementNSImpl type  i.e. something that had not been
unmarshalled.

Kind regards,
Christopher
-- 
View this message in context: http://www.nabble.com/doc-lit-bare-service---how-to-unmarshall-the-elementnsimpl-tp19798742p19830241.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: doc/lit/bare service - how to unmarshall the elementnsimpl

Posted by Glen Mazza <gl...@gmail.com>.
I don't understand your problem.  I would guess your service implementation
bean gets a "IndEmployeeRosterType data" object for the upload operation,
from which you can call data.getThis() and data.getThat() to get each of the
underlying objects in that complex type.  AFAICT no manual unmarshalling
needed.

Glen


huntc wrote:
> 
> Hi there,
> 
> <p>I have a doc/lit/bare service defined and my service is invoked with
> the bare payload - the payload appears to be a W3C Element class (actually
> a Xerces ElementNSImpl). This is reasonable I suppose; after all I did
> declare the parameter to be bare so I guess CXF leaves it to me to
> unmarshall it. 
> 
> <p>My first question is then - should CXF leave it to me to unmarshall the
> parameter?
> 
> <p>If the answer to the above is "yes" then can someone please provide me
> with a pointer as to how to go about that (I'm wondering here if I can use
> the same jaxb context as CXF is using - the context should know how to
> unmarshall the data as my WSDL provides a complete definition).
> 
> <p>Here's my interface:
> 
> <pre>
> @WebService(targetNamespace =
> "http://schemas.blueglue.com.au/hrwebservices")
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> public interface IndicativeDataService {
> 	void upload(
> 			@WebParam(name = "IndicativeData", targetNamespace =
> "http://ns.hr-xml.org/2007-04-15") IndEmployeeRosterType data);
> }
> </pre>
> 

-- 
View this message in context: http://www.nabble.com/doc-lit-bare-service---how-to-unmarshall-the-elementnsimpl-tp19798742p19830221.html
Sent from the cxf-user mailing list archive at Nabble.com.