Thanks for replying. Here are the details you requested:

1. Employee class
2. DeploymentDescriptor.xml

To recreate the problem please code a simple server which returns an
Employee containing subordinates (Vector of Employee). This would cause
stack overflow. In my case server side implementation is Weblogic 6.0.
If you would like, I could make a tar/zip ball and send it to you as
attachment.
I can tell you that it is not a case of simple cyclic reference since
subordinates contained
strictly other employees (not self). It definitely is a case of graph (may
contain cycles)-- which you
stated is not handled in Apache Soap 2.2. This could be stated in bean
serializer documentation.

Regards,
Soumen.

Employee class
==============
public class Employee implements Serializable
{
    // not null
    public String name;

    // null if no manager
    public Employee manager;

    // null if no subordinates,this is a Employee Vector
    public Vector subordinates;

    // not null
    public String ssn;

    public double salary;

    // null if no dependents
    public Dependent[] dependents;

    public Employee()
    {
    }
    public Employee(String name,Employee manager,Employee[]
subordinates,String ssn,double salary,Dependent[] dependents)
    {
        this.name = name;
        this.manager = manager;
        this.subordinates = subordinates;
        this.ssn = ssn;
        this.salary = salary;
        this.dependents = dependents;
    }
    public String getName()
    {
        return name;
    }
    public void setName(String name)
    {
        this.name = name;
    }
    public Employee getManager()
    {
        return manager;
    }
    public void setManager(Employee manager)
    {
        this.manager = manager;
    }
    public Vector getSubordinates()
    {
        return subordinates;
    }
    public void setSubordinates(Vector subordinates)
    {
        this.subordinates = subordinates;
    }
    public String getSsn()
    {
        return ssn;
    }
    public void setSsn(String ssn)
    {
        this.ssn = ssn;
    }
    public double getSalary()
    {
        return salary;
    }
    public void setSalary(double salary)
    {
        this.salary = salary;
    }
    public Dependent[] getDependents()
    {
        return dependents;
    }
    public void setDependents(Dependent[] dependents)
    {
        this.dependents = dependents;
    }
    public String toString()
    {
        String retVal = "Employee" + "\n";
        retVal += "{" + "\n";
        retVal += "name = " + name + "\n";
        retVal += "ssn = " + ssn + "\n";
        retVal += "salary = " + salary + "\n";
        retVal += "manager = " + manager + "\n";
        if(subordinates!= null)
        {
            retVal += "Subordinates are:";
            for(int i = 0; i < subordinates.size(); ++i)
            {
                retVal += subordinates.elementAt(i)+ "\n";
            }
        }

        if(dependents!= null)
        {
            retVal += "Dependents are:";
            for(int i = 0; i < dependents.length; ++i)
            {
                retVal += dependents[i]+ "\n";
            }
        }

        retVal += "}" + "\n";
        return retVal;
    }
}

public class Dependent implements Serializable
{
    public String name;
    public int age;
    public String relationship;

    public Dependent(String name,int age,String relationship)
    {
        this.name = name;
        this.age = age;
        this.relationship = relationship;
    }
    public Dependent()
    {
    }
    public String getName()
    {
        return name;
    }
    public void setName(String name)
    {
        this.name = name;
    }
    public int getAge()
    {
        return age;
    }
    public void setAge(int age)
    {
        this.age = age;
    }
    public String getRelationship()
    {
        return relationship;
    }
    public void setRelationship(String relationship)
    {
        this.relationship = relationship;
    }
    public String toString()
    {
        String retVal = "Dependent" + "\n";
        retVal += "{" + "\n";
        retVal += "name = " + name + "\n";
        retVal += "age = " + age + "\n";
        retVal += "relationship = " + relationship + "\n";
        retVal += "}" + "\n";

        return retVal;
    }
}

DeploymentDescriptor.xml
========================
<?xml version="1.0"?>
<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment";
             id="urn:EmployeeFetcher">
  <isd:provider type="org.apache.soap.providers.StatelessEJBProvider"
                scope="Application"
                methods="getSubordinates addEmployee removeEmployees
getManagers getManager assignEmployee">
    <isd:java class="AnotherEmployeeSLBean.EmployeeSession"/>
    <isd:option key="JNDIName" value="Employee" />
    <isd:option key="FullHomeInterfaceName"
value="AnotherEmployeeSLBean.EmployeeSessionHome" />
    <isd:option key="ContextProviderURL" value="t3://localhost:7001" />
    <isd:option key="FullContextFactoryName"
value="weblogic.jndi.WLInitialContextFactory" />
 
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListene
r>
    </isd:provider>

<isd:mappings>
    <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
             xmlns:x="urn:xml-soap-employee-demo" qname="x:employee"
             javaType="AnotherEmployeeSLBean.Employee"
 
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:xml-soap-employee-demo" qname="x:dependents"
             javaType="AnotherEmployeeSLBean.Dependent"
 
java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
 
xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
  </isd:mappings>

</isd:service>


-----Original Message-----
From: Sanjiva Weerawarana [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 12, 2001 8:17 PM
To: [EMAIL PROTECTED]
Subject: Re: Bugs in Soap 2.2 BeanSerializer?


The bean serializer is only a convenience serializer intended to
help you out when it does what you are seeking. When it doesn't
do what you want, you have to write a serializer yourself. One
of the bean serializers limitations is that it does not serialize
graphs - i.e., it does not generate id/idref stuff. Not hard to
do, but that's not what the bean serializer do. If you'd like to
do it and contribute the code we'll all be happy.

That said, we will always fix any real bugs. Can you please post
your *bean* data type? What you posted as Employee is not a bean.
Also post your SOAPMappingRegistry lines or the deployment
descriptor (if its on the server side).

I'm curious as to why what you did caused a stack overflow in
any case; so if you can post a full example I'll try to make it
print a better error for that case.

Sanjiva.

Reply via email to