cornercorner
FeaturesPluginsDocs & SupportCommunityPartners

JAXWSonJBoss

Web Services support on JBoss (using JBossWS)

This investigation is based on JBossWS JAX-WS User-guide Note: JDK 1.6 is not officially supported by JBoss at the time of this writing. Also note that this is based on latest JBossWS (currently 2.0.1GA) implementation installed on top of JBoss 4.2.1.GA. See the JBossWS Installation Guide

JAX-WS web services from Java

Expected steps to do:

  1. Create EJB/Web Module
  2. Create new Web Service
  3. Add some operation to it (using Add operation action)
  4. Deploy the project
  5. Invoke Test Web Service action


Current issues in EJB module

  • javax.jws.WebService annotation is underlined in the editor (seems like the editor cannot find this class on the classpath), but compilation of the class is succesful

simple fix:

Index: JBProperties.java
===================================================================
RCS file: /cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/util/JBProperties.java,v
retrieving revision 1.7
diff -u -r1.7 JBProperties.java
--- JBProperties.java   16 Aug 2007 12:28:12 -0000      1.7
+++ JBProperties.java   2 Oct 2007 21:43:35 -0000
@@ -151,6 +151,11 @@
             File serverDir = getServerDir();
             list.add(fileToUrl(new File(rootDir, "client/jboss-j2ee.jar")));  // NOI18N
 
+            File jaxWsAPILib = new File(rootDir, "client/jboss-jaxws.jar"); // NOI18N
+            if (jaxWsAPILib.exists()) {
+                list.add(fileToUrl(jaxWsAPILib));
+            }
+            
             File wsClientLib = new File(rootDir, "client/jbossws-client.jar"); // NOI18N
             if (wsClientLib.exists()) {
                 list.add(fileToUrl(wsClientLib));

  • WS Designer cannot be opened in the design view from some reason (might be random issue, because under some - not known - conditions design view is correctly opened), see also NPE which appears during the designer opening - that's, again, something random (see {1} at the bottom for the stacktrace - usually happens after the restart of the IDE)


Current issues in Web module

  • JAX-RPC web service is being created - after applying following patch one is able to create JAX-WS web service on JBoss (note that JBossWS supports JSR-109 deployment of web services):
Index: JBJ2eePlatformFactory.java
===================================================================
RCS file: /cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBJ2eePlatformFactory.java,v
retrieving revision 1.17
diff -u -r1.17 JBJ2eePlatformFactory.java
--- JBJ2eePlatformFactory.java  27 Sep 2007 08:59:51 -0000      1.17
+++ JBJ2eePlatformFactory.java  2 Oct 2007 21:53:47 -0000
@@ -174,6 +174,9 @@
         }
 
         public boolean isToolSupported(String toolName) {
+            if (J2eePlatform.TOOL_JSR109.equals(toolName)) {
+                return true;
+            }
             if (J2eePlatform.TOOL_WSCOMPILE.equals(toolName) 
                     || J2eePlatform.TOOL_APP_CLIENT_RUNTIME.equals(toolName) ) {
                 return true;

Note 1: This is just a quick'n'dirty fix. Correct one should perhaps contain better condition.
Note 2: One more fix is required on the WebSvc code side to allow creating JAX-WS web service if the target server is JBoss (version 4 and above) and Java EE spec level is J2EE 1.4 (could be the same condition as in case of creating JAX-WS web service on Tomcat 5.5)
Note 3: The following issues appears once it is allowed to create JAX-WS web service instead of the JAX-RPC one

  • User Required Action: for each web service user have to add following code into web.xml:
    <servlet>
        <servlet-name>/MyWebService</servlet-name>
        <servlet-class>org.acme.pkg.MyWebService</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>MyWebService</servlet-name>
        <url-pattern>/MyWebService</url-pattern>
    </servlet-mapping>


Current general issues

  • Test Web Service action is disabled if JBoss is the targed server for the module, we could enable that action and open browser at http://localhost:8080/jbossws/services - that's from where all WSDL files become available after the deployment


JAX-WS web services from WSDL

Expected steps to do:

  1. Create EJB/Web Module
  2. Create new Web Service from wsdl
  3. Add some operation to it (using Add operation action)
  4. Deploy the project
  5. Invoke Test Web Service action


Current general issues

  • Web service implementation class cannot be generated - generation fails with /somepath/EJBModule11/nbproject/jaxws-build.xml:17: taskdef class com.sun.tools.ws.ant.WsImport cannot be found (and some IAE, see {2} at the bottom - probably caused by some file missing on the classpath)
  • in the nbproject/private/private.properties there's set j2ee.platform.wscompile.classpath, but j2ee.platform.wsimport.classpath should be set instead for Java EE 5 projects (see also Note 2 in from Java case above and issue 117560) - not sure where this bug is - wheather in the JBoss plugin or in websvc code (needs to be investigated/evaluated)
  • once the j2ee.platform.wsimport.classpath property is set correctly - here's the patch for JBoss plugin:
Index: JBJ2eePlatformFactory.java
===================================================================
RCS file: /cvs/serverplugins/jboss4/src/org/netbeans/modules/j2ee/jboss4/ide/JBJ2eePlatformFactory.java,v
retrieving revision 1.17
diff -u -r1.17 JBJ2eePlatformFactory.java
--- JBJ2eePlatformFactory.java  27 Sep 2007 08:59:51 -0000      1.17
+++ JBJ2eePlatformFactory.java  3 Oct 2007 00:33:43 -0000
@@ -256,6 +256,35 @@
                     new File(root, "jaxrpc-impl.jar"),  // NOI18N
                 };
             }
