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?
The deployment environment is Tomcat and Apache.
I have the following service class:
@WebService
public class AuthenticationService {
....
public AuthenticationService(){}
@WebMethod
public AuthenticationResult checkAuthentication(
@WebParam(name = "authentication") Authentication authentication,
@WebParam(name = "privilege") Privilege privilege) {
....
}
}
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.
Use the WSDL to get the endpoint URL. The second option is to get the endpoint URL from the WSDL. ... URL newEndpoint = new URL("NEW_ENDPOINT_URL"); QName qname = new QName("http://ws.mycompany.tld","EchoService"); EchoService service = new EchoService(newEndpoint, qname); Echo port = service.
JAX-WS RI 2.3. 1 is a Web Services framework that provides tools and infrastructure to develop Web Services solutions for the end users and middleware developers. With JAX-WS RI 2.3. 1, clients and web services have a big advantage: the platform independence of the Java programming language.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With