Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change schemaLocation and soap:address location in runtime generated WSDL with JAX-WS

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.

like image 912
noddy Avatar asked Nov 04 '11 01:11

noddy


People also ask

How do I change the Webpoint endpoint URL?

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.

What is JAX WS ri?

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.


1 Answers

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.

like image 88
Drunix Avatar answered Nov 14 '22 14:11

Drunix