+            if (J2eePlatform.TOOL_WSIMPORT.equals(toolName)) {
+                File root = new File(properties.getRootDir(), "client"); // NOI18N
+                return new File[] {
+                    new File(root, "activation.jar"),     // NOI18N
+                    new File(root, "getopt.jar"),    // NOI18N
+                    new File(root, "wstx.jar"),   // NOI18N
+                    new File(root, "jbossall-client.jar"),  // NOI18N
+                    new File(root, "log4j.jar"),     // NOI18N
+                    new File(root, "mail.jar"),    // NOI18N
+                    new File(root, "jbossws-spi.jar"),   // NOI18N
+                    new File(root, "jaxws-tools.jar"),  // NOI18N
+                    new File(root, "jaxws-rt.jar"),     // NOI18N
+                    new File(root, "stax-api.jar"),    // NOI18N
+                    new File(root, "jaxb-api.jar"),   // NOI18N
+                    new File(root, "jaxb-impl.jar"),  // NOI18N
+                    new File(root, "jaxb-xjc.jar"),   // NOI18N
+                    new File(root, "streambuffer.jar"),  // NOI18N
+                    new File(root, "stax-ex.jar"),    // NOI18N
+                    //for SunRI JAX-WS implementation uncomment this:
+                    //new File(root, "jbossws-sunri-client.jar"),   // NOI18N
+                    //and comment out following jars:
+                    new File(root, "javassist.jar"),  // NOI18N
+                    new File(root, "jboss-xml-binding.jar"),   // NOI18N
+                    new File(root, "jbossws-client.jar"),  // NOI18N
+                    new File(root, "jboss-jaxws.jar"),    // NOI18N
+                    new File(root, "jboss-jaxrpc.jar"),    // NOI18N
+                    new File(root, "jboss-saaj.jar")    // NOI18N
+                };
+            }
             if (J2eePlatform.TOOL_APP_CLIENT_RUNTIME.equals(toolName)) {
                 return new File(properties.getRootDir(), "client").listFiles(new FF()); // NOI18N
             }

wsimport definition target in nbproject/jaxws-build.xml needs to be changed to:

    <target name="wsimport-init" depends="init">
        ...
        <taskdef name="wsimport" classname="org.jboss.wsf.spi.tools.ant.WSConsumeTask">
            <classpath path="${j2ee.platform.wsimport.classpath}"/>
        </taskdef>
    </target>

and wsimport needs to tweaked so it does not contain xendorsed and extension attributes and contain keep="true" attribute, so the target itself looks like:

