2011-11-04 25 views
7

是否可以在JAX-WS WSDL中配置位置(schemaLocationsoap:addresslocation)?
當我部署下面的示例中,「服務器名稱」是本地主機和「serverport」將是Web應用程序的本地端口號。使用JAX-WS更改運行時生成的WSDL中的schemaLocation和soap:address位置

不過,我要重新配置這些是代理服務器名和serverport其重定向到該服務。這是可能的,我將如何實現它?

部署環境的Tomcat和Apache。

我有以下服務類:

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

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

當跑時,WSDL看起來是這樣的:

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

任何幫助將不勝感激。

+0

重寫端點,請參閱http://stackoverflow.com/questions/2490737/how-to-change-webservice-url-endpoint – prunge

回答

7

如果保持原始主機名在您的要求(例如使用ProxyPreserveHost On如果使用mod_proxy)這應該解決您的網址,如果你使用相同的協議。您可能仍然有問題,如果您的代理之間HTTPSHTTP切換。

+1

https和http之間的切換可以在某些環境中通過設置HTTP請求參數X代理上的-Forwarded-Proto。 – Drunix

相關問題