是否可以在JAX-WS WSDL中配置位置(schemaLocation
和soap:address
location
)?
當我部署下面的示例中,「服務器名稱」是本地主機和「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>
任何幫助將不勝感激。
重寫端點,請參閱http://stackoverflow.com/questions/2490737/how-to-change-webservice-url-endpoint – prunge