<wsimport keep="true" sourcedestdir="${build.generated.dir}/wsimport/service" verbose="true" destdir="${build.generated.dir}/wsimport/binaries" wsdl="${basedir}/${meta.inf}/xml-resources/web-services/Aaaa/wsdl/AddNumbers.wsdl" catalog="catalog.xml"/>
  • User required action: user have to invoke Refresh service action on the web service node after "tweaking" the build script:

Case A: if we will generate nbproject/jaxws-build.xml file we will document how to tweak that build script somewhere in the tutorial, wiki,...
Case B: if we won't generate nbproject/jaxws-build.xml file we will expect that the user will write it himself, or we will provide some template/sample samewhere in the tutorial, wiki...

  • Test Web Service action is disabled if JBoss is the targed server for the module, we could open browser at http://localhost:8080/jbossws/services - that's from where all WSDL files become available after the deployment

Note: If target server is set to JBoss5 (beta2 as of writting this) - which already supports - Java EE 5 - then everything seems to work correctly in case of creating web service from WSDL in Web module, because JAX-WS RI 2.1 library is somehow (incorrectly???) added to project libraries. In case of EJB module adding JAX-WS RI 2.1 library to the project does not help.

JAX-WS web service clients

Expected steps to do:

  1. Create EJB/Web Module
  2. Create new Web Service Client
  3. Create some EJB/Servlet
  4. Invoke Call Web Service Operation
  5. Deploy the project


Current general issues

  • issues and possible solutions are mostly the same as in case of creating web service from WSDL file (same tweaks are required)
  • the same note regarding adding JAX-WS RI library to the web project applies here as well



Stacktraces:
{1}: NPE:
java.lang.NullPointerException

       at org.netbeans.modules.websvc.design.multiview.DesignMultiViewElement.getToolbarRepresentation(DesignMultiViewElement.java:137)
at org.netbeans.core.multiview.MultiViewPeer.showCurrentElement(MultiViewPeer.java:296)
at org.netbeans.core.multiview.MultiViewPeer.showCurrentElement(MultiViewPeer.java:257)
at org.netbeans.core.multiview.MultiViewPeer$SelectionListener.selectionChanged(MultiViewPeer.java:659)
at org.netbeans.core.multiview.MultiViewModel.fireSelectionChanged(MultiViewModel.java:243)
at org.netbeans.core.multiview.MultiViewModel.setActiveDescription(MultiViewModel.java:115)
at org.netbeans.core.multiview.MultiViewModel$BtnGroup.setSelected(MultiViewModel.java:293)
at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton.java:215)


{2}: IAE:
SEVERE: Cannot create a QualIdent for org.duke.AddNumbersPortType
java.lang.IllegalArgumentException: Cannot create a QualIdent for org.duke.AddNumbersPortType

       at org.netbeans.modules.j2ee.common.source.GenerationUtils.createQualIdent(GenerationUtils.java:766)
at org.netbeans.modules.j2ee.common.source.GenerationUtils.addImplementsClause(GenerationUtils.java:729)
at org.netbeans.modules.websvc.core.JaxWsUtils$3.run(JaxWsUtils.java:317)
at org.netbeans.modules.websvc.core.JaxWsUtils$3.run(JaxWsUtils.java:403)
at org.netbeans.api.java.source.JavaSource.runModificationTask(JavaSource.java:827)
at org.netbeans.modules.websvc.core.JaxWsUtils.generateJaxWsImplClass(JaxWsUtils.java:406)
at org.netbeans.modules.websvc.core.JaxWsUtils.generateJaxWsImplementationClass(JaxWsUtils.java:137)

{catch} at org.netbeans.modules.websvc.core.jaxws.nodes.JaxWsChildren$6.modelCreated(JaxWsChildren.java:550)

       at org.netbeans.modules.websvc.api.jaxws.wsdlmodel.WsdlModeler.fireModelCreated(WsdlModeler.java:241)
at org.netbeans.modules.websvc.api.jaxws.wsdlmodel.WsdlModeler.access$200(WsdlModeler.java:50)
at org.netbeans.modules.websvc.api.jaxws.wsdlmodel.WsdlModeler$1.run(WsdlModeler.java:76)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986)