Hi,
Are Data1 and Data2 beans as well? If not, you need to use an appropriate
serializer (maybe write a custom serializer for them) and register that
with the mapping registry. If they are beans what you have should work.
If you still have problems, could you post the error along with all the
information given by the TcpTunnelGui?
Nirmal.
[EMAIL PROTECTED]
To: [EMAIL PROTECTED]
07/19/2001 cc:
10:38 AM Subject: Re: SOAP mapping of a bean with
vectors
Please respond
to soap-user
Hi,
My beans have all getter and setter methods for their fields and some
further public methods for modifiying the fields.
I tried to use the SOAP mapping registry, but I cannot find my error.
I deployed the mappings to the server:
<isd:mappings>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:x="urn:SOAPTest" qname="x:MyBean"
javaType="com.ts.distributed_apps.MyBean"
java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:x="urn:SOAPTest" qname="x:Data1"
javaType="com.ts.distributed_apps.Data1"
java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:x="urn:SOAPTest" qname="x:Data2"
javaType="com.ts.distributed_apps.Data2"
java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
</isd:mappings>
------------------------------------------------------------------
And my client:
URL url = new URL("http://localhost:8081/soap/servlet/rpcrouter");
// Build the call.
Call call = new Call();
call.setTargetObjectURI("urn:SOAPTest");
call.setMethodName("server3");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
// Create the type mapping registry
SOAPMappingRegistry smr = new SOAPMappingRegistry();
BeanSerializer beanSer = new BeanSerializer();
// Map the types.
smr.mapTypes(
Constants.NS_URI_SOAP_ENC,
new QName "urn:SOAPTest", "com.ts.distributed_apps.MyBean"),
com.ts.distributed_apps.MyBean.class,
beanSer,
beanSer);
smr.mapTypes(
Constants.NS_URI_SOAP_ENC,
new QName("urn:SOAPTest", "com.ts.distributed_apps.Data1"),
com.ts.distributed_apps.Data1.class,
beanSer,
beanSer);
smr.mapTypes(
Constants.NS_URI_SOAP_ENC,
new QName("urn:SOAPTest", "com.ts.distributed_apps.Data2"),
com.ts.distributed_apps.Data2.class,
beanSer,
beanSer);
// and tell the Call object to use it..
call.setSOAPMappingRegistry(smr);
// Set the Parameters
Vector params = new Vector();
params.addElement(
new Parameter(
"MyBean",
com.ts.distributed_apps.MyBean.class,
soapTest,
null)); //soapTest is my bean
call.setParams(params);
// Invoke the call.
Response resp = null;
try
{
resp = call.invoke(url, "");
}
Any suggestion, what I´m coding wrong?
regards,
Darko
> Hi,
>
> You will need to register serializers and deserializers for the Data1 and
> Data2 classes with the SOAP mapping registry; once you do that
> BeanSerializer should be able to handle the MyBean class (assuming that
> it
> has all the properties of a bean, including the required setters and
> getters...)
>
> Nirmal.
>
>
>
>
>
>
>
> Hello,
>
> I´m a newbee and I´m trying to use a bean for a RPC. My bean has so
> me
> protected String values with 2 Vector classes. Each Vector holds only o
> ne
> type of
> Objects.
> Example:
> public class MyBean
> {
> protected String test1;
> protected String test2;
> protected String test3;
> protected String test4;
> protected Vector collection1; //a collection of Data1
> protected Vector collection2; //a collection of Data2
> }
>
> public class Data1
> {
> protected java.lang.String Link;
> protected java.lang.String LinkName;
> }
>
> public class Data2
> {
> protected java.lang.String data;
> protected java.lang.String type;
> }
>
> Is it possible to serialize and deserialize the bean? I´ve read in th
> e API,
> that the VectorSerializer isn´t able to deserialize the Vector.
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
GMX Tipp:
Machen Sie Ihr Hobby zu Geld bei unserem Partner 1&1!
http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a