2011-11-04 1 views
7

JAX-WS WSDLに場所(schemaLocationsoap:addresslocation)を設定できますか?
以下のサンプルを展開すると、 'servername'はlocalhostになり、 'serverport'はWebアプリケーションのローカルポート番号になります。JAX-WS WSDLを使用して、実行時のschemaLocationとsoap:addressの場所を変更しました。

ただし、これらをサービスにリダイレクトするプロキシサーバー名とサーバーポートに再構成したいとします。これは可能なのですか?どのように達成できますか?

展開環境は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

あなたが同じプロトコルを使用する場合(あなたがmod_proxyを使用している場合例えばProxyPreserveHost Onを使用)、これは、あなたのURLを修正する必要がありますあなたの要求に元ホスト名を維持する場合。プロキシがhttpshttpの間で切り替わる場合、問題がまだ発生する可能性があります。

+1

httpsとhttpの切り替えは、HTTP要求パラメータXを設定することによって処理される環境プロキシの-Forwarded-Proto。 – Drunix

関連する問題