You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Scott Nichol <sc...@yahoo.com> on 2002/04/19 18:31:37 UTC

Re: using SOAPContext as first argument in RPC SOAP messages class not working

Drew,

If Apache SOAP does not find a matching method, you
would get a "No such method" exception, which you do
not.  I believe you are getting a run-time exception
from your method.

One question that comes to mind: did you compile with
a servlet.jar that is compatible with Tomcat's?  If
your code expects an HttpServletRequest to look like
something different than it actually does at run-time,
you could get an error like the one you see.

Scott Nichol

--- Andrew Trieger <at...@yahoo.com> wrote:

<HR>
<!doctype html public "-//w3c//dtd html 4.0
transitional//en">
<html>
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF"
vlink="#FF0000" alink="#000088">
Hello,
<p>&nbsp;&nbsp;&nbsp; I've checked the bugzilla bug
database and the archives
on this list and don't think this is a known problem,
so I'm describing
it here to see if I'm an idiot or if its a real
problem.
<p>&nbsp;&nbsp;&nbsp; I&nbsp;soapv2.2 on linux
(mandrake 8.1, kernel 2.4.x)
running in both tomcat 4.x and iplanet 6.0SP2, each
able to use either
jdk1.3.1_01 or jdk1.4.0.
<p>&nbsp;&nbsp;&nbsp; I have 1 class with some methods
I'm exposing using
soap to RPC&nbsp;calls.
<br>&nbsp;&nbsp;&nbsp; 1 of those methods is a simple
helloworld method
that used to take 1 arg, a string, and just return
it.&nbsp; But now I&nbsp;need
to develop application level security so I need access
to the HTTPServletRequest
object from the servlet.&nbsp; In soapv2.2 (new, not
in 2.1 so the docs
say) an apache-soap specific feature was added such
that when scanning
a class for a method matching the signature requested
by an incoming request,
if the signature isnt found, a second search is done
with the same signature
but with an additional FIRST&nbsp;argument of type
org.apache.soap.rpc.SOAPContext.&nbsp;
The idea being that this will then be invoked and you
can ask this object
for different things from its grab-bag, thereby
getting the servlet request
object and finding out stuff.
<p>&nbsp;&nbsp;&nbsp; here's the code:
<br>&nbsp;
<p>&nbsp; /** return the argument sent in, just to
prove you
<br>&nbsp;&nbsp; * can pass a string and get it
back... ooo coool.
<br>&nbsp;&nbsp; */
<br>&nbsp; public String
helloWorldWithArg(org.apache.soap.rpc.SOAPContext
ctx, String arg) {
<br>&nbsp;&nbsp;&nbsp; HttpServletRequest req = null;
<p>&nbsp;&nbsp;&nbsp; _log("i am in helloworldwitharg
now, the one with
ctx passed in.");
<br>&nbsp;&nbsp;&nbsp; req =
(HttpServletRequest)ctx.getProperty(org.apache.soap.Constants.BAG_HTTPSERVLETREQUEST);
<br>&nbsp;&nbsp;&nbsp; if (req != null) _log("remote
user is: "+req.getQueryString());
<br>&nbsp;&nbsp;&nbsp; return arg;
<br>&nbsp; }
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<p>&nbsp;&nbsp;&nbsp; Here's the problem:
<br>&nbsp;&nbsp;&nbsp; It works fine in both java's
and both webservers
(iplanet and tomcat) if I&nbsp;do NOT&nbsp;have the
SOAPContext first argument
there, only the String named "arg".&nbsp; But, if i
change the code to
as it appears above, recompile (with the proper javac
for whichever java
i'm using) and restart the webserver (not changing the
deployment, i.e.
not deleting and re-deploying in soap's admin
interface, then the client
is returned this exception:
<p>A fault was generated: [Attributes={}]
[faultCode=SOAP-ENV:Server] [faultString=Exception
while handling service request:
org/apache/soap/rpc/SOAPContext]
[faultActorURI=/soap/servlet/rpcrouter]
[DetailEntries=] [FaultEntries=]
<br>&nbsp;
<p>&nbsp;&nbsp;&nbsp; And from println's in my code,
my method is never
called.
<p>&nbsp;&nbsp;&nbsp; So my questions are:
<p>1. has anyone else gotten this new feature to work
in a similar environment
to mine?
<br>2. Does anyone know how to get more debugging
information out server
side to see why its not finding this method to
call?&nbsp; There are no
messages written to stdout.
<br>&nbsp;
<p>&nbsp;&nbsp;&nbsp; Thank you for your time,
<br>&nbsp;&nbsp;&nbsp; Drew Trieger
<br>&nbsp;&nbsp;&nbsp; atrieger@yahoo.com
<br>&nbsp;
<pre>--&nbsp;
---</pre>
&nbsp;
</body>
</html>



__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

Re: using SOAPContext as first argument in RPC SOAP messages class not working

Posted by Andrew Trieger <at...@yahoo.com>.
Good idea, but I *think* its not even executing my method as my first
line println isnt coming out, so I'm screwed, but i might be able to
subclass rpcrouter servlet, use mine instead of theirs, catch throwable
and dump any info to stderr...

Any idea if defining my own custom fault-handler would be helpful?  I'm
not sure how that would help, but possibly it would be called by the
local soap stuff and given more error message info than is returned in
the soap response?  eh...  long shot.

I might just have to call this feature "Too new to work" and wait 6mos
and get along without it.  I could define a different soap router url
for EVERY method and then control access in iplanet... hassle.

Drew


Re: using SOAPContext as first argument in RPC SOAP messages class not working

Posted by Andrew Trieger <at...@yahoo.com>.
Good idea, but I *think* its not even executing my method as my first
line println isnt coming out, so I'm screwed, but i might be able to
subclass rpcrouter servlet, use mine instead of theirs, catch throwable
and dump any info to stderr...

Any idea if defining my own custom fault-handler would be helpful?  I'm
not sure how that would help, but possibly it would be called by the
local soap stuff and given more error message info than is returned in
the soap response?  eh...  long shot.

I might just have to call this feature "Too new to work" and wait 6mos
and get along without it.  I could define a different soap router url
for EVERY method and then control access in iplanet... hassle.

Drew


Re: using SOAPContext as first argument in RPC SOAP messages class not working

Posted by Scott Nichol <sc...@yahoo.com>.
One thing I do to help debugging: I put all method
code (including all variable declarations) in a try
block, catch Throwable, and write a stack trace to
standard error.

Scott

--- Andrew Trieger <at...@yahoo.com> wrote:
> yeah, that is a good idea.  The servlet.jar I
> compiled against was the same for all tests
> as I forgot to change it, which is the servlet.jar
> in tomcat4.0.   So in theory Iplanet
> could have a problem with that, but:
> 
> 1. the test fails in tomcat as well as soon as I add
> the SOAPContext arg to the method.
> 2. the messaging works fine in iplanet if I just
> dont ask for the SOAPContext in the
> helloworld method... it was accidently compiled
> against the wrong servlet.jar which I'll
> fix and retry and doubt will fix it.
> 
> any other ideas??
> 
> you're correct, I'm not getting any exceptions that
> spew to stdout, in tomcat I watch
> catalina.out where my _log(blabla) messages go
> (System.out.println()) and all I see is
> the constructor is called and returns and the first
> _log message of my helloworld method
> is never printed, nor any errors.  just a fault
> returned to the xml client.
> 
> Thanks, Drew
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

Re: using SOAPContext as first argument in RPC SOAP messages class not working

Posted by Scott Nichol <sc...@yahoo.com>.
One thing I do to help debugging: I put all method
code (including all variable declarations) in a try
block, catch Throwable, and write a stack trace to
standard error.

Scott

--- Andrew Trieger <at...@yahoo.com> wrote:
> yeah, that is a good idea.  The servlet.jar I
> compiled against was the same for all tests
> as I forgot to change it, which is the servlet.jar
> in tomcat4.0.   So in theory Iplanet
> could have a problem with that, but:
> 
> 1. the test fails in tomcat as well as soon as I add
> the SOAPContext arg to the method.
> 2. the messaging works fine in iplanet if I just
> dont ask for the SOAPContext in the
> helloworld method... it was accidently compiled
> against the wrong servlet.jar which I'll
> fix and retry and doubt will fix it.
> 
> any other ideas??
> 
> you're correct, I'm not getting any exceptions that
> spew to stdout, in tomcat I watch
> catalina.out where my _log(blabla) messages go
> (System.out.println()) and all I see is
> the constructor is called and returns and the first
> _log message of my helloworld method
> is never printed, nor any errors.  just a fault
> returned to the xml client.
> 
> Thanks, Drew
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

Re: using SOAPContext as first argument in RPC SOAP messages class not working

Posted by Andrew Trieger <at...@yahoo.com>.
yeah, that is a good idea.  The servlet.jar I compiled against was the same for all tests
as I forgot to change it, which is the servlet.jar in tomcat4.0.   So in theory Iplanet
could have a problem with that, but:

1. the test fails in tomcat as well as soon as I add the SOAPContext arg to the method.
2. the messaging works fine in iplanet if I just dont ask for the SOAPContext in the
helloworld method... it was accidently compiled against the wrong servlet.jar which I'll
fix and retry and doubt will fix it.

any other ideas??

you're correct, I'm not getting any exceptions that spew to stdout, in tomcat I watch
catalina.out where my _log(blabla) messages go (System.out.println()) and all I see is
the constructor is called and returns and the first _log message of my helloworld method
is never printed, nor any errors.  just a fault returned to the xml client.

Thanks, Drew


Re: using SOAPContext as first argument in RPC SOAP messages class not working

Posted by Andrew Trieger <at...@yahoo.com>.
yeah, that is a good idea.  The servlet.jar I compiled against was the same for all tests
as I forgot to change it, which is the servlet.jar in tomcat4.0.   So in theory Iplanet
could have a problem with that, but:

1. the test fails in tomcat as well as soon as I add the SOAPContext arg to the method.
2. the messaging works fine in iplanet if I just dont ask for the SOAPContext in the
helloworld method... it was accidently compiled against the wrong servlet.jar which I'll
fix and retry and doubt will fix it.

any other ideas??

you're correct, I'm not getting any exceptions that spew to stdout, in tomcat I watch
catalina.out where my _log(blabla) messages go (System.out.println()) and all I see is
the constructor is called and returns and the first _log message of my helloworld method
is never printed, nor any errors.  just a fault returned to the xml client.

Thanks, Drew