• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Dynamic Proxy Client

 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, really useful.
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes really very useful ruijin
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic