The Hashtable mapping is implicit: you do not need it in your
deploymentdescriptor.

As you can see, the error is actually finding a serializer for
java.util.Vector$1.  This class exists back to JDK 1.2; it is an
anonymous class implementing the Enumeration interface defined by the
Vector#elements() method.  I take it that the elements in your Hashtable
are such Enumerations.

What you need to do is write a serializer and deserializer for such
Enumerations and map them to java.util.Vector$1 (map the serializer on
the server and the deserializer on the client).

Alternatively, if you can rewrite the method (or add a new method) to
return a Hashable of Vectors instead, the built-in Vector serializer
will do the work for you.

Scott Nichol

----- Original Message -----
From: "Vijay Shinde" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, January 02, 2003 12:30 PM
Subject: Re: SOAP - method return


> Scott,
>
> Here are the details.
>
> I guess i need to provide the mapping in my DeploymentDescriptor.xml.
>
> Here is my descriptor.
> <dd:service xmlns:dd="http://xml.apache.org/xml-soap/deployment";
>     id="urn:ldap">
>      <dd:provider type="java"
>               scope="Application"
>               methods="getLDAP">
>        <dd:java class="LDAPCall"  static="false" />
>      </dd:provider>
>
>
<dd:faultListener>org.apache.soap.server.DOMFaultListener</dd:faultListe
ner>
>
>  <dd:mappings>
>      <dd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>               xmlns:x="urn:ldap" qname="x:ldap"
>               javaType="java.util.Hashtable"
>
>
java2XMLClassName="org.apache.soap.encoding.soapenc.HashtableSerializer"
>
>
xml2JavaClassName="org.apache.soap.encoding.soapenc.HashtableSerializer"
/>
>
>   </dd:mappings>
> </dd:service>
>
> I am returning Hashtable from my method call.
>
> I am getting following exception.
>
> The SOAP Server says: http://localhost:8080/soap/servlet/rpcrouter
> Ouch, the call failed:
>   Fault Code   = SOAP-ENV:Server
>   Fault String = java.lang.IllegalArgumentException: No Serializer
found to
> seri
> alize a 'java.util.Vector$1' using encoding style
> 'http://schemas.xmlsoap.org/so
> ap/encoding/'.
>
> I have provide mapping for hashtable why it is throwing me error for
vector
> class?.
> are  my mappings correct?
>
>
> Vijay
>
>
> Scott Nichol wrote:
>
> > A couple of things:
> >
> > 1. Which line of your code is line 36 where the exception is
occurring?
> >
> > 2. Your code should check for a SOAP Fault before doing
> > getReturnValue(), e.g.
> >
> >  Response resp = call.invoke(url, "");
> >  if (resp.generatedFault()) {
> >     Fault fault = resp.getFault();
> >     System.err.println("Generated fault: " + fault);
> >  } else {
> >     Parameter p = resp.getReturnValue();
> >     Hashtable values = (Hashtable)p.getValue();
> >     ...
> >
> > If there is a fault, I believe that getReturnValue() will return
null,
> > so calling it without checking for a fault could lead to an NPE.
> >
> > 3. Although I take it you are using Apache SOAP on the server in
this
> > case, it is worth pointing out that some SOAP implementations will
omit
> > the return value from the SOAP envelope if its value is null (e.g.
this
> > happens in .NET when the return is not specified as being nillable).
> > Therefore, it is good practice in your client code to check that
> > getReturnValue() does not itself return null.
> >
> > Scott Nichol
> >
> > ----- Original Message -----
> > From: "Vijay Shinde" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, January 02, 2003 11:54 AM
> > Subject: SOAP - method return
> >
> > > Hi,
> > >
> > > I am doing LDAP call using soap .I want to return Hashtable from
my
> > > method call.
> > > On my client site I am using following code to get my hashtable.
> > >
> > > Response resp = call.invoke(url, "");
> > > Parameter p = resp.getReturnValue();
> > >   Hashtable values = (Hashtable)p.getValue();
> > >
> > > I am getting following exception.
> > >
> > > The SOAP Server says:
> > > http://localhost:8080/soap/servlet/rpcrouterException in t
> > > hread "main" java.lang.NullPointerException
> > >  at LDAP_client.main(LDAP_client.java:36)
> > >
> > > any help will be useful.
> > >
> > > Vijay
> > > --
> > > This communication is intended for the addressee(s) and may
contain
> > > confidential and legally privileged information.  We do not waive
> > > confidentiality or privilege by mistransmission.  If you have
received
> > > this communication in error, any use, dissemination, printing or
> > copying
> > > is strictly prohibited; please destroy all electronic and paper
copies
> > > and notify the sender immediately.
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > >
> > >
> >
> > --
> > To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
> --
> This communication is intended for the addressee(s) and may contain
> confidential and legally privileged information.  We do not waive
> confidentiality or privilege by mistransmission.  If you have received
this
> communication in error, any use, dissemination, printing or copying is
> strictly prohibited; please destroy all electronic and paper copies
and
> notify the sender immediately.
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to