2011-11-04 26 views
7

Có thể định cấu hình vị trí (schemaLocationsoap:addresslocation) trong WSDL của JAX-WS không?
Khi tôi triển khai mẫu bên dưới, 'servername' sẽ là localhost và 'serverport' sẽ là số cổng cục bộ cho ứng dụng web.Thay đổi vị trí địa lý và xà phòng: địa chỉ trong thời gian chạy được tạo WSDL với JAX-WS

Tuy nhiên, tôi muốn định cấu hình lại đây là tên máy chủ proxy và máy chủ chuyển hướng đến dịch vụ. Điều này có khả thi không và tôi sẽ đạt được điều đó như thế nào?

Môi trường triển khai là Tomcat và Apache.

Tôi có lớp dịch vụ sau:

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

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

Khi chạy, WSDL trông như thế này:

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

Bất kỳ trợ giúp sẽ được đánh giá rất nhiều.

+0

Để ghi đè điểm cuối, hãy xem http://stackoverflow.com/questions/2490737/how-to-change-webservice-url-endpoint – prunge

Trả lời

7

Nếu bạn giữ gốc hostname trong yêu cầu của bạn (ví dụ sử dụng ProxyPreserveHost On nếu bạn sử dụng mod_proxy) này nên sửa URL của bạn, nếu bạn sử dụng cùng một giao thức. Bạn vẫn có thể gặp sự cố nếu proxy của bạn chuyển đổi giữa httpshttp.

+1

Chuyển đổi giữa https và http có thể trong một số môi trường được xử lý bằng cách đặt tham số yêu cầu HTTP X -Forwarded-Proto trên proxy. – Drunix

Các vấn đề liên quan