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]>

Reply via email to