Discussions

XML & Web services: javax.xml.bind.JAXBException - not a valid property

  1. Hi, I'm creating a webservice client using jaxws 2.1 (JAXWS2.1.5-20081030.jar). I've used wsimport to generate the java classes from a wsdl file and I've built my client business logic. Everything compiles fine. However, when i execute the client, it fails with an exception saying that the generated class does not have a property (see below for full error message). The class throwing the error is the generated class from jaxb. Anyone has any clues? I've searched the Net some links with similar error mentions that jaxb has issues with enumerations but I don't think this is my case. I hope someone can give me some clues coz I've cracking my head over this for the past 3 days..thanks so much! javax.xml.ws.WebServiceException: class com.unica.ndp.lbsClient.GetSessionResponse do not have a property of the name {http://www.bea.com/wsdl/wlcp/wlng/session_manager/service}getSessionReturn at com.sun.xml.ws.client.sei.ResponseBuilder$DocLit.(ResponseBuilder.java:511) at com.sun.xml.ws.client.sei.SEIMethodHandler.buildResponseBuilder(SEIMethodHandler.java:136) at com.sun.xml.ws.client.sei.SyncMethodHandler.(SyncMethodHandler.java:85) at com.sun.xml.ws.client.sei.SEIStub.(SEIStub.java:82) at com.sun.xml.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSServiceDelegate.java:639) at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:342) at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:324) at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:306) at javax.xml.ws.Service.getPort(Service.java:103) at com.unica.ndp.lbsClient.SessionManagerService.getSessionManager(SessionManagerService.java:48) at com.unica.ndp.lbsClient.NDPSession.setSessionId(NDPSession.java:35) at com.unica.ndp.lbsClient.NDPSession.(NDPSession.java:24) at com.unica.ndp.lbsClient.NDPSession.getInstance(NDPSession.java:50) at com.unica.ndp.lbsClient.Campaign.register(Campaign.java:156) at com.unica.ndp.lbsClient.RegisterCampaign$1.execute(RegisterCampaign.java:75) at com.unica.ndp.lbsClient.DAOManager.transaction(DAOManager.java:75) at com.unica.ndp.lbsClient.DAOManager$1.execute(DAOManager.java:112) at com.unica.ndp.lbsClient.DAOManager.executeAndClose(DAOManager.java:97) at com.unica.ndp.lbsClient.DAOManager.transactionAndClose(DAOManager.java:110) at com.unica.ndp.lbsClient.RegisterCampaign.performRegistration(RegisterCampaign.java:69) at com.unica.ndp.lbsClient.RegisterCampaign.main(RegisterCampaign.java:45) Caused by: javax.xml.bind.JAXBException: {http://www.bea.com/wsdl/wlcp/wlng/session_manager/service}getSessionReturn is not a valid property on class com.unica.ndp.lbsClient.GetSessionResponse at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:936) at com.sun.xml.ws.client.sei.ResponseBuilder$DocLit.(ResponseBuilder.java:500) ... 20 more 2009-04-20 11:48:17,930 [main] ERROR com.unica.ndp.lbsClient.RegisterCampaign - Failed to get register campaign. com.unica.ndp.lbsClient.ServiceException_Exception: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:41) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39) at java.lang.reflect.Constructor.newInstance(Constructor.java:515) at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:141) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119) at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89) at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118) at $Proxy32.startGeographicalNotification(Unknown Source) at com.unica.ndp.lbsClient.Campaign.register(Campaign.java:168) at com.unica.ndp.lbsClient.RegisterCampaign$1.execute(RegisterCampaign.java:75) at com.unica.ndp.lbsClient.DAOManager.transaction(DAOManager.java:75) at com.unica.ndp.lbsClient.DAOManager$1.execute(DAOManager.java:112) at com.unica.ndp.lbsClient.DAOManager.executeAndClose(DAOManager.java:97) at com.unica.ndp.lbsClient.DAOManager.transactionAndClose(DAOManager.java:110) at com.unica.ndp.lbsClient.RegisterCampaign.performRegistration(RegisterCampaign.java:69) at com.unica.ndp.lbsClient.RegisterCampaign.main(RegisterCampaign.java:45)

    Threaded Messages (1)

  2. solution[ Go to top ]

    OK, I've solved this myself. I was using -p with wsimport to name the package of the generated class. When I removed this from the generated class, everything works fine! I'm not really sure why but I think it's because the wsdl is using target namespace. Hope that helps others who encountered this problem.