0 Replies Latest reply on Aug 3, 2005 8:28 AM by fss

    Help: Webservice ejb-endpoint + jaxb

    fss

      I created a doc/lit webservice as sessionbean endpoint!

      I processed following steps:

      1. I created the xsd-schema-files for the requests and responses

      schema:

      ...
      <xs:element name="ReadRS">
       <xs:complexType>
       <xs:choice>
       <xs:sequence>
       <xs:element name="Success" type="SuccessType"/>
       </xs:sequence>
       <xs:element name="Errors" type="ErrorsType"/>
       </xs:choice>
       </xs:complexType>
      </xs:element>
      ...



      2. I created the wsdl-file

      3. wscompile with -f:documentliteral und -f:nodatabinding to create the SEI
      SEI:
      ...
      public javax.xml.soap.SOAPElement ReadRQ(javax.xml.soap.SOAPElement rq)
      throws java.rmi.RemoteException;
      ...



      4. xjc on the xsd-files to get the jaxb-databindings

      5. create and deploy the bean on jboss (no errors)
      Sessionbean (service endpoint):
      import java.rmi.RemoteException;
      
      import javax.ejb.SessionBean;
      import javax.ejb.SessionContext;
      import javax.xml.bind.JAXBContext;
      import javax.xml.bind.Marshaller;
      import javax.xml.bind.Validator;
      import javax.xml.soap.SOAPElement;
      import javax.xml.soap.SOAPFactory;
      import javax.xml.transform.dom.DOMResult;
      
      import de.test.ws.vo.jaxb.ReadRS;
      import de.test.ws.vo.jaxb.ObjectFactory;
      .
      .
      .
      
      public SOAPElement ReadRQ(SOAPElement rq) throws RemoteException
       {
       SOAPElement response_ret = null;
      
       try
       {
       ObjectFactory objFactory = new ObjectFactory();
      
       JAXBContext jc = JAXBContext.newInstance("de.test.ws.vo.jaxb");
      
       .
       .
       .
      
       Marshaller m = jc.createMarshaller();
      
       ReadRS response = objFactory.createReadRS();
      
       response.setSuccess(...);
       .
       .
       .
      
       SOAPFactory factory = SOAPFactory.newInstance();
       SOAPElement parent = factory.createElement("dummy");
       // this produces the error
       m.marshal(response, new DOMResult(parent));
       // this produces the error
      
       response_ret = (SOAPElement) parent.getChildElements().next();
       }
       catch(Exception e)
       {
       e.printStackTrace();
       }
      
       return response_ret;
       }





      The Problem:
      Everthing works fine! The Sessionbean could unmarshall the Soapelement with jaxb. Then I processed the Object and wanted to marshall the Object -> Soapelement. This produced the following error:

      Stacktrace:
      2005-08-03 13:41:37,477 DEBUG [org.jboss.webservice.server.InvokerProviderEJB] makeNewServiceObject: class=de.test.ws.vo.TestWS_PortType
      2005-08-03 13:41:37,477 DEBUG [org.jboss.webservice.server.InvokerProviderEJB] Invoke EJB: public abstract javax.xml.soap.SOAPElement de.test.ws.vo.TestWS_PortType.ReadRQ(javax.xml.soap.SOAPElement) throws java.rmi.RemoteException
      2005-08-03 13:41:37,477 DEBUG [org.jboss.webservice.handler.HandlerChainBaseImpl] Enter: doHandleRequest
      2005-08-03 13:41:37,477 DEBUG [org.jboss.webservice.handler.HandlerChainBaseImpl] Exit: doHandleRequest with status: true
      2005-08-03 13:42:21,753 INFO [STDOUT] java.lang.NullPointerException
      2005-08-03 13:42:21,816 INFO [STDOUT] at com.sun.xml.bind.marshaller.SAX2DOMEx.startElement(SAX2DOMEx.java:94)
      2005-08-03 13:42:21,816 INFO [STDOUT] at de.test.ws.vo.jaxb.impl.runtime.SAXMarshaller.endAttributes(SAXMarshaller.java:184)
      2005-08-03 13:42:21,831 INFO [STDOUT] at de.test.ws.vo.jaxb.impl.ReadRSImpl.serializeBody(ReadRSImpl.java:42)
      2005-08-03 13:42:21,831 INFO [STDOUT] at de.test.ws.vo.jaxb.impl.runtime.SAXMarshaller.childAsBody(SAXMarshaller.java:391)
      2005-08-03 13:42:21,831 INFO [STDOUT] at de.test.ws.vo.jaxb.impl.runtime.MarshallerImpl.write(MarshallerImpl.java:171)
      2005-08-03 13:42:21,831 INFO [STDOUT] at de.test.ws.vo.jaxb.impl.runtime.MarshallerImpl.marshal(MarshallerImpl.java:111)
      2005-08-03 13:42:21,831 INFO [STDOUT] at de.test.ws.bo.TestWSBean.ReadRQ(TestWSBean.java:128)
      2005-08-03 13:42:21,847 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2005-08-03 13:42:21,847 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      2005-08-03 13:42:21,847 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2005-08-03 13:42:21,847 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)
      2005-08-03 13:42:21,847 INFO [STDOUT] at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      2005-08-03 13:42:21,847 INFO [STDOUT] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
      2005-08-03 13:42:21,863 INFO [STDOUT] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      2005-08-03 13:42:21,863 INFO [STDOUT] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:130)
      2005-08-03 13:42:21,863 INFO [STDOUT] at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:106)
      2005-08-03 13:42:21,863 INFO [STDOUT] at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
      2005-08-03 13:42:21,878 INFO [STDOUT] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
      2005-08-03 13:42:21,878 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
      2005-08-03 13:42:21,878 INFO [STDOUT] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
      2005-08-03 13:42:21,878 INFO [STDOUT] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:139)
      2005-08-03 13:42:21,878 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
      2005-08-03 13:42:21,878 INFO [STDOUT] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      2005-08-03 13:42:21,894 INFO [STDOUT] at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
      2005-08-03 13:42:21,894 INFO [STDOUT] at org.jboss.ejb.Container.invoke(Container.java:873)
      2005-08-03 13:42:21,894 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2005-08-03 13:42:21,894 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      2005-08-03 13:42:21,894 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2005-08-03 13:42:21,909 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)
      2005-08-03 13:42:21,909 INFO [STDOUT] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      2005-08-03 13:42:21,909 INFO [STDOUT] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      2005-08-03 13:42:21,909 INFO [STDOUT] at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      2005-08-03 13:42:21,909 INFO [STDOUT] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
      2005-08-03 13:42:21,925 INFO [STDOUT] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
      2005-08-03 13:42:21,925 INFO [STDOUT] at org.jboss.webservice.server.InvokerProviderEJB.invokeServiceEndpoint(InvokerProviderEJB.java:131)
      2005-08-03 13:42:21,925 INFO [STDOUT] at org.jboss.webservice.server.InvokerProvider.invokeMethod(InvokerProvider.java:238)
      2005-08-03 13:42:21,925 INFO [STDOUT] at org.jboss.axis.providers.java.RPCProvider.invokeTarget(RPCProvider.java:176)
      2005-08-03 13:42:21,925 INFO [STDOUT] at org.jboss.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:121)
      2005-08-03 13:42:21,925 INFO [STDOUT] at org.jboss.axis.providers.java.JavaProvider.invoke(JavaProvider.java:358)
      2005-08-03 13:42:21,941 INFO [STDOUT] at org.jboss.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:73)
      2005-08-03 13:42:21,941 INFO [STDOUT] at org.jboss.axis.SimpleChain.doVisiting(SimpleChain.java:160)
      2005-08-03 13:42:21,941 INFO [STDOUT] at org.jboss.axis.SimpleChain.invoke(SimpleChain.java:123)
      2005-08-03 13:42:21,941 INFO [STDOUT] at org.jboss.axis.handlers.soap.SOAPService.invoke(SOAPService.java:560)
      2005-08-03 13:42:21,941 INFO [STDOUT] at org.jboss.webservice.server.ServerEngine.invokeInternal(ServerEngine.java:200)
      2005-08-03 13:42:21,956 INFO [STDOUT] at org.jboss.webservice.server.ServerEngine.invoke(ServerEngine.java:89)
      2005-08-03 13:42:21,956 INFO [STDOUT] at org.jboss.axis.transport.http.AxisServlet.doPost(AxisServlet.java:911)
      2005-08-03 13:42:21,956 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      2005-08-03 13:42:21,956 INFO [STDOUT] at org.jboss.axis.transport.http.AxisServletBase.service(AxisServletBase.java:370)
      2005-08-03 13:42:21,956 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      2005-08-03 13:42:21,956 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      2005-08-03 13:42:21,972 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      2005-08-03 13:42:21,972 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
      2005-08-03 13:42:21,972 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      2005-08-03 13:42:21,972 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      2005-08-03 13:42:21,972 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      2005-08-03 13:42:21,988 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      2005-08-03 13:42:21,988 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
      2005-08-03 13:42:21,988 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
      2005-08-03 13:42:21,988 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
      2005-08-03 13:42:21,988 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      2005-08-03 13:42:22,003 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      2005-08-03 13:42:22,003 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      2005-08-03 13:42:22,003 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      2005-08-03 13:42:22,003 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
      2005-08-03 13:42:22,003 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
      2005-08-03 13:42:22,019 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      2005-08-03 13:42:22,019 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      2005-08-03 13:42:22,019 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)


      - Is this a bug in the SoapFactoryImpl from Jboss (when I test the jaxb-codesegment without jboss everything works fine)?
      - Is there an other way to integrate jaxb-binding in jboss?

      thanx Florian