如何更改 WSDL soap 地址位置,特别是 url 的上下文部分?
How to change WSDL soap address location , in particular the context part of the url?
这里我使用java第一种方法来创建网络服务。
我在 JBOSS EAP 6.0 中使用端点 api Endpoint.publish(address,SampleWebService)
公开了使用 JAX-WS 的 Web 服务。
无论我在上述发布方法中为地址字段提供什么值,都没关系,即,我没有看到它的影响。
SampleWebService
以上是我的 Web 服务实现 class。
部署 war 文件后,我将在以下位置生成 WSDL 文件。
%JBOSS_HOME%/standalone/data/wsdl/MyProjectName-1.0-SNAPSHOT.war
上面生成的 WSDL 文件包含 soap:address location = "http://localhost:8080/MyProjectName-1.0-SNAPSHOT/SampleWebService?wsdl"/>
@webService(serviceName="SampleWebService")
public class SampleWebService {
//Implementation specific logic
}
有什么方法可以更改上下文,即在 soap 地址位置中使用 MyProjectName 而不是 MyProjectName-1.0-SNAPSHOT,这样最终的 soap 地址位置将如下所示
soap:address location =
"http://localhost:8080/MyProjectName-1.0-SNAPSHOT/SampleWebService?wsdl"/>
回答我自己的问题。
All i wanted is to change the root context name so that i can provide
my own name instead of default war file name (complete name of the war
file excluding .war extension)
为了更改 war 文件的根上下文,我需要在驻留在我的网络应用程序的 WEB-INF 文件夹中的 jboss-web.xml 文件中指定上下文名称。
多亏了这个 changing context root name post 它帮助我找到了适合我的案例的解决方案。
现在jboss-webapp.xml包含以下内容:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web 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.org/j2ee/schema/jboss-web_5_1.xsd">
<context-root>MyProjectName</context-root>
</jboss-web>
以上更改帮助我获得了所需的 soap 地址位置 url。
即 <soap:address location="http://localhost:8080/MyProjectName/SampleWebService?wsdl" />
这里我使用java第一种方法来创建网络服务。
我在 JBOSS EAP 6.0 中使用端点 api Endpoint.publish(address,SampleWebService)
公开了使用 JAX-WS 的 Web 服务。
无论我在上述发布方法中为地址字段提供什么值,都没关系,即,我没有看到它的影响。
SampleWebService
以上是我的 Web 服务实现 class。
部署 war 文件后,我将在以下位置生成 WSDL 文件。
%JBOSS_HOME%/standalone/data/wsdl/MyProjectName-1.0-SNAPSHOT.war
上面生成的 WSDL 文件包含 soap:address location = "http://localhost:8080/MyProjectName-1.0-SNAPSHOT/SampleWebService?wsdl"/>
@webService(serviceName="SampleWebService")
public class SampleWebService {
//Implementation specific logic
}
有什么方法可以更改上下文,即在 soap 地址位置中使用 MyProjectName 而不是 MyProjectName-1.0-SNAPSHOT,这样最终的 soap 地址位置将如下所示
soap:address location = "http://localhost:8080/MyProjectName-1.0-SNAPSHOT/SampleWebService?wsdl"/>
回答我自己的问题。
All i wanted is to change the root context name so that i can provide my own name instead of default war file name (complete name of the war file excluding .war extension)
为了更改 war 文件的根上下文,我需要在驻留在我的网络应用程序的 WEB-INF 文件夹中的 jboss-web.xml 文件中指定上下文名称。
多亏了这个 changing context root name post 它帮助我找到了适合我的案例的解决方案。
现在jboss-webapp.xml包含以下内容:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web 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.org/j2ee/schema/jboss-web_5_1.xsd">
<context-root>MyProjectName</context-root>
</jboss-web>
以上更改帮助我获得了所需的 soap 地址位置 url。
即 <soap:address location="http://localhost:8080/MyProjectName/SampleWebService?wsdl" />