3 Replies Latest reply on Jan 20, 2010 12:06 PM by Lucas Toledo

    Use of JAX-RPC in JBoss 4.2.3

    Glen Scott Newbie

      I have a web app running on JBoss AS 4.2.3, default server configuration. I need to write a web service client that can talk to a soap encoded web service. I know that JBossWS does not support soap encoding, so I am struggling to find a workaround.

      From my research I'm lead to believe that JAX-RPC is the one library that does support soap encoding, so have tried using a (JWSDP) wscompile produced client in JBoss 4.2.3.

      When I include the JWSDP compatible JARs[1] in the lib directory of my EAR, and my client code calls into the wscompile produced stub, the stub calls into (JWSDP) StreamingSender class and ultimately throws a ClassCastException:

       1. java.lang.ClassCastException: org.jboss.ws.core.soap.SOAPMessageImpl
       2. at com.sun.xml.rpc.client.StubBase._postSendingHook(StubBase.java:231)
       3. at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:324)

      How can I make JAX-RPC work on JBoss 4.2.3? Is it possible to manipulate the set of JARs from JWSDP that I am including[1] in my web app to make JAX-RPC (supporting soap encoding) work on JBoss 4.2.3?

      If no-one can offer the silver-bullet answer as to how to make JAX-RPC work on JBoss 4.2.3, maybe one of the following ideas will ring true with someone who can at least point me in the right direction to pursue.

      Might I:
      * *Somehow* configure JBossWS to "play nice" with JAX-RPC so that JAX-RPC can be used as my web service library
      * Change the class loader configuration to allow the JAX-RPC (and associated JWSDP) JAR files to work in my web app
      * Remove the JBossWS module from the default configuration, and somehow just use JAX-RPC JARs from my web app rather than being loaded as a JBoss service (although I have concerns that the JAX-RPC dependant JARs from JWSDP would still conflict with other XML related JARs in JBoss AS)
      * Switch to some other web service client library that supports soap encoding (that I'm not aware of) that can be configured to run on JBoss AS 4.2.3

      I am relatively new to JBoss, so if one of the above ideas strikes you as ludicrous (just doesn't make sense), I apologize.

      Thank you,
      Glen Scott

      [1]The jars from JWSDP 1.6 I included in my EAR's lib are: activation.jar, commons-beanutils.jar, commons-collections.jar, commons-digester.jar, commons-logging.jar, dom.jar, jaas.jar, jax-qname.jar, jaxp-api.jar, jaxrpc-api.jar, jaxrpc-impl.jar, jaxrpc-spi.jar, mail.jar, namespace.jar, relaxngDatatype.jar, saaj-api.jar, saaj-impl.jar, sax.jar, xercesImpl.jar, xsdlib.jar

        • 1. Re: Use of JAX-RPC in JBoss 4.2.3
          Glen Scott Newbie

          I'll answer my own question in case anyone is trying to solve the same problem I had.

          I found a tutorial at http://jaitechwriteups.blogspot.com/2006/12/simple-webservice-on-jboss-using-axis.html which admittedly was written for JBoss 4.0.4, but in comments seemed to indicate would work with Axis 1.4 on JBoss 4.2.x. By following the tutorial I was able to get a client web service running that uses soap encoding including for soap encoded arrays (particularly unsupported it seems, since from my understanding of some JBossWS documentation, JBossWS in previous versions did support soap encoding in part--just not for soap encoded arrays).

          To jump to the chase, I simply put the following JARs from Axis 1.4 in my EAR's lib directory:
          axis.jar, axit-ant.jar, commons-discovery-0.2.jar, jaxrpc.jar, saaj.jar, wsdl4j-1.5.1.jar

          No modifications were necessary to the JARs included in JBoss libs nor to the configuration of any classloader.

          Do take note that if one tries to use Axis 1.4 to implement the server for a web service, some extra configuration seem to be necessary. In my case, I only needed a client so the above JARs in the EAR's lib were enough. But since I was initially following the above tutorial quite closely, and the tutorial does take you down the path of enabling a server, I did encounter and come up with a solution for enabling a server. I found that the compiler was not able to find J2EE classes in the compiler's classpath, which I fixed by copying jboss-j2ee.jar and servlet-api.jar from the JBoss default server's lib directory to my EAR's lib. As to whether this is the "right" thing to do to enable an Axis implemented server, I'm not sure, but I didn't try too hard since it wasn't part of my goal.

          • 2. Re: Use of JAX-RPC in JBoss 4.2.3
            Glen Scott Newbie

            I realize I didn't make clear in the above reply why I was suddenly was talking about Axis rather than JWSDP. As mentioned in my original message, my ultimate goal was to write a client that can use SOAP encoding.

            So the strategy I used was to "Switch to some other web service client library that supports soap encoding (that I'm not aware of) that can be configured to run on JBoss AS 4.2.3 "

            This other library turned out to be Axis 1.x.

            The idea to switch to Axis 1.x was given to me in a JavaRanch suggestion as well as suggestions from Glassfish forums for how to get SOAP encoding support when running on GlassFish.

            • 3. Re: Use of JAX-RPC in JBoss 4.2.3
              Lucas Toledo Newbie

              Thanks for posting your solution. I had a very simmilar problem and I managed to solve it (so far).

              I know you posted the solution almost a year ago, but how did you figure out that the mentioned jar files should go inside the EAR file? what led you to try that solution?

              I'm still a newbie when it comes to soap objects so I would really like to know.

              So, you are effectively shipping axis within the EAR file, is that correct?

              Thanks in advance,