This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic Proxy Client

 
Brian Smith
Ranch Hand
Posts: 232
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello MZ and other folks,
I have a question regarding dynamic proxy client. I have gotten stuck at the line where it says the following: (this line is copied from MZ's note)-


How do you get an access to HelloIF? Without an access to it, the code can't even compile. I know we can generate this stub from WSDL, but wouldn't that be similar to stub-based client? It would great if someone can explain to me this concept of getting access to HelloIF dynamically?

Thanks,
B
 
Karthik Rajendiran
Ranch Hand
Posts: 217
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a difference with which you get the service implementation( i.e class implementing the service interface and not the impl of end point interface)

In Static Stub
The class which implements Stub is vendor specific and we get the Port from that class

Where as in dynamic, we use service class (default implementation )is used to get the port (implementation class instance) to call the webservice method on it..

Hope i am clear. If not reply back, we can discuss.
 
Brian Smith
Ranch Hand
Posts: 232
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All I am asking is how do you get the HelloIF for a client to use? do you get it generated by webservice tools using WSDL?
Thanks.
 
ruijin yang
Ranch Hand
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Brian Smith:
All I am asking is how do you get the HelloIF for a client to use? do you get it generated by webservice tools using WSDL?
Thanks.


hey,

Hope this help(from www.xyzws.com):

1) Generated stub: Both Interface (WSDL) and implementation (stub) are created at compile time
2) Dynamic proxies: Interface (WSDL) is created at compile time while implementation (dynamic
proxy) created at runtime
3) Dynamic invocation interface (DII): Both interface (WSDL) and implementation are created at
runtime
 
Brian Smith
Ranch Hand
Posts: 232
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I completely understand all the theoritical aspects that you guys are saying here. Now here's what I am asking about. The following codes are taken from Mikalai Zaikin's notes which is a great notes.

This is an example of a Dynamic Proxy Client


Now look at this code line in bold. In order for this code to compile, there must exist HelloIF . My question is, how do we get this? do we generate it from WSDS at compile time as we NEED this for this code to compile. We can't wait until run time? Am I making sense here or I am missing something?
Thanks,
BR
 
ruijin yang
Ranch Hand
Posts: 96
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The following is from www.xyzws.com. I suggest you go to this website and read JAX-RPC section, you will understand.

Steps of coding and building Dynamic Proxy Client
1. Generate Service Endpoint Interface Class
1) runs wscompile with the -import option
2) reads the wsdl file provided by the Web service and generates the service endpoint interface class
2. Create Client Code
1. Creates a Service object
Service helloService = serviceFactory.createService(helloWsdlUrl,
new QName(nameSpaceUri, serviceName));
1) Service object is a factory for proxies
2) Service object itself is created from ServiceFactory object
3) Parameters of createService()
4) URL of the WSDL file
5) QName object
2. Create a proxy with a type of the service endpoint interface
dynamicproxy.HelloIF myProxy = (dynamicproxy.HelloIF)helloService.getPort(
new QName(nameSpaceUri,portName),
dynamicproxy.HelloIF.class);
1) HelloIF.class is generated by wscompile (at compile time)
2) The port name (HelloIFPort) is specified by the WSDL file
3. Compile Client Code with Service Endpoint Interface class CLASSPATH
4. Package Client to a jar file with SEI class.
[ March 06, 2007: Message edited by: ruijin yang ]
 
Brian Smith
Ranch Hand
Posts: 232
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're awesome, Ruijin ! This is what I was looking for. Thanks for taking your time to explain these steps. I wanted to reinforce my understanding that HelloIF is generated by wscompile at compile time!

Originally posted by ruijin yang:

dynamicproxy.HelloIF myProxy = (dynamicproxy.HelloIF)helloService.getPort(
new QName(nameSpaceUri,portName),
dynamicproxy.HelloIF.class);
1) HelloIF.class is generated by wscompile (at compile time)
2) The port name (HelloIFPort) is specified by the WSDL file
3. Compile Client Code with Service Endpoint Interface class CLASSPATH
4. Package Client to a jar file with SEI class.


I appreciate your help!
Thank you,
 
Karthik Rajendiran
Ranch Hand
Posts: 217
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, really useful.
 
vasu venki
Greenhorn
Posts: 19
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes really very useful ruijin
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic