10 Replies Latest reply on May 19, 2005 5:47 PM by awesomejt

    JBossWS web-service from a Stateless Session Bean

    sidazad

      Hi,
      I am trying to create a JBossWS web-service from a stateless session bean, but not getting much success. Is this how it should be done:

      (1. Create an SEI (extends Remote) and write a Session Bean.

      (2. From these 2 classes, generate the .wsdl using wscompile:

      wscompile -define...

      (3. Generate the jaxrpc-mapping file from the .wsdl using wscompile -gen..

      I am able to do the above and deploy the web-service and the wsdl shows up via http://localhost:8080/ws4ee
      But obviously a lot is missing here since I haven't used any other .java or .class files generated by wscompile and I am not sure how to proceed from this point on.
      Thanks, Sid.



        • 1. Re: JBossWS web-service from a Stateless Session Bean
          thomas.diesler

          Which specific part of the StepByStep tutorials is not clear to you?

          • 2. Re: JBossWS web-service from a Stateless Session Bean
            sidazad

            I was able to do this but I have been unable to create a client application for the deployed web service. I was trying to make a DII client but I keep getting the following exception:

            xception in thread "Thread-1" java.lang.NoClassDefFoundError: javax/wsdl/factory/WSDLFactory
             at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:404)
             at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:393)
             at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:245)
             at java.lang.Thread.run(Unknown Source)
            javax.xml.rpc.ServiceException: Error processing WSDL document:
            javax.xml.rpc.ServiceException: Error processing WSDL document:
            javax.xml.rpc.ServiceException: Cannot find service: {http://sidtest.com}SidTestService
             at org.apache.axis.client.Service.initService(Service.java:278)
             at org.apache.axis.client.Service.<init>(Service.java:193)
             at org.apache.axis.client.ServiceFactory.createService(ServiceFactory.java:232)
             at com.sidtestclient.SidDynaClient.main(SidDynaClient.java:24)
            
            


            Is it possible to have a Dynamic Proxy or a DII for a Document/Literal type web service with JBoss WS at this point?
            Thanks.

            • 3. Re: JBossWS web-service from a Stateless Session Bean
              anil.saldhana

              U r missing wsdl4j.jar on the clientside.

              • 4. Re: JBossWS web-service from a Stateless Session Bean
                sidazad

                Okay, I got 1 step further but I think this should really work now but I still see an exception. Below is my code:

                
                 ServiceFactory factory = ServiceFactory.newInstance();
                 QName sName = new QName("http://sidtest.com", "SidTestService");
                 URL wsdlURL = new URL("http://ny731-4w-324a:8080/sidtest-ejb/SidTestPort?wsdl");
                 Service service = factory.createService(wsdlURL, sName);
                 QName pName = new QName("http://sidtest.com", "SidTestPort");
                 SidTest port = (SidTest)service.getPort(pName, SidTest.class);
                 SayHello request = new SayHello();
                 SayHelloResponse res = new SayHelloResponse();
                 if(port == null)
                 System.out.println("Port is null");
                 else
                 res = port.sayHello(request);
                
                


                
                and here's the exception:
                java.lang.NullPointerException
                 at org.apache.axis.client.AxisClientProxy.proxyParams2CallParams(AxisClientProxy.java:123)
                 at org.apache.axis.client.AxisClientProxy.invoke(AxisClientProxy.java:185)
                 at $Proxy0.sayHello(Unknown Source)
                 at com.sidtestclient.SidDIIClient.main(SidDIIClient.java:36)
                
                
                
                

                I belive the proxy is being created and I am also getting a reference to the port but when I call the method it throws a NullPointerException.
                Thanks.

                • 5. Re: JBossWS web-service from a Stateless Session Bean
                  thomas.diesler

                  What JBoss version is this? I can't see what would be causing a NPE with the current code base at AxisClientProxy.java:123

                  • 6. Re: JBossWS web-service from a Stateless Session Bean
                    sidazad

                    This is JBoss 4.0.1 sp1.

                    • 7. Re: JBossWS web-service from a Stateless Session Bean
                      sidazad

                      Also to create the service endpoint, I followed the tutorial for creating a

                      Document style service
                      . I am not sure if I need to do any additional settings in the Dynamic proxy client for this.
                      I know one needs to set certain properties in the Call Object when to specify document style or rpc style, but I am dealing with the port directly.
                      The port class was also generated as explained in the Document Style client step by step tutorial.
                      Thanks.

                      • 8. Re: JBossWS web-service from a Stateless Session Bean
                        sidazad

                        Finally I was able to see the SOAP message being sent to JBoss. I think this should provide a clue to what is going on here.

                        <?xml version="1.0" encoding="UTF-8"?>
                        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                         <soapenv:Body>
                         <concat xmlns="http://sidcomtest.com">
                         <SidInput_1 xsi:type="ns1:Concat" xmlns:ns1="http://sidcomtestclient.com" xmlns="">
                         <sidInput_1 xsi:nil="true"/>
                         </SidInput_1>
                         </concat>
                         </soapenv:Body>
                        </soapenv:Envelope>
                        



                        The exception received from JBoss is :

                        12:38:12,027 INFO [AxisServlet] java.lang.IllegalArgumentException: Namespace URI cannot be null
                        12:38:12,027 ERROR [Engine] StandardWrapperValve[SidStringBean]: Servlet.service() for servlet SidSt
                        ringBean threw exception
                        java.lang.NullPointerException
                         at org.apache.axis.encoding.DeserializationContextImpl.getTypeMapping(DeserializationContext
                        Impl.java:604)
                         at org.apache.axis.encoding.DeserializationContextImpl.getDeserializer(DeserializationContex
                        tImpl.java:564)
                         at org.apache.axis.encoding.DeserializationContextImpl.getDeserializerForType(Deserializatio
                        nContextImpl.java:596)
                         at org.apache.axis.message.SOAPFaultBuilder.onStartChild(SOAPFaultBuilder.java:370)
                         at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextIm
                        pl.java:1166)
                         at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
                         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
                         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(
                        Unknown Source)
                         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
                         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
                         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
                         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
                         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
                         at javax.xml.parsers.SAXParser.parse(Unknown Source)
                         at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java
                        


                        There is more stacktrace after this but I think this should provide a clue.
                        Please assist,
                        Thanks, Sid.

                        • 9. Re: JBossWS web-service from a Stateless Session Bean
                          jason.greene

                          12:38:12,027 INFO [AxisServlet] java.lang.IllegalArgumentException: Namespace URI cannot be null

                          This one is fixed in the current branch. It will be included in the 4.0.2 release.

                          -Jason

                          • 10. Re: JBossWS web-service from a Stateless Session Bean
                            awesomejt

                            What is the fix for 4.0.1 sp 1? We are unable to migrate to 4.0.2 at this point.

                            Thanks.