FYI.
In my Axis client I had the step:
service.getEngine().setOption(org.apache.axis.AxisEngine.PROP_SEND_XSI, new
Boolean(false));
This was causing a "problem" to the Array De-serializer.
So when I set the PROP_SEND_XSI to true, Array De-serializer was able to see
the Qname mapped to {urn:SimpleTest}SimplePhoneBean.
Looks like the PROP_SNED_XSI should be set to true for Array De-serializer
to work.
-Muthu
> -----Original Message-----
> From: Ramaswamy, Muthu
> Sent: Monday, November 18, 2002 10:45 AM
> To: '[EMAIL PROTECTED]'
> Subject: Help with De-serilization Problem
>
> Has anyone been able to de-serialize a java bean on the server side that
> contains List as one of its member?
>
> Is this a bug? Appreciate any input related to this matter.
>
> I did post question to the Axis user list but I didn't get any favorable
> reply.
>
> Thanks.,
>
> -----Original Message-----
> From: Ramaswamy, Muthu [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, November 17, 2002 2:21 PM
> To: '[EMAIL PROTECTED]'
> Subject: Help with List De-serializer problem.
>
>
> Hi All-
>
> When the List elements are referenced in the Java Bean, I get the
> ClassCastException in Beta 3 release. So I downloaded 1.0 release build
> hoping it would
> resolve the issue.
>
> Now I get:
>
> <faultstring>org.xml.sax.SAXException:
> SimpleDeserializer encountered a child element, which is NOT expected,
> in something it was trying to deserialize.</faultstring>
>
> Overview
> =======
> Client calls the echoBean method that takes a simple java bean containing
> list as parameter.
> The echoBean methods then prints the content of the java bean.
> When the method refers the List element, encounters ClassCastException.
>
> The method works when I execute from a a java client.
>
> Following are the sample codes related to service, 2 of the java beans,
> axis
> client rpc call and wsdd entry.
>
> (1) SimpleTest Service:
> =================
> package samples.userguide.myexample5;
>
> import java.util.ArrayList;
> import java.util.List;
>
> public class SimpleTest {
>
> public SimpleTest() {
> }
>
> public SimpleTestBean getBean()
> {
> SimpleTestBean myBean = new SimpleTestBean();
> myBean.setPhones(makeBeanList());
> return myBean;
> }
>
> public void echoBean(SimpleTestBean stb)
> {
> System.out.println("name is" + stb.getName()); //prints okay
> System.out.println("place is" + stb.getPlace()); //prints okay
> List myPhoneList = stb.getPhones();
>
> for (int i=0; i<myPhoneList.size(); i++)
> {
> SimplePhoneBean spb = (SimplePhoneBean) myPhoneList.get(i);
> //Throws ClassCastException ?????
> System.out.println("Printing Phone List");
> System.out.println(spb.getPhoneType() + ":" + spb.getPhoneNum());
> }
>
> }
>
> private ArrayList makeBeanList()
> {
> ArrayList myArr = new ArrayList();
> myArr.add(new SimplePhoneBean("Home", "123 456 7890"));
> myArr.add(new SimplePhoneBean("Work", "789 012 3456"));
> myArr.add(new SimplePhoneBean("Cell", "345 012 3456"));
> return myArr;
> }
>
> public static void main(String[] args) {
> SimpleTest simpleTest1 = new SimpleTest();
>
> SimpleTestBean stb = simpleTest1.getBean();
> stb.setPhones(simpleTest1.makeBeanList());
> simpleTest1.echoBean(stb);
> }
>
> }
>
> (2) SimpleTextBean java bean code
> ==========================
> package samples.userguide.myexample5;
>
> import java.util.ArrayList;
> import java.util.List;
>
> public class SimpleTestBean {
>
> private String name;
> private String place;
> private List phones;
>
> public SimpleTestBean() {
> name = "Your Name";
> place = "Your Place";
> }
>
> public void setName(String name)
> {
> this.name = name;
> }
>
> public String getName()
> {
> return this.name;
> }
>
> public void setPlace(String place)
> {
> this.place = place;
> }
>
> public String getPlace()
> {
> return this.place;
> }
>
> public List getPhones()
> {
> return this.phones;
> }
>
> public void setPhones(List phones)
> {
> this.phones = phones;
> }
>
> }
>
> (3) SimplePhoneBean java bean code
> ===========================
> package samples.userguide.myexample5;
>
> public class SimplePhoneBean {
>
> private String phoneType;
> private String phoneNum;
>
> public SimplePhoneBean()
> {
> }
>
> public SimplePhoneBean(String phoneType, String phoneNum)
> {
> this.phoneType = phoneType;
> this.phoneNum = phoneNum;
> }
>
> public void setPhoneType(String phoneType)
> {
> this.phoneType = phoneType;
> }
>
> public String getPhoneType()
> {
> return this.phoneType;
> }
>
> public void setPhoneNum(String phoneNum)
> {
> this.phoneNum = phoneNum;
> }
>
> public String getPhoneNum()
> {
> return this.phoneNum;
> }
> }
>
> (4) WSDD file
> ==========
> <service name="SimpleTest" provider="java:RPC">
> <parameter name="sendMultiRefs" value="false"/>
> <parameter name="sendXsiTypes" value="false"/>
> <parameter name="className"
> value="samples.userguide.myexample5.SimpleTest"/>
> <parameter name="allowedMethods" value="*"/>
> <beanMapping
> languageSpecificType="java:samples.userguide.myexample5.SimplePhoneBean"
> qname="ns1:SimplePhoneBean" xmlns:ns1="urn:SimpleTest"/>
> <beanMapping
> languageSpecificType="java:samples.userguide.myexample5.SimpleTestBean"
> qname="ns2:SimpleTestBean" xmlns:ns2="urn:SimpleTest"/>
> </service>
>
> (5) Axis Client rpc call
> =================
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope
> soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
> <soapenv:Body>
> <ns1:echoBean xmlns:ns1="SimpleTest">
> <SimpleTestBean>
> <name>Your Name</name>
> <phones SOAP-ENC:arrayType="xsd:any[3]">
> <item>
> <phoneType>Home</phoneType>
> <phoneNum>123 456 7890</phoneNum>
> </item>
> <item>
> <phoneType>Work</phoneType>
> <phoneNum>789 012 3456</phoneNum>
> </item>
> <item>
> <phoneType>Cell</phoneType>
> <phoneNum>345 012 3456</phoneNum>
> </item>
> </phones>
> <place>Your Place</place>
> </SimpleTestBean>
> </ns1:echoBean>
> </soapenv:Body>
> </soapenv:Envelope>
>
> (6) Error Stack
> ===========
> java.lang.ClassCastException:
> weblogic.apache.xerces.dom.DeferredElementNSImpl
> java.lang.ClassCastException:
> weblogic.apache.xerces.dom.DeferredElementNSImpl
> at
> samples.userguide.myexample5.SimpleTest.echoBean(SimpleTest.java:42)
> at java.lang.reflect.Method.invoke(Native Method)
> at
> org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.
> ava:308)
>
>
> Any help is grealty appreciated.
>
> Thanks.,
>
> -Muthu
>
>
>
>