本文介绍了使用JAX-WS更改运行时生成的WSDL中的schemaLocation和soap:address位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以配置位置( schemaLocation soap:地址 location )在JAX-WS WSDL中?

当我部署下面的示例时,'servername'将是localhost,'serverport'将是Web应用程序的本地端口号。

Is it possible to configure the location (schemaLocation and soap:address location) in a JAX-WS WSDL?
When I deploy the sample below, 'servername' would be localhost and 'serverport' would be the local port number for the web application.

但是,我想将这些重新配置为代理服务器名称和重定向到服务的服务器端口。这是可能的,我将如何实现?

However, I want to reconfigure these to be a proxy servername and serverport which redirects to the service. Is this possible and how would I achieve it?

部署环境是Tomcat和Apache。

The deployment environment is Tomcat and Apache.

我有以下服务类:

@WebService
public class AuthenticationService {
....
public AuthenticationService(){}

@WebMethod
    public AuthenticationResult checkAuthentication(
        @WebParam(name = "authentication") Authentication authentication,
        @WebParam(name = "privilege") Privilege privilege) {
    ....
}
}

运行时,WSDL如下所示:

When ran, the WSDL looks like this:

<definitions targetNamespace="http://authentication.service.ws.ijs/" name="AuthenticationServiceService">
<types>

    <xsd:schema>
        <xsd:import namespace="http://authentication.service.ws.ijs/" schemaLocation="http://servername:serverport/WebAppName/AuthenticationService?xsd=1"/>
    </xsd:schema>
</types>

<message name="checkAuthentication">
    <part name="parameters" element="tns:checkAuthentication"/>
</message>

<message name="checkAuthenticationResponse">
    <part name="parameters" element="tns:checkAuthenticationResponse"/>
</message>

<portType name="AuthenticationService">

    <operation name="checkAuthentication">
        <input wsam:Action="http://authentication.service.ws.ijs/AuthenticationService/checkAuthenticationRequest" message="tns:checkAuthentication"/>
        <output wsam:Action="http://authentication.service.ws.ijs/AuthenticationService/checkAuthenticationResponse" message="tns:checkAuthenticationResponse"/>
    </operation>

</portType>

<binding name="AuthenticationServicePortBinding" type="tns:AuthenticationService">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>

    <operation name="checkAuthentication">
        <soap:operation soapAction=""/>

        <input>
            <soap:body use="literal"/>
        </input>

        <output>
            <soap:body use="literal"/>
        </output>
    </operation>

</binding>

<service name="AuthenticationServiceService">

    <port name="AuthenticationServicePort" binding="tns:AuthenticationServicePortBinding">
        <soap:address location="http://servername:serverport/WebAppName/AuthenticationService"/>
    </port>
</service>
</definitions>

我们非常感谢任何帮助。

Any help would be greatly appreciated.

推荐答案

如果您在请求中保留原始主机名(例如,如果您使用<$,则使用 ProxyPreserveHost On c $ c> mod_proxy )如果你使用相同的协议,这应该修复你的URL。如果您的代理在 https http 之间切换,您可能仍会遇到问题。

If you keep the original hostname in your request (e.g use ProxyPreserveHost On if you use mod_proxy) this should fix your URLs, if you use the same protocol. You may still have problems if your proxy switches between https and http.

这篇关于使用JAX-WS更改运行时生成的WSDL中的schemaLocation和soap:address位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 06:09