Saturday, June 12, 2010

axis2 EndpointReference

To point your Axis2 client stub to any server:

    private static final String SERVER_NAME = "localhost:7001";

    private static final String TARGET_ENDPOINT = "http://" + SERVER_NAME + "//GEO_OSB_Portal/PS/GeoOsbServicePS";



    /**
     * Return a valid instance of a Stub, ready to invoke methods
     * @return
     * @throws AxisFault
     */
    private GeoOsbServiceStub getStub() throws AxisFault {
        GeoOsbServiceStub stub = new GeoOsbServiceStub();
        EndpointReference targetEpr = new EndpointReference(TARGET_ENDPOINT);
        stub._getServiceClient().setTargetEPR(targetEpr );
        return stub;
    }

No comments: