在 Wildfly 中更改 WSDL 路径

Changing the WSDL Path in Wildfly

我将我的应用程序从 JBoss 5.1.0 GA 迁移到 WildFly 8.2.0。迁移到 WildFly 后加载 WSDL 时遇到问题。

在 Jboss 5.1.0 中,我的 Jboss WSDL 位置是 http://localhost:8080/project-ear-project-ejb/ProjectService?wsdl 并且我的 UI 框架是基于给定路径构建的。

迁移到 WildFly 后,我得到的 WSDL 路径为 http://localhost:8080/project-ejb/projectService/project?WSDL。这里的 projectService 是 servicename,project 是 @Webservice Annotation 的 name 属性。

@WebService(name = "project", serviceName = "projectService").

我看过一些 wildfly 文档,但没有找到任何针对上述案例的文档。 wildlfy有没有办法按照上述要求更改WSDL地址。

在ejb module-META-INF中添加jboss-webservices.xml文件,并在xml中配置需要的路径。在上面的例子中,xml 看起来像

<?xml version="1.0" encoding="UTF-8"?>
<webservices xmlns="http://www.jboss.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee   http://www.jboss.com/xml/ns/javaee/jbossws-web-services_1_0.xsd"
version="1.1">
 <context-root>project-ear-project-ejb</context-root>
 <port-component>
 <ejb-name>ProjectService</ejb-name>
 <port-component-name>ProjectService</port-component-name>
 <port-component-uri>/ProjectService</port-component-uri>
 </port-component>
</webservices>