The Source for Java Technology Collaboration

Home » java.net Forums » GlassFish » Metro and JAXB

Thread: web services client - dynamic invocation

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 7 - Last Post: Aug 28, 2007 6:33 AM by: ankitkinra
geertmonsieur

Posts: 3
web services client - dynamic invocation
Posted: Apr 22, 2007 11:24 AM
 
  Click to reply to this thread Reply

Dear

Thanks for reading my first post on this forum.
I was wondering how one can create a Java client that consumes a web service of which the WSDL location or file is only available at run time?

Thanks in advance!

Greetings
Geert

wierob

Posts: 126
Re: web services client - dynamic invocation
Posted: Apr 23, 2007 5:42 AM   in response to: geertmonsieur
 
  Click to reply to this thread Reply

Hi

see Create a dynamic Service here https://jax-ws.dev.java.net/nonav/2.1.1rc1/docs/dispatch.html



If you mean how to change the endpoint address on a (from wsdl) generated client proxy at run time: you can set the wsdl location in the constructor of the client proxy (just look at the generated code).

hope that helps

geertmonsieur

Posts: 3
Re: web services client - dynamic invocation
Posted: Apr 23, 2007 5:59 AM   in response to: wierob
 
  Click to reply to this thread Reply

Thanks for the feedback!
I read the following on the mentioned web page:

Prepare the message request.

This is the client developer's responsibility. For examples of how to prepare specific request types refer to the Dispatch<T> sample applications.


If I'm correct this means you still need to build the SOAP messages manually in stead of generating it based on the web services structure defined in the WSDL file (like that is the case for static invocation).

travis_73

Posts: 4
Re: web services client - dynamic invocation
Posted: May 2, 2007 3:17 AM   in response to: geertmonsieur
 
  Click to reply to this thread Reply

I all,
I have the same problem of geertmonsieur...I want to realese a dynamic service invocation where "dynamic" means I want change the wsdl file and immediatly invoke it without building stub...to do this I would use dispatch mechanism but to do this I have to build manually the soap message. It is possible if I parse the schema inside the wsdl file and the n I build the soap message with attention, because the soap message structure must be different if (style=document use=literal) or if(style=rpc use=encoded).
Is there some api that hel me to build soap message from wsdl?

Thanks in advance...

wierob

Posts: 126
Re: web services client - dynamic invocation
Posted: May 2, 2007 3:47 AM   in response to: travis_73
 
  Click to reply to this thread Reply

If you don't like to build the SOAP yourself you need to genereate client proxy from wsdl with wsimport. You can still change the servcie/wsdl lacation in this approach as mentioned above.

If you realy need to use the dispatch mechanisem then you must construct the SOAP yourself. It might be possible to use JAXB to assist in generating correct SOAP from java objects

geertmonsieur

Posts: 3
Re: web services client - dynamic invocation
Posted: May 2, 2007 3:55 AM   in response to: wierob
 
  Click to reply to this thread Reply

Thanks wierob for your answer!
Summarized, it means one can only consume web services dynamically if you build the SOAP message manually (with the help of the JAXB). Calling wsimport at runtime isn't possible, I guess?

wierob

Posts: 126
Re: web services client - dynamic invocation
Posted: May 2, 2007 5:15 AM   in response to: geertmonsieur
 
  Click to reply to this thread Reply

You're welcome!

So your wsdl is only available at runtime? If not you can generate the proxy beforehand and than change the address.

Anyway wsimport is a script that calls the com.sun.tools.ws.WsImport class so I guess it is possible to execute this script programmatically in your application or even use the class directly. Sounds like a lot of work ;) good luck

ankitkinra

Posts: 1
Re: web services client - dynamic invocation
Posted: Aug 28, 2007 6:32 AM   in response to: wierob
 
  Click to reply to this thread Reply

I'm stuck in the same problem, and me being a beginner facing a lot of problem. please help.Thanks in advance..

Message was edited by: ankitkinra




 XML java.net RSS