JAX-WS Exception - “return is not a valid property”

While implementing java webservices and Metro as your JAX-WS provider sometimes you will need to return Json object,HashMap,....

In that case you may get the following error:


SEVERE: WSSERVLET11: failed to parse runtime descriptor: javax.xml.ws.WebServiceException: class dAO.jaxws.LoginResponse do not have a property of the name return
javax.xml.ws.WebServiceException: class dAO.jaxws.LoginResponse do not have a property of the name return
    at com.sun.xml.ws.server.sei.EndpointResponseMessageBuilder$DocLit.<init>(EndpointResponseMessageBuilder.java:258)
    at com.sun.xml.ws.server.sei.TieHandler.createResponseMessageBuilder(TieHandler.java:212)
    at com.sun.xml.ws.server.sei.TieHandler.<init>(TieHandler.java:117)
    at com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:110)
    at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:74)
    at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:58)
    at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:127)
    at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:487)
    at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:283)
    at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:158)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:577)
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560)
    at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:303)
    at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:179)
    at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:131)
    at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:65)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5274)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.xml.bind.JAXBException: return is not a valid property on class dAO.jaxws.LoginResponse
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:985)
    at com.sun.xml.ws.db.glassfish.JAXBRIContextWrapper.getElementPropertyAccessor(JAXBRIContextWrapper.java:120)
    at com.sun.xml.ws.server.sei.EndpointResponseMessageBuilder$DocLit.<init>(EndpointResponseMessageBuilder.java:254)
    ... 23 more


Solution:

Set the Document style as follows to RPC. This annotation should come after the @WebService annotation..

@WebService(endpointInterface="dAO.LoginImpl") 
@SOAPBinding(style = Style.RPC)

No comments:

Post a Comment