2

I have a JAX-WS Web Service packed in an EAR, deployed to WebSphere v7. The EAR contains:
- APP-INF directory: classes directory (.class files in the right package hierarchy) plus the lib dir with required jars
- META-INF dir
- the war with empty WEB-INF and META-INF dirs and a HelloWorld index.html

I have two classes:

@WebService
public interface Service {}

and:

@WebService
public class ServiceImpl implements Service {
    @WebMethod
    public String test(String who) {
        return("Hello " + who + "!");
    }
}

(The jars in the lib dir are required for the business logic, I just replaced the logic with a simple hello + who).

I've deployed the EAR in WAS v7, now I'd like to test it using SOAP UI. I've set the context root for:
/service
during deployment.

Where can I find the generated WSDL's and it's address / what will be the endpoint?

I'm totally new to this, a useful JAX-WS on WAS v7 complete tutorial link would be fine also. I couldn't find any, although I've been googling for hours now...

Paul Vargas
  • 41,222
  • 15
  • 102
  • 148
Kumite
  • 2,129
  • 3
  • 15
  • 15

1 Answers1

3

When you don't directly defined, by default, the JAX-WS runtime adds the suffix Service to the class that implements the service, although this is not a rule for all runtimes. If you want get the deployed WSDL, try

http://localhost:9080/service/ServiceImplService?wsdl

Or

http://localhost:9080/service/ServiceImplService/ServiceImplService.wsdl

If you want to change the pattern URL

@WebService(serviceName = "EchoService")
public class ServiceImpl implements Service {
    @WebMethod
    public String test(String who) {
        return ("Hello " + who + "!");
    }
}

Try

http://localhost:9080/service/EchoService?wsdl

See more in the IBM Redbook - Application Server V7.0. Web Services Guide

UPDATE

If you want to deploy an EAR in WAS, the basic structure is:

TestEAR.ear
|   TestWeb.war
|
\---META-INF
        MANIFEST.MF

The structure for the WAR file into this EAR is:

TestWeb.war
+---META-INF
|       MANIFEST.MF
|
\---WEB-INF
    |   ibm-web-bnd.xml
    |   ibm-web-ext.xml
    |   web.xml
    |
    +---classes
    |   \---org
    |       \---paulvargas
    |           \---test
    |               |   Service.class
    |               |   ServiceImpl.class
    |               |
    |               \---jaxws
    |                       Test.class
    |                       TestResponse.class
    |
    \---lib

The files ibm-web-xxx.xml are optionals for this example. The MANIFEST.MF only have:

Manifest-Version: 1.0
Class-Path: 

The files Test.class and TestResponse.class (for the operaration test in the WSDL document file) are generated by the wsgen tool, with a similar command to:

wsgen -cp . org.paulvargas.test.ServiceImpl

And the web.xml contains:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <display-name>TestWeb</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
</web-app>

The wsdlLocation for this is:

http://localhost:9080/TestWeb/ServiceImplService/ServiceImplService.wsdl

See more:

Paul Vargas
  • 41,222
  • 15
  • 102
  • 148
  • I still can't get the wsdl. – Kumite May 01 '13 at 17:32
  • Thanks for the answer, but I still can't get the wsdl. My webapp is there, it shows me my welcome index.html's content when entering the url ending with the ctxroot in a browser. My ear contains: meta-inf with manifest and a war. the war contains: meta-inf (+ manifest), an index.html and a WEB-INF. WEB-INF has the web.xml with the welcome file. – Kumite May 01 '13 at 17:46
  • And there's the classes directory, under the war's web-inf dir. In the classes: a wsdl and an xsd, both generated by websphere v7's wsGen tool: [link](http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Ftwbs_devwbsjaxws_step4.html) And also the directories by the java packages, so as it should be. In the annotated Service class' package, there's a jaxws directory with .classes, also generated by the wsgen tool. The classes have the same name as my webservice's methods (Test.class), and also the response classes, they are complex. – Kumite May 01 '13 at 17:49
  • If you are using Rational Application Developer, don't need you generate artifacts using `wsgen` tool. Only need the `@WebService` annotation in your class. WAS generate the artifacts automatically. – Paul Vargas May 01 '13 at 18:59
  • I only have Eclipse and ant. I have a Websphere server added to Eclipse, but it says: "A managed (federated) WebSphere Application Server Network Deployment environment is not supported.", so I deploy the EAR created by an ant task through the admin console. – Kumite May 01 '13 at 21:59
  • See my updated answer. I have included something similar to your code. – Paul Vargas May 03 '13 at 03:31