I figured out the problem, although I'm not sure if this is a documented
feature or a defect.  In order to get the XFireProxyFactory to work with
the Jaxb2 example service, I had to provide a Map of properties that
specified the service as "document" style.  I would think the proxy
libraries should be able to inspect a service's annotations to determine
if it is document vs wrapped?  Anyways, here is the small change to the
client code I used to get it to work:

        JaxbServiceFactory factory = new JaxbServiceFactory();
        Map props = new HashMap<String, String>();
        props.put(ObjectServiceFactory.STYLE, "document");
        Service serviceModel = factory.create(WeatherServiceImpl.class,
props);

Where as before I was trying:

        JaxbServiceFactory factory = new JaxbServiceFactory();
        Service serviceModel = factory.create(WeatherServiceImpl.class);


When they get an opportunity, can someone from the project respond and
let me know if this SHOULD be taken care of by the proxy classes given
annotations are present on the interface and implementation that
identify it as a JAXB2 service?

Thanks!
Eric Miles



On Tue, 2007-01-02 at 08:57 -0500, Eric Miles wrote:

> Any feeback on why the proxy classes do not work but the generated
> classes from the WSDL do?
> 
> Thanks!
> 
> 
> On Wed, 2006-12-27 at 22:21 -0500, Eric Miles wrote:
> 
> > I was playing around with the Jaxb2 example provided in Xfire 1.2.3
> > (WeatherService) and I can not get a client to work using the
> > interface and implementation provided in the example with
> > XFireProxyFactory.  In debug mode, when the service is called, the
> > service endpoint receives a null for the zipcode value.  Upon the
> > service implementation returning a value, I get the following
> > exception client side:
> > 
> > Exception in thread "main" org.codehaus.xfire.XFireRuntimeException:
> > Could not invoke service.. Nested exception is
> > org.codehaus.xfire.fault.XFireFault: Could not unmarshall type.
> > org.codehaus.xfire.fault.XFireFault: Could not unmarshall type.
> > at org.codehaus.xfire.jaxb2.JaxbType.readObject(JaxbType.java:211)
> > at
> > org.codehaus.xfire.aegis.AegisBindingProvider.readParameter(AegisBindingProvider.java:160)
> > at
> > org.codehaus.xfire.service.binding.AbstractBinding.read(AbstractBinding.java:206)
> > at
> > org.codehaus.xfire.service.binding.WrappedBinding.readMessage(WrappedBinding.java:50)
> > at
> > org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(SoapBodyHandler.java:42)
> > at
> > org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
> > at org.codehaus.xfire.client.Client.onReceive(Client.java:382)
> > at
> > org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
> > at
> > org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
> > at
> > org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
> > at
> > org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
> > at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
> > at org.codehaus.xfire.client.Client.invoke(Client.java:335)
> > at
> > org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
> > at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
> > at $Proxy12.GetWeatherByZipCode(Unknown Source)
> > at org.codehaus.xfire.jaxb.WeatherClient.main(WeatherClient.java:35)
> > Caused by: javax.xml.bind.UnmarshalException: unexpected element
> > (uri:"http://www.webservicex.net";,
> > local:"GetWeatherByZipCodeResult"). Expected elements are
> > <{http://www.webservicex.net}GetWeatherByZipCode>,<{http://www.webservicex.net}GetWeatherByZipCodeResponse>
> > at
> > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:525)
> > at
> > com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:199)
> > at
> > com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:194)
> > at
> > com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:71)
> > at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext
> > $DefaultRootLoader.childElement(UnmarshallingContext.java:922)
> > at
> > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:366)
> > at
> > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:347)
> > at
> > com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:35)
> > at
> > com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:201)
> > at
> > com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:135)
> > at
> > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:337)
> > at
> > com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:309)
> > at org.codehaus.xfire.jaxb2.JaxbType.readObject(JaxbType.java:196)
> > ... 16 more
> > Caused by: javax.xml.bind.UnmarshalException: unexpected element
> > (uri:"http://www.webservicex.net";,
> > local:"GetWeatherByZipCodeResult"). Expected elements are
> > <{http://www.webservicex.net}GetWeatherByZipCode>,<{http://www.webservicex.net}GetWeatherByZipCodeResponse>
> > ... 29 more
> > 
> > 
> > 
> > Keep in mind, I have not altered any of the classes provided by the
> > example whatsoever...I merely built and deployed.  Conversely, I
> > used WsGen to generate client classes per the WSDL generated by
> > XFire and those work fine.  What am I doing wrong in my client?
> > 
> > Attached is the client class I wrote using the XFireProxyFactory.
> > 
> > Thanks,
> > Eric Miles  
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> > 
> >     http://xircles.codehaus.org/manage_email

Reply via email to