users@glassfish.java.net

Re: Get web service address from within a webservice

From: V B Kumar Jayanti <Vbkumar.Jayanti_at_Sun.COM>
Date: Tue, 18 Sep 2007 14:49:40 +0530

Hi,

    I just tried this

    @Resource WebServiceContext wsContext;
    /**
     * Web service operation
     */
    @WebMethod
    public String operation(@WebParam(name = "arg") String arg) {
        System.out.println("Hello " + arg);
        EndpointReference ref = wsContext.getEndpointReference();
        System.out.println(ref.toString());
     }

  And it prints the following :

   <EndpointReference
xmlns="http://www.w3.org/2005/08/addressing"><Address>http://localhost:8080/WebApplication1/NewWebServiceService</Address><ReferenceParameters/><Metadata/></EndpointReference>

   so maybe you extract the Address part in there.

Thanks.
glassfish_at_javadesktop.org wrote:

>I have a web service A with an address of http://localhost:8080/WebService/WebServicePort.
>I want to send this address or even the wsdl location to Web Service B from within Web Service A.
>Is there a way to get this value from the environment at runtime.
>
>Thanks
>Stephen
>[Message sent by forum member 'qwaihd' (qwaihd)]
>
>http://forums.java.net/jive/thread.jspa?messageID=235245
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>