users@jax-rpc.java.net

Re: DII, Dynamic proxies and JavaBeans

From: Phil Goodwin <Phil.Goodwin_at_Sun.COM>
Date: Fri, 02 Aug 2002 13:36:46 -0700

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.