13 Replies Latest reply on Jan 4, 2006 8:39 PM by stetsonab

    WSDOCServiceStepByStep help

    ibsscott

      I have followed the example very carefully. I am able to receive the object on the server but when I send it back to the client, the client objects to it:

      This is my SEI:

      public WebServiceSessionEndpoint_process_ResponseStruct process(WebServiceSessionEndpoint_process_RequestStruct request) throws RemoteException;

      This is how I call the webservice:

      WebServiceSessionEndpoint_process_ResponseStruct response = (WebServiceSessionEndpoint_process_ResponseStruct)endpoint.process(new WebServiceSessionEndpoint_process_RequestStruct(transactionDocument));

      This is how I return the response:
      WebServiceSessionEndpoint_process_ResponseStruct response = new WebServiceSessionEndpoint_process_ResponseStruct(webDocument);

      Here is the error:

      java.lang.ClassCastException: org.apache.axis.Message

      at com.sun.xml.rpc.client.dii.CallInvokerImpl._postSendingHook(CallInvokerImpl.java:305)

      at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:324)

      at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:103)

      at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:480)

      at com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:121)

      at com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:85)

      at $Proxy0.process(Unknown Source)

      at com.fifalmonk.client.WsClient.testWebServiceAccess2(WsClient.java:267)

      at com.fifalmonk.client.WsClient.main(WsClient.java:62)

      Process exited with exit code 0.

        • 1. Re: WSDOCServiceStepByStep help
          ibsscott

          I'm thinking the problem is that my client does not have access to the jaxrpc-mapping.xml file and that I will need a J2EE client to help out. Any thoughts? Is there any other way to do this? Does a J2ee client limit me to only talking to java clients? How would a non-java app send me an xml doc?

          • 2. Re: WSDOCServiceStepByStep help
            nehring

            The WSDL document is the contract between the server and client. Unless you're using non-standard SOAP types, i.e. passing serialized objects, the client and server language/technology doesn't matter. Passing opaque objects may require the client to be a particular technology and would require the client to know how to deserialize the objects.

            So, given just the WSDL file, you should be able to use Java, .Net, Perl, etc, to talk to the server. I commonly use Perl clients to test J2EE and .Net webservices. You should be able to get the WSDL file by tacking "?wsdl" to the end of the web service URL in a browser.

            • 3. Re: WSDOCServiceStepByStep help
              thomas.diesler

              Your JWSDP client want to cast to an Apache Axis Message. Why is that?

              java.lang.ClassCastException: org.apache.axis.Message
              at com.sun.xml.rpc.client.dii.CallInvokerImpl._postSendingHook(CallInvokerImpl.java:305)
              at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:324)
              at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:103)


              • 4. Re: WSDOCServiceStepByStep help
                ibsscott

                I'm not sure why. The request is received on the server succesfully. I just can't unwrap it on the client side. My client looks like this:

                URL url = new URL("http://localhost:8080/fifalmonk/fifalmonk/WebServiceSession?wsdl");

                QName qname = new QName("http://com/fifalmonk/webservice/WebServiceSession.wsdl",
                "WebServiceSession");

                ServiceFactory factory = ServiceFactory.newInstance();
                Service service = factory.createService( url, qname );
                WebServiceSessionEndpoint endpoint= (WebServiceSessionEndpoint) service.getPort(WebServiceSessionEndpoint.class);

                ... build Transaction bean here....

                WebServiceSessionEndpoint_process_RequestStruct request = new WebServiceSessionEndpoint_process_RequestStruct(transactionDocument);
                WebServiceSessionEndpoint_process_RequestStruct request = new WebServiceSessionEndpoint_process_RequestStruct(transactionDocument);
                WebServiceSessionEndpoint_process_ResponseStruct response = (WebServiceSessionEndpoint_process_ResponseStruct)endpoint.process(request);

                I also tried this and got the same result.
                Object o = endpoint.process(request);

                Something in here is causing the problem:
                at com.sun.xml.rpc.client.dii.CallInvokerImpl._postSendingHook(CallInvokerImpl.java:305)

                I'm using the -gen:server artifacts to wrap and unwrap the request and response because when I tried to regenerate the client classes with wscompile based on the server's wsdl, it tried to create a constructor with too many parameters. My original beans have a lot of fields. The classes it created would not compile. I shouldn't need to recreate the classes anyways since they were used to build the wsdl in the first place and I have them already.

                • 5. Re: WSDOCServiceStepByStep help
                  anil.saldhana

                  On the client side, you are not using the jbossws client but are using the Sun implementation.

                  Try using the client jar for jboss ws4ee in the client directory of jboss instance.

                  • 6. Re: WSDOCServiceStepByStep help
                    stetsonab

                    ibsscott, did you ever get this problem figured out? I have exactly the same error showing up when trying to run my test client. I tested my webservices with a SOAP Message Console, and they are running fine.
                    Here is the exact error that is being thrown.

                    java.lang.ClassCastException
                    at com.sun.xml.rpc.client.dii.CallInvokerImpl._postSendingHook(CallInvokerImpl.java:305)
                    at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:324)
                    at com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:103)
                    at com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:492)
                    at com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.java:121)
                    at com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.java:85)
                    at $Proxy0.login(Unknown Source)
                    at com.wcom.rrs.remote.client.TestClient.main(TestClient.java:34)

                    If you or anyone out there could help me, it would be greatly appreciated.

                    • 7. Re: WSDOCServiceStepByStep help
                      ibsscott

                      I decided to wait until the next generation of web services is released. The only reliable way I could use was to pass it as a String and then Marshal it into xml.

                      • 8. Re: WSDOCServiceStepByStep help
                        jason.greene

                        Is there a reason why you guys are using the sun client instead of the jboss ws client?

                        -Jason

                        • 9. Re: WSDOCServiceStepByStep help
                          stetsonab

                          Maybe that is where the problem is....maybe the code is referencing the wrong Jar file. Here are the jars that I have in my classpath...

                          jboss\client\jboss-jaxrpc.jar
                          jboss\client\jboss-saaj.jar
                          jboss\client\jboss-ws4ee.jar
                          jboss\client\jboss-common-client.jar
                          jboss\client\commons-discovery.jar
                          jboss\client\commons-logging.jar
                          jboss\client\wsdl4j.jar

                          from the WebServices Developer Pack I am using
                          jwsdp\jaxrpc\lib\jaxrpc-api.jar
                          jwsdp\jaxrpc\lib\jaxrpc-spi.jar
                          jwsdp\jaxrpc\lib\jaxrpc-impl.jar
                          jwsdp\jwsdp-shared\lib\jax-qname.jar
                          jwsdp\jwsdp-shared\lib\activation.jar
                          jwsdp\jwsdp-shared\lib\mail.jar

                          Based on Anil's suggestion from an earlier post I added
                          jboss\client\jboss-ws4ee-client.jar to my classpath which did not seem to make any difference. I still got the class cast error. So please let me know if I use a wrong jar file, if there are conflicting jars in my classpath, and which one I should use. Your help is appreciated!

                          • 10. Re: WSDOCServiceStepByStep help
                            maleszka

                            The problem is in the jboss jars. Make sure that the jwsdp\jaxrpc\lib\jaxrpc-*.jar are loaded first and don't put the jboss-jaxrpc.jar in the CLASSPATH.

                            I had the same problem and fixed it by using only the Sun libs of the jwsdp tools. I also used the saaj jars of the Sun jwsdp tools instead of the JBoss one.

                            Bert

                            • 11. Re: WSDOCServiceStepByStep help
                              jason.greene

                               

                              "stetsonab" wrote:
                              Maybe that is where the problem is....maybe the code is referencing the wrong Jar file. Here are the jars that I have in my classpath...

                              Based on Anil's suggestion from an earlier post I added
                              jboss\client\jboss-ws4ee-client.jar to my classpath which did not seem to make any difference. I still got the class cast error. So please let me know if I use a wrong jar file, if there are conflicting jars in my classpath, and which one I should use. Your help is appreciated!


                              If you are wanting to use the JBoss webservices stack for a client, then you do not want ANY jwsdp jars in your classpath. You only need the JBoss WS Client jars which are documented here:

                              http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWSFAQ

                              -Jason

                              • 12. Re: WSDOCServiceStepByStep help
                                thomas.diesler

                                 


                                From the WebServices Developer Pack I am using

                                jwsdp\jaxrpc\lib\jaxrpc-api.jar
                                jwsdp\jaxrpc\lib\jaxrpc-spi.jar
                                jwsdp\jaxrpc\lib\jaxrpc-impl.jar
                                jwsdp\jwsdp-shared\lib\jax-qname.jar
                                jwsdp\jwsdp-shared\lib\activation.jar
                                jwsdp\jwsdp-shared\lib\mail.jar


                                Why?

                                There is an FAQ about the client jars to use.

                                http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWSFAQ



                                • 13. Re: WSDOCServiceStepByStep help
                                  stetsonab

                                  Thanks to everyone who replied. You guys are great!