users@jax-rpc.java.net

Re: DII, Dynamic proxies and JavaBeans

From: Sasi Kala <sasikala_jmk_at_YAHOO.COM>
Date: Tue, 06 Aug 2002 08:50:22 -0600

Hi,

   What is the difference between the DII and dynamic proxy? The example what you mentioned is DII example, right? I read that in Dynamic Proxy model, no remote interface and client side stubs are required. I know that using the 'Call' class if we access the services then it is JAX-RPC DII. How the Dynamic proxy is different from the DII. Please anybody can send me some small sample client programs?

Regards,
Sasikala.


On Sat, 3 Aug 2002 15:36:17 -0400, Sam <bytecode_at_PHREAKER.NET> wrote:

>Nope. Doeesnt work.
>
>I tried both, where a method returns an array of JavaBean objects
>and were a method accepts a JavaBean object.
>
>I have set addParameter setParameter in both.
>
>In the former case, the SOAP response is accurate but the client gives
>a no serializer found. In teh second case the cilent gives the same
>error without sending the SOAP request.
>
>In short, the client is looking for serializers and de-serializers
>for JavaBean objects in DII
>
>/s
>
>
>
>
>Phil Goodwin wrote:
>>
>> Ah, I see what's going on, or at least some of it. Because you specified
>> a WSDL file the system is trying to do the equivalent of addParameter
>> and setReturnType for you. That's why it won't allow you to call these
>> methods yourself. The fact that the system isn't finding or creating a
>> serializer for the types specified in the WSDL is disturbing. It
>> indicates that there is either a problem with the WSDL or a bug in the
>> system. I will check into the former possibility during the week next
>> week. We might also want to look at the WSDL file. In the meantime you
>> can solve your problem by not specifying the WSDL when you create your
>> Service object and using long form of addParameter and setReturnType to
>> manually set the expected types. Let me know if that works for you.
>>
>> Sam wrote:
>>
>> >Tried that. Here is what happens.
>> >
>> >Exception in thread "main" cannot set parameter or return types on this
>> >Call object
>> > at
>> >com.sun.xml.rpc.client.dii.BasicCall.checkIsParameterAndReturnTypeSpecAllowed(BasicCall.java:328)
>> > at
>> >com.sun.xml.rpc.client.dii.BasicCall.setReturnType(BasicCall.java:163)
>> > at DIIClient_WSDL.main(DIIClient_WSDL.java:69)
>> >
>> >
>> >/s
>> >
>> >
>> >
>> >Phil Goodwin wrote:
>> >
>> >>You need to call addParameter() and setReturnType() in order for this
>> >>call to work. Let me know if you need additional information.
>> >>
>> >>Sam wrote:
>> >>
>> >>>Here you go.
>> >>>
>> >>>/s
>> >>>
>> >>>
>> >>>
>> >>>====================================
>> >>>
>> >>>
>> >>>import javax.xml.rpc.Call;
>> >>>import javax.xml.rpc.Service;
>> >>>import javax.xml.rpc.ParameterMode;
>> >>>import javax.xml.rpc.ServiceFactory;
>> >>>import java.net.URL;
>> >>>
>> >>>public class TestClient{
>> >>>
>> >>>
>> >>> public static void main(String[] args) throws Exception {
>> >>>
>> >>> String url= "http://127.0.0.1:9090/hello/hello.wsdl";
>> >>> String namespace = "http://hello.com/";
>> >>> String serviceName = "HelloService";
>> >>>
>> >>> ServiceFactory factory = ServiceFactory.newInstance();
>> >>> Service service = (Service) factory.createService(new
>> >>>URL(url),new QName(namespace,serviceName));
>> >>>
>> >>> QName portName = new QName(namespace,"HelloPort");
>> >>> QName operationName = new QName(namespace,"sayHello");
>> >>>
>> >>> Call call = service.createCall(portName, operationName);
>> >>>
>> >>> Test t = new Test();
>> >>> t.setValue("hello duke");
>> >>>
>> >>> Object[] params = {t};
>> >>>
>> >>> String answer= (String)call.invoke(params);
>> >>> System.out.println("Last payment was " + answer);
>> >>>
>> >>>
>> >>> }
>> >>>}
>> >>>
>> >>>
>> >>>
>> >>>public class Test {
>> >>>
>> >>>private String value="default";
>> >>>
>> >>>public Test(){}
>> >>>
>> >>>public String getValue() {
>> >>>return value;
>> >>>}
>> >>>
>> >>>public void setValue(String value){
>> >>> this.value=value;
>> >>> }
>> >>>
>> >>>
>> >>>====================================
>> >>>
>> >>>
>> >>>Phil Goodwin wrote:
>> >>>
>> >>>>Sam, can you re-post the client code for this. I believe I can help you.
>> >>>>
>> >>>>Sam wrote:
>> >>>>
>> >>>>>The spes dont require beans to be Serializable. If this was
>> >>>>>the case ,it wouldnt work with static stubs either.
>> >>>>>
>> >>>>>/s
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>>Manoj Kumar wrote:
>> >>>>>
>> >>>>>>try changing the first line to the following
>> >>>>>>
>> >>>>>>public class Test implements Serializable {
>> >>>>>>
>> >>>>>>hope this will work
>> >>>>>>
>> >>>>>>thnaks & regards,
>> >>>>>>Manoj
>> >>>>>>
>> >>>>>>"bytecode_at_phreaker.net" wrote:
>> >>>>>>
>> >>>>>>>I agree. And thats what it is. The beans I m passing are very simple Here
>> >>>>>>>is an example
>> >>>>>>>
>> >>>>>>>public class Test {
>> >>>>>>>
>> >>>>>>>private String value="default";
>> >>>>>>>
>> >>>>>>>public Test(){}
>> >>>>>>>
>> >>>>>>>public String getValue() {
>> >>>>>>>return value;
>> >>>>>>>}
>> >>>>>>>
>> >>>>>>>public void setValue(String value){
>> >>>>>>> this.value=value;
>> >>>>>>> }
>> >>>>>>>}
>> >>>>>>>
>> >>>>>>>Why do I need to specify Typemappings for thsi and write
>> >>>>>>>serializer/deserializers when I use DII or Dynamic proxies ??
>> >>>>>>>
>> >>>>>>>Is this a bug in the implementation???
>> >>>>>>>
>> >>>>>>>/sam
>> >>>>>>>
>> >>>>>>>Original Message:
>> >>>>>>>-----------------
>> >>>>>>>From: Manoj Kumar m.kumar_at_oracle.com
>> >>>>>>>Date: Sun, 28 Jul 2002 13:31:27 +0530
>> >>>>>>>To: bytecode_at_Phreaker.net
>> >>>>>>>Subject: Re: DII, Dynamic proxies and JavaBeans
>> >>>>>>>
>> >>>>>>>Sam,
>> >>>>>>> There are some restrictions which a javabean must conform to.
>> >>>>>>>
>> >>>>>>>1) It must have a public default constructor
>> >>>>>>>2) It must not implement (either directly or indirectly) the
>> >>>>>>>java.rmi.Remote interface
>> >>>>>>>3) Its fields muct be supported JAX-RPC types
>> >>>>>>>4) It must impkements Serializable Interface.
>> >>>>>>>
>> >>>>>>>Thanks
>> >>>>>>>Manoj
>> >>>>>>>
>> >>>>>>>Sam wrote:
>> >>>>>>>
>> >>>>>>>>I give up and now i m totally clueless.
>> >>>>>>>>
>> >>>>>>>>Tried DII and Dynamic proxy with a simple JavaBean as
>> >>>>>>>>the return type.
>> >>>>>>>>
>> >>>>>>>>I keep getting this error
>> >>>>>>>>
>> >>>>>>>>no serializer is registered for (null, {http://hello.com}MyBean)
>> >>>>>>>>
>> >>>>>>>>What do I do ? I thought JAX-RPC was supposed to marshall/unmarshall
>> >>>>>>>>simple JavaBeans because they were a built in type.
>> >>>>>>>>
>> >>>>>>>>Any ideas or example code would be appreciated
>> >>>>>>>>
>> >>>>>>>>Thanks
>> >>>>>>>>/s
>> >>>>>>>>
>> >>>>>>>--
>> >>>>>>> _____________________________________________________
>> >>>>>>> /) (\
>> >>>>>>> / ) Manoj Kumar Email: m.kumar_at_oracle.com ( \
>> >>>>>>>_( (| Oracle India Ltd Phone: 91 40 3122600-3507 |) )_
>> >>>>>>>(((\ \_____________________________________________________/ /)))
>> >>>>>>>(\\\\ \_// \\_/ ////)
>> >>>>>>>\ / \ /
>> >>>>>>>\ / \ /
>> >>>>>>>/ / \ \
>> >>>>>>>
>> >>>>>>>--------------------------------------------------------------------
>> >>>>>>>mail2web - Check your email from the web at
>> >>>>>>>http://mail2web.com/ .
>> >>>>>>>
>> >>>>>>--
>> >>>>>> _____________________________________________________
>> >>>>>> /) (\
>> >>>>>> / ) Manoj Kumar Email: m.kumar_at_oracle.com ( \
>> >>>>>>_( (| Oracle India Ltd Phone: 91 40 3122600-3507 |) )_
>> >>>>>>(((\ \_____________________________________________________/ /)))
>> >>>>>>(\\\\ \_// \\_/ ////)
>> >>>>>>\ / \ /
>> >>>>>>\ / \ /
>> >>>>>>/ / \ \
>> >>>>>>
>> >>>>--
>> >>>>-----------------------------------------------------------------------
>> >>>>Phil Goodwin, Java Software, Sun Microsystems, 408.276.7090, or x17090
>> >>>>
>> >>>>For a bowl of water give a goodly meal;
>> >>>>For a kindly greeting bow thou down with zeal;
>> >>>>For a simple penny pay thou back with gold;
>> >>>>If thy life be rescued, life do not withhold.
>> >>>>Thus the words and actions of the wise regard;
>> >>>>Every little service tenfold they reward.
>> >>>>But the truly noble know all men as one,
>> >>>>And return with gladness good for evil done.
>> >>>>
>> >>--
>> >>-----------------------------------------------------------------------
>> >>Phil Goodwin, Java Software, Sun Microsystems, 408.276.7090, or x17090
>> >>
>> >>For a bowl of water give a goodly meal;
>> >>For a kindly greeting bow thou down with zeal;
>> >>For a simple penny pay thou back with gold;
>> >>If thy life be rescued, life do not withhold.
>> >>Thus the words and actions of the wise regard;
>> >>Every little service tenfold they reward.
>> >>But the truly noble know all men as one,
>> >>And return with gladness good for evil done.
>> >>
>>
>> --
>> -----------------------------------------------------------------------
>> Phil Goodwin, Java Software, Sun Microsystems, 408.276.7090, or x17090
>>
>> For a bowl of water give a goodly meal;
>> For a kindly greeting bow thou down with zeal;
>> For a simple penny pay thou back with gold;
>> If thy life be rescued, life do not withhold.
>> Thus the words and actions of the wise regard;
>> Every little service tenfold they reward.
>> But the truly noble know all men as one,
>> And return with gladness good for evil done.