users@glassfish.java.net

Re: Can ACC tell my client where it's servlet is located?

From: Bhakti Mehta <Bhakti.Mehta_at_Sun.COM>
Date: Tue, 16 Dec 2008 12:24:43 -0800

Assuming you have your endpoint deployed at an address
you use wsimport to generate client side artifacts and then
You can either use as Tim suggested @WebserviceRef
or use Proxy as I am showing below in your client

   FooService service = new FooService();
   FoorPort port = service.getFooPort();

This link has some information and scripts so you can modify that code
as well to try to get the BindingProvider's endpoint address
http://blogs.sun.com/enterprisetechtips/entry/referencing_multiple_web_services_from

Regards,
Bhakti
    
Markus Karg wrote:
> Well... in my client, how to get "port"?
>
>
>> -----Original Message-----
>> From: Bhakti.Mehta_at_Sun.COM [mailto:Bhakti.Mehta_at_Sun.COM]
>> Sent: Dienstag, 16. Dezember 2008 20:26
>> To: users_at_glassfish.dev.java.net
>> Subject: Re: Can ACC tell my client where it's servlet is located?
>>
>> I think this should work for you in your client
>>
>> Map requestContext = ((BindingProvider)port).getRequestContext();
>> String address =
>> requestContext.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY));
>>
>> Regards,
>> Bhakti
>> Markus Karg wrote:
>>
>>> In fact I do have a web service. But it is not JAX-WS but JAX-RS
>>> instead... :-(
>>>
>>>
>>>
>>> If I would have a @WebService annotated Stateless Session Bean, could
>>> that session bean know it's own server's hostname and pass back to
>>>
>> the
>>
>>> client? If that would work, this would be a simple workaround, since
>>> obviously the JAX-RS service and the @WebService would be located on
>>> the same host.
>>>
>>>
>>>
>>> Thanks
>>>
>>> Markus
>>>
>>>
>>>
>>> *From:* Timothy.Quinn_at_Sun.COM [mailto:Timothy.Quinn_at_Sun.COM]
>>> *Sent:* Dienstag, 16. Dezember 2008 16:17
>>> *To:* users_at_glassfish.dev.java.net
>>> *Subject:* Re: Can ACC tell my client where it's servlet is located?
>>>
>>>
>>>
>>> Markus Karg wrote:
>>>
>>> I have an EAR. It contains a standalone Swing client to be run in
>>>
>> ACC,
>>
>>> and a servlet to be run on the host. The Swing client wants to access
>>> the servlet using simple URL().getContent(). So the client needs to
>>> know the hostname or IP address of the host. Since it was a single
>>> deploy action of one EAR in theory ACC could know that hostname or
>>> address. But is there a "clean" way (i. e. no special GlassFish
>>> tricks) how my client can ask the ACC for this address? Or do I have
>>> to manually set some deployment descriptor environment entries?
>>>
>>> There is no standard Java EE way for the client code to get this
>>> information. There is not even a good GlassFish-specific way (at
>>> least none I can think of) to do this reliably.
>>>
>>> I would think you would not want to build this information into the
>>> deployment descriptor because that means the descriptor would need to
>>> change as the app is deployed to different systems.
>>>
>>> One option: pass the servlet's URL as a command-line argument to the
>>> client. The ACC itself will not do anything with it except pass it
>>>
>> on
>>
>>> to the client logic which can do what it wants with the data.
>>>
>>> Another possibility: Deploy a web service and access the web service
>>> instead of the servlet from the client. You can then take advantage
>>> of injection to resolve the web service address. Just a thought.
>>>
>>> - Tim
>>>
>>>
>>>
>>> Thanks!
>>>
>>> Markus
>>>
>>>
>>>
>>> QUIPSY QUALITY GmbH & Co. KG
>>>
>>> Ein Unternehmen der MES-Gruppe
>>>
>>> Stuttgarter Strasse 23
>>>
>>> D-75179 Pforzheim
>>>
>>> Tel: 07231-9189-52
>>>
>>> Fax: 07231-9189-59
>>>
>>> www.quipsy.de <http://www.quipsy.de>
>>>
>>> karg_at_quipsy.de <mailto:karg_at_quipsy.de>
>>>
>>> Registergericht Mannheim HRA 701214
>>>
>>> Geschäftsführer: Nils Schroeder
>>>
>>>
>>>
>>> Diese E-Mail enthält persönliche, vertrauliche und vor Weitergabe
>>> geschützte Informationen und ist ausschließlich für den vorgesehenen
>>> o.g. Empfänger (Adressaten) bestimmt. Falls Sie diese E-Mail
>>> versehentlich erhalten haben und nicht der vorgesehene Empfänger
>>>
>> sind,
>>
>>> bitten wir Sie, die E-Mail und deren Anhänge nicht aufzubewahren,
>>> nicht zu vervielfältigen, nicht zu nutzen und nicht weiterzugeben.
>>> Bitte informieren Sie uns als Absender über diesen Zustellungsfehler
>>> und löschen Sie die E-Mail.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>
>> <mailto:users-unsubscribe_at_glassfish.dev.java.net>
>>
>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>
>> <mailto:users-help_at_glassfish.dev.java.net>
>>
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>