How to change address location of JAX-WS webservice

This allows setting the endpoint in the client:

MYGateway service = new MYGateway();
MYGatewaySoapServiceHttpPort port = service.getMYGatewaySoapServiceHttpPort();
BindingProvider bp = (BindingProvider) port;
bp.getRequestContext().put(
    BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
    "http://xx.xx.xx.xx/myservice/MYGateway");

(thanks to user FoGH for pointing out that the endpoint should indicate the service, not the WSDL)

EDIT: here is some more information about setting up the org.codehaus.mojo.jaxws-maven-plugin:

In your pom.xml:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>MyGateway</id>
            <goals>
                <goal>wsimport</goal>
            </goals>
            <configuration>
                <wsdlDirectory>src/main/resources/META-INF/wsdl</wsdlDirectory>
                <wsdlFiles>
                    <wsdlFile>MyGateway.wsdl</wsdlFile>
                </wsdlFiles>
                <wsdlLocation>MyGatewaySystemId</wsdlLocation>
                <!-- Line below to avoid regeneration bug if you have multiple executions -->   
                <staleFile>${project.build.directory}/jaxws/stale/wsdl.MyGateway.done</staleFile>
            </configuration>
        </execution>
    </executions>
</plugin>

In ./src/main/resources/META-INF/jax-ws-catalog.xml:

<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
    <system systemId="MyGatewaySystemId" uri="wsdl/MyGateWay.wsdl"/>
</catalog>

Put your WSDL in ./src/main/resources/META-INF/wsdl/MyGateway.wsdl

So the wsdlLocation in the plugin configuration refers to an entry in the jax-ws-catalog.xml file. This file points to the actual WSDL file using a relative directory notation.

The value 'MyGatewaySystemId' ends up in the generated web service code as the location. So you could change this to the actual URL of the WSDL. Note that you would need configure your pom to set the correct URL for the build environment (dev, test, prod) for this to work consistently. A pointer in the right direction for this is to use maven profiles.

Tip: an easy way to download a copy of an online WSDL (and related XSD's) is to create a SoapUI project for it and then go to the 'WSDL content' tab.


We missed very basic point, servlet mapping in web.xml did all trick. for details please find below link

http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.wsfep.multiplatform.doc%2Finfo%2Fae%2Fae%2Ftwbs_customwebxml.html