Kumite
Kumite

Reputation: 2149

Calling JAX-WS Web Services on WebSphere v7 with SOAP UI

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...

Upvotes: 2

Views: 8560

Answers (1)

Paul Vargas
Paul Vargas

Reputation: 42010

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:

Upvotes: 3

Related Questions