axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Glen Daniels <gdani...@macromedia.com>
Subject RE: NullPointerException invoking overloaded service method
Date Wed, 08 May 2002 19:36:55 GMT

Hi Zeyn!

The reason we check for ">= numParams" is because some of the in params might be nulls,
which can be represented by an omitted element in SOAP RPC (this has been the source of much
confusion and discussion in the SOAP community).  So if you have an overloaded method:

public void method(String arg1)
public void method(String arg1, String arg2)

And we get this XML:

<soap:Body>
 <method>
   <arg1>Foo</arg1>
 </method>
</soap:Body>

There's no way to figure out whether this means the first method, or the second method with
a null arg2.  Admittedly, this state of affairs kind of bites, but I think the best we can
do here is just try to call the first method for now, which we're clearly not doing in your
example.  This is because we don't currently sort the overloaded OperationDescs by number
of input parameters, which is something I'll do right now, which should fix your problem.
 (also, we should know not to play the "omitted == null" trick for primitive types!)

Thanks for the heads-up!

--Glen

> -----Original Message-----
> From: Zeyn Saigol [mailto:zeyn@mail.com]
> Sent: Wednesday, May 08, 2002 11:50 AM
> To: axis-user@xml.apache.org
> Subject: NullPointerException invoking overloaded service method
> 
> 
> Hi,
> 
> I've just upgraded to the Beta 2 of Axis, and I'm getting a 
> NullPointerException when invoking *some* versions of an 
> overloaded method exposed by my service (stack trace below).
> 
> It works for an (int, int) version, and also for a (String, 
> int) version, but fails with an (int) version - I suspect 
> it's trying to invoke the (int, int) version.
> 
> I'm suspicious of the code in RPCElement.deserialize, that is 
> considering Operations as candidates if 
> (operation.getNumInParams() >= numParams)
> - surely the number of "in" params must be exactly equal to 
> the number of params supplied in the SOAP body, even if the 
> operation also has some "inout" params?
> 
> Can anyone confirm that this is a bug?, or does anyone have 
> any idea what I can do to sort it out?
> 
> cheers,
> Zeyn
> 
> 
> Stack trace from exception:
> java.lang.NullPointerException
> 	at java.lang.reflect.Method.invoke(Native Method)
> 	at 
> org.apache.axis.providers.java.RPCProvider.processMessage(RPCP
> rovider.java:229)
> 	at 
> org.apache.axis.providers.java.JavaProvider.invoke(JavaProvide
> r.java:262)
> 	at 
> org.apache.axis.strategies.InvocationStrategy.visit(Invocation
> Strategy.java:71)
> 	at org.apache.axis.SimpleChain.doVisitming(SipleChain.java:154)
> 	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:121)
> 	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:288)
> 	at 
> org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.
> java:576)
> -- 
> _______________________________________________
> Sign-up for your own FREE Personalized E-mail at Mail.com
> http://www.mail.com/?sr=signup
> 

Mime
View raw message