You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Ola Hamfors <ha...@sics.se> on 2001/06/27 16:44:16 UTC

SOAP2.2 Error?

Why do I get this fault with SOAP2.2 ?
----------------------------------
C:\projects\SOAPTest>java -classpath
.;classes;lib\wstk.jar;lib\sd.jar;lib\soap.
jar;lib\xerces.jar;lib\xalan.jar;lib\bsf.jar;lib\activation.jar;lib\mail.jar
test2
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String
ind
ex out of range: -1
        at java.lang.StringBuffer.charAt(StringBuffer.java:283)
        at org.apache.soap.util.net.HTTPUtils.post(HTTPUtils.java:288)
        at
org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnec
tion.java:282)
        at org.apache.soap.rpc.Call.invoke(Call.java:205)
        at test2.main(test2.java:86)
-------------------------------------

this is the code

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

public class test2 {
  public static void main (String[] args) throws Exception {

    URL url = new URL
("http://powerofzen.com/cgi-bin/wordsforchecks.exe/soap/IWordsForCheck");

    // Build the call.
    Call call = new Call ();
    call.setTargetObjectURI ("urn:UIWordsForChecks-IWordsForCheck");
    call.setMethodName ("GetWordsForCheck");
    call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
    Vector params = new Vector ();
    params.addElement (new Parameter("Value", Double.class, "344", null));
    call.setParams (params);

    // make the call: note that the action URI is empty because the
    // XML-SOAP rpc router does not need this. This may change in the
    // future.
    Response resp = call.invoke (/* router URL */ url, /* actionURI */
"urn:UIWordsForChecks-IWordsForCheck#GetWordsForCheck" );

    // 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 ());
    }
  }
}