Scott,

    I did this on my OSX box, same environment as yours except the OS, which i am now going to go try on windows but thought i'd send the results first.  I got this:
 

[atrieger@shadowfax workspaces]$ java HelloWorldClient http://shadowfax:8080/soap/servlet/rpcrouter
Ouch, the call failed:
  Fault Code   = SOAP-ENV:Server
  Fault String = Exception while handling service request: org/apache/soap/rpc/SOAPContext
[atrieger@shadowfax workspaces]$
 

    With nothing in the catalina.out file.
    However, I didnt do anything with your deployment description below, really, I deployed it using the soap admin gui, but of course made all the names the same and made its scope "application".... that's not a problem, is it?  (I attached what the admin gui tells me about this service).

Drew
 
 
 
 

Scott Nichol wrote:

Drew,

I thought that maybe if you had a bad definition for HttpServletRequest that the
JIT might throw an exception when it compiles the method.

Anyway, I wrote the following service and client and was able to successfully
run it.  My environment is Win2k, JDK 1.3.1, SOAP 2.2, Tomcat 4.0.1.  If you
cannot get it to run, I could send you my bytecode to test.

Scott

import javax.servlet.http.*;
public class HelloWorldService {
 public String hello(org.apache.soap.rpc.SOAPContext ctx) {
  HttpServletRequest req =
(HttpServletRequest)ctx.getProperty(org.apache.soap.Constants.BAG_HTTPSERVLETREQ
UEST);
  return req != null ? req.getQueryString() : "null";
 }
}

<isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
             id="urn:helloworld">
  <isd:provider type="java"
                scope="Application"
                methods="hello">
    <isd:java class="HelloWorldService"/>
  </isd:provider>
  <isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener>
</isd:service>

import java.net.*;
import java.util.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;

public class HelloWorldClient {
 public static void main(String[] args) throws Exception {
     if (args.length != 1
         && (args.length != 2 || !args[0].startsWith ("-"))) {
       System.err.println ("Usage: java " + HelloWorldClient.class.getName () +
                           " [-encodingStyleURI] SOAP-router-URL");
       System.exit (1);
     }

     // Process the arguments.
     int offset = 2 - args.length;
     String encodingStyleURI = args.length == 2
                               ? args[0].substring(1)
                               : Constants.NS_URI_SOAP_ENC;
     URL url = new URL (args[1 - offset]);

     // Build the call.
     Call call = new Call ();
     call.setTargetObjectURI ("urn:helloworld");
     call.setMethodName ("hello");
     call.setEncodingStyleURI(encodingStyleURI);
     Vector params = new Vector ();
     Response resp = call.invoke url, "" );

     // Check the response.
     if (resp.generatedFault ()) {
       Fault fault = resp.getFault ();
       System.out.println ("Ouch, the call failed: ");
       System.out.println ("  Fault Code   = " + fault.getFaultCode ());
       System.out.println ("  Fault String = " + fault.getFaultString ());
     } else {
       Parameter result = resp.getReturnValue ();
       System.out.println (result.getValue ());
     }
 }
}


 

Deployed Service Information

'urn:helloworld' Service Deployment Descriptor

Property Details
ID urn:helloworld
Scope Application
Provider Type java
Provider Class HelloWorldService
Use Static Class false
Methods hello
Type Mappings
Default Mapping Registry Class

Reply via email to