You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by ha...@alberg.stph.net on 2000/12/14 05:25:28 UTC

Serialize

hello,
this is hari kishan babu, i am using apache.soap, when i am trying to send
any Image Object from Server to the Client i am get some error, it says
that proper serializer and Deserializer are not there, can anybody please
tell me where can i get these Serialize and Deserialize Classess, i need
them badly, please give me the reply soon.
thanks in advance
Hari Kishan Babu Charagundla





Re: Serialize

Posted by Mathias Laguérie <ml...@softeam.fr>.
You have many problems :
In th deployementDescriptor file :
- In line 6 : replace line
<isd:java class="samples.addressbook.AdressBook" static="false"/> by
<isd:java class="samples.addressbook.Exchange" static="false"/>. so your
SOAP Server know which class provider it must instaciate.
- In line 11 : replace line
javaType="babu.hari" by
javaType="samples.addressbook.hari". So your SOAP Server know
the class of the object it must serialize to send at the client.

In hari.java file
- you must add the accessor of the attribute name :
public setName(String name)
    {
    this.name=name;
    }
- you must add the default constructor
public hari()
    {
    this.name=null;  // or this.name=""; . as You want.
    }
It is necessary, to indicate at the SOAP Server how it
can instanciate the returned object.

In the client.java file
- be careful you made a mistake in line 29. Replace :
new QName("urn:xml-soap-exchange-emo", "hari"), by
new QName("urn:xml-soap-exchange-demo", "hari"),
- You must add to your call the new mapping types
in line 36 add this instruction :
call.setSOAPMappingRegistry(smr);

I attach the new files
Mathias


harikishan@alberg.stph.net a écrit :

> hello,
> this is hari kishan babu, i am using apache.soap, when i am trying to send
> any Image Object from Server to the Client i am get some error, it says
> that proper serializer and Deserializer are not there, can anybody please
> tell me where can i get these Serialize and Deserialize Classess, i need
> them badly, please give me the reply soon.
> thanks in advance
> Hari Kishan Babu Charagundla

Re: Serialize

Posted by Mathias Laguérie <ml...@softeam.fr>.
I have been using Apache SOAP for few days, so I'm not sure that my answer
will be interesting.
I had the similary problem with deserializer and serializer.
I resolved this problem when I did this step.
In deployementDescriptor file, you must put a map tag as follow :
<isd:mappings>
    <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:x="urn:xml-soap-address-demo" qname="x:objtest"
             javaType="samples.clientserver.ObjTest"

java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"

xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
  </isd:mappings>
when you do that, you tell to the SOAP Server what class it can use to
serialize the object samples.clientserver.ObjTest. (you must change
samples.clientserver.ObjTest by your image class name)
After that, your client must have means to deserialize your ObjTest. to do
that you can write in your client this lines :
  String encodingStyleURI = "http://schemas.xmlsoap.org/soap/encoding/";
  URL url     = new URL("http://omo:8080/soap/servlet/rpcrouter");
  SOAPMappingRegistry smr = new SOAPMappingRegistry();
  BeanSerializer beanSer  = new BeanSerializer();

  smr.mapTypes(Constants.NS_URI_SOAP_ENC,
                 new QName("urn:xml-soap-address-demo", "objtest"),
                 ObjTest.class, beanSer, beanSer);

  Call call = new Call();
  call.setSOAPMappingRegistry(smr);
  call.setTargetObjectURI("urn:ClientServer");
  call.setMethodName("getObjTest");
  call.setEncodingStyleURI(encodingStyleURI);

  Response resp;
  try
   {
   resp = call.invoke(url, "");
   }
  catch (SOAPException e)
   {
   System.err.println("Caught SOAPException (" +
    e.getFaultCode() + "): " +
    e.getMessage());
    return;
   }
Mathias

harikishan@alberg.stph.net a écrit :

> hello,
> this is hari kishan babu, i am using apache.soap, when i am trying to send
> any Image Object from Server to the Client i am get some error, it says
> that proper serializer and Deserializer are not there, can anybody please
> tell me where can i get these Serialize and Deserialize Classess, i need
> them badly, please give me the reply soon.
> thanks in advance
> Hari Kishan Babu Charagundla

Re: Serialize

Posted by Mathias Laguérie <ml...@softeam.fr>.
You have many problems :
In th deployementDescriptor file :
- In line 6 : replace line
<isd:java class="samples.addressbook.AdressBook" static="false"/> by
<isd:java class="samples.addressbook.Exchange" static="false"/>. so your
SOAP Server know which class provider it must instaciate.
- In line 11 : replace line
javaType="babu.hari" by
javaType="samples.addressbook.hari". So your SOAP Server know
the class of the object it must serialize to send at the client.

In hari.java file
- you must add the accessor of the attribute name :
public setName(String name)
    {
    this.name=name;
    }
- you must add the default constructor
public hari()
    {
    this.name=null;  // or this.name=""; . as You want.
    }
It is necessary, to indicate at the SOAP Server how it
can instanciate the returned object.

In the client.java file
- be careful you made a mistake in line 29. Replace :
new QName("urn:xml-soap-exchange-emo", "hari"), by
new QName("urn:xml-soap-exchange-demo", "hari"),
- You must add to your call the new mapping types
in line 36 add this instruction :
call.setSOAPMappingRegistry(smr);

I attach the new files
Mathias


harikishan@alberg.stph.net a écrit :

> hello,
> this is hari kishan babu, i am using apache.soap, when i am trying to send
> any Image Object from Server to the Client i am get some error, it says
> that proper serializer and Deserializer are not there, can anybody please
> tell me where can i get these Serialize and Deserialize Classess, i need
> them badly, please give me the reply soon.
> thanks in advance
> Hari Kishan Babu Charagundla

Re: Serialize

Posted by Mathias Laguérie <ml...@softeam.fr>.
I have been using Apache SOAP for few days, so I'm not sure that my answer
will be interesting.
I had the similary problem with deserializer and serializer.
I resolved this problem when I did this step.
In deployementDescriptor file, you must put a map tag as follow :
<isd:mappings>
    <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:x="urn:xml-soap-address-demo" qname="x:objtest"
             javaType="samples.clientserver.ObjTest"

java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"

xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
  </isd:mappings>
when you do that, you tell to the SOAP Server what class it can use to
serialize the object samples.clientserver.ObjTest. (you must change
samples.clientserver.ObjTest by your image class name)
After that, your client must have means to deserialize your ObjTest. to do
that you can write in your client this lines :
  String encodingStyleURI = "http://schemas.xmlsoap.org/soap/encoding/";
  URL url     = new URL("http://omo:8080/soap/servlet/rpcrouter");
  SOAPMappingRegistry smr = new SOAPMappingRegistry();
  BeanSerializer beanSer  = new BeanSerializer();

  smr.mapTypes(Constants.NS_URI_SOAP_ENC,
                 new QName("urn:xml-soap-address-demo", "objtest"),
                 ObjTest.class, beanSer, beanSer);

  Call call = new Call();
  call.setSOAPMappingRegistry(smr);
  call.setTargetObjectURI("urn:ClientServer");
  call.setMethodName("getObjTest");
  call.setEncodingStyleURI(encodingStyleURI);

  Response resp;
  try
   {
   resp = call.invoke(url, "");
   }
  catch (SOAPException e)
   {
   System.err.println("Caught SOAPException (" +
    e.getFaultCode() + "): " +
    e.getMessage());
    return;
   }
Mathias

harikishan@alberg.stph.net a écrit :

> hello,
> this is hari kishan babu, i am using apache.soap, when i am trying to send
> any Image Object from Server to the Client i am get some error, it says
> that proper serializer and Deserializer are not there, can anybody please
> tell me where can i get these Serialize and Deserialize Classess, i need
> them badly, please give me the reply soon.
> thanks in advance
> Hari Kishan Babu Charagundla