Chris,

Thanks for the reply. I discovered what the problem was. You were right. The
vector was being returned empty. I was populating it from a database. My SQL
statement was incorrect. I fixed it and recompiled the service. However, I
kept getting an empty vector. When I restarted Apache and Tomcat, my
recompiled service was loaded and it worked. Does SOAP cache classes? Is
there a way to refresh? Thanks again.

Chris

----------
From: "Chris Means" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: RE: Empty Vector Returned
Date: Tue, Nov 27, 2001, 7:37 AM


Chris,

I agree, it looks like it's working fine, you'd likely get an error message
if something wasn't actually working syntactically.

I'd guess that getAllEmployees just doesn't have any data to return.

Try modifying the server endpoint for that routine and hardcode in some
Employee objects into the returned Vector.  If you still don't get any data,
then there's likely a mapping problem...but from the looks of it, however
you're populating the return Vector probably just doesn't have any data to
fill it with.

Can you show us how you're populating the Vector?

-Chris
-----Original Message-----
From: Chris Orloff [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 27, 2001 1:28 AM
To: [EMAIL PROTECTED]
Subject: Empty Vector Returned

Hi,

I have two services, both return vectors of objects. The first, called
getAllDepartments(), returns Department objects. The second
getAllEmployees() returns Employee objects. Both Department and Employee are
very simple classes, containing private data and get and set methods.

When I call getAllDepartment(), the return message is:

HTTP/1.0 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 798
Set-Cookie2: JSESSIONID=lshg4z3g81;Version=1;Discard;Path="/soap"
Set-Cookie: JSESSIONID=lshg4z3g81;Path=/soap
Servlet-Engine: Tomcat Web Server/3.2.3 (JSP 1.1; Servlet 2.2; Java 1.2.2;
Windows 95 4.10 x86; java.vendor=Sun Microsystems Inc.)

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/1999/XMLSchema";>
<SOAP-ENV:Body>
<ns1:getAllDepartmentsResponse xmlns:ns1="urn:Personnel"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<return xmlns:ns2="http://xml.apache.org/xml-soap"; xsi:type="ns2:Vector">
<item xsi:type="ns1:com.transync.data.Department">
<ID xsi:type="xsd:int">1</ID>
<name xsi:type="xsd:string">Marketing</name>
</item>
<item xsi:type="ns1:com.transync.data.Department">
<ID xsi:type="xsd:int">2</ID>
<name xsi:type="xsd:string">Finance</name>
</item>
</return>
</ns1:getAllDepartmentsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This is perfect, great, just what I want. However, when I call
getAllEmployees(), I get this message:

HTTP/1.0 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 520
Set-Cookie2: JSESSIONID=6awmcg3jz1;Version=1;Discard;Path="/soap"
Set-Cookie: JSESSIONID=6awmcg3jz1;Path=/soap
Servlet-Engine: Tomcat Web Server/3.2.3 (JSP 1.1; Servlet 2.2; Java 1.2.2;
Windows 95 4.10 x86; java.vendor=Sun Microsystems Inc.)

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/1999/XMLSchema";>
<SOAP-ENV:Body>
<ns1:getAllEmployeesResponse xmlns:ns1="urn:Personnel"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<return xmlns:ns2="http://xml.apache.org/xml-soap"; xsi:type="ns2:Vector">
</return>
</ns1:getAllEmployeesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

It's empty. I wrote a test driver for my service to make sure it is
returning something, and it is. Here's the mapping code in the client:

    SOAPMappingRegistry smr = new SOAPMappingRegistry();
    BeanSerializer beanSer = new BeanSerializer();

    smr.mapTypes(Constants.NS_URI_SOAP_ENC,
                 new QName("urn:Personnel", "com.transync.data.Employee"),
                 com.transync.data.Employee.class, beanSer, beanSer);

    smr.mapTypes(Constants.NS_URI_SOAP_ENC,
                 new QName("urn:Personnel", "com.transync.data.Department"),
                 com.transync.data.Department.class, beanSer, beanSer);

And here's the mapping in DeploymentDescriptor.xml:

<isd:mappings>
        <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
                 xmlns:x="urn:Personnel"
qname="x:com.transync.data.Employee"
                 javaType="com.transync.data.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:Personnel"
qname="x:com.transync.data.Department"
                javaType="com.transync.data.Department"

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

xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer"/>
       </isd:mappings>

Any ideas on why these two very similar objects are behaving differently
would be very welcome.

Thanks,
Chris

Reply via email to