开发者

WebServices client - Dynamic proxy versus Stubs created with wconsume

I created a Web Service using JaxWs. I belive that exist two ways to consume a web service in the client.

  1. using wconsume e putting the generated classes as stubs in the client.
  2. using Dynamic Proxy, whitch means, there wil be no files to be send to client as stubs.

I imagine that the only advantage of this approach is that if the wsdl changed, there will be not need to generat stubs files. However it doesn't look too practical, as I will probably need to change something in the client code and recompiled anyway. I didn't use this tecnichy yet. I found this option when I was reaserching the reason why I need to generate proxy file when developping Java client but I didn't when I using .Net.

Then, I have two question:

  1. What's the difference between stubs and Dynamic Proxy tecnich?
  2. Why .Net client doesn't need proxies files?开发者_运维问答 Or is there the files automaticlly generated and I don't know where to find? Am I loosing performance or security when using stubs versus dynamic proxy?


1.What's the difference between stubs and Dynamic Proxy tecnich?

JAX-RPC is deprecated.
The new standard is JAX-WS.
JAX-WS allows programmers to invoke a web service, as if they were making a local method call.
For this to happen a standard mapping from WSDL to Java has been defined.
This mapping correlates a wsdl:port definition with a Java Interface which is called Service Endpoint Interface (SEI).
The SEI is the Java representation of the web service endpoint.
At runtime JAX-WS creates an instance of a SEI that can be used to make web service calls by simply making method calls on the SEI.
Now the way used to create an instance of a SEI is via the dynamic proxy class.
It is called dynamic proxy since it is created dynamically.
No stubs are need to implement a proxy, but the SEI must already have been implemented in order to be used.
The proxy uses/is based on the stub classes to function, which have been generated by the WSDL.
So the stubs are a prerequisite.
So there is no separation of techniques as you say in your post.
You have misunderstood the concept

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