JAX-WS未列出WAS 8.5.5下的服务

时间:2016-03-21 11:35:43

标签: java jax-ws ibm-was

我按照本指南在WAS上启用了第三方JAX-WS:http://www.ibm.com/support/knowledgecenter/SSAW57_8.0.0/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/twbs_thirdparty.html?cp=SSAW57_8.0.0%2F3-3-0-25-10-1

这是我的pom的一部分:

    ...
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>2.2.1</version>
    </dependency>
    ...
    <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-war-plugin</artifactId>              
         <configuration>
            <archive>
               <manifestEntries>
                  <DisableIBMJAXWSEngine>true</DisableIBMJAXWSEngine>
               </manifestEntries>
            </archive>
         </configuration>               
   </plugin>
   <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>jaxws-maven-plugin</artifactId>
         <version>1.10</version>
         <executions>
             <execution>
             <phase>process-classes</phase>
             <goals>
                 <goal>wsgen</goal>
              </goals>
              </execution>
         </executions>
         <configuration>
              <sei>com.example.myService</sei>
              <genWsdl>true</genWsdl>
              <keep>true</keep>
              <resourceDestDir>${basedir}/src/main/webapp/WEB-INF/wsdl</resourceDestDir>
              <sourceDestDir>${basedir}/src/main/java</sourceDestDir>
         </configuration>
   </plugin>

myService.java:

@WebService(
        targetNamespace = "...", 
        name = "...", 
        serviceName = "...")
public class MyService { 
   @WebMethod
    public String req1() {
       return "";
    }   
}

WEB-INF / web.xml中

<?xml version="1.0" encoding="UTF-8"?>
<web-app>
   <display-name>Archetype Created Web Application</display-name>
    <listener>
         <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
    </listener>

   <servlet>
          <servlet-name>...</servlet-name> 
          <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
   </servlet>
   <servlet-mapping>
          <servlet-name>...</servlet-name>
          <url-pattern>/...</url-pattern>
   </servlet-mapping>

WEB-INF /太阳jaxws.xml

<?xml version='1.0' encoding='UTF-8'?>
<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'>
    <endpoint name='...' implementation='com.example.myService' url-pattern='/...' ></endpoint>
</endpoints>

正确禁用注释,wsgen生成工件和WEB-INF / wsdl文件夹。

我还创建了这个WEB_INF / webservices.xml:

<webservices>
    <webservice-description>
        <webservice-description-name>...</webservice-description-name>
        <wsdl-file>WEB-INF/wsdl/....wsdl</wsdl-file>
         <port-component>
            <port-component-name>...</port-component-name>
            <service-endpoint-interface>com.example.myService</service-endpoint-interface>
            <service-impl-bean>
                <servlet-link>...</servlet-link> 
            </service-impl-bean>
        </port-component>
    </webservice-description>
</webservices> 

这个配置在tomcat和weblogic下工作,但是在8.5.5(使用父上一个策略)下没有公开任何服务。 WebSphere控制台显示“没有错误&#39;:

[21/03/16 12.08.37:379 CET] 00000096 http          I   WSSERVLET12: JAX-WS context listener initializing
[21/03/16 12.08.39:371 CET] 00000096 monitoring    I   Metro monitoring rootname successfully set to: null
[21/03/16 12.08.39:602 CET] 00000096 http          I   WSSERVLET14: JAX-WS servlet initializing

1 个答案:

答案 0 :(得分:0)

在禁用WAS JAX-WS引擎后,WAS不会在已部署的应用程序中检测和构建Web服务工件。然后JAX-WS服务不会在WAS管理控制台上列出,这是预期的行为。 除了没有列出服务外,是否有任何错误? 我发现Web服务DD文件名不正确,应该是webservices.xml。

此致 杨