Hi,
I am trying to make a Apache SOAP client to connect to a server which uses
Scott Seely's SimpleSOAP library. This server needs the header like the
following:
POST /Ch4SOAP HTTP/1.0
Content-type: text/xml; charset=utf-8
Content-Length: 442
SOAPAction: "Ch4SOAP#add"
Now my problem is that the Apache library do not insert the "/Ch4SOAP" into
the header.
My java code looks like:
//Required due to user of URL class, required by Call class
import java.net.*;
//Required due to use of Vector class
import java.util.*;
//Apache SOAP classes used by client
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
public class simpleSOAPClient
{
public static void main (String[] args) throws Exception
{
// create the transport and set parameters
// the call object
Call call= new Call();
// the parameter vector
Vector params= new Vector();
// the parameters
int a= 2;
int b= 3;
// set the call to use standard SOAP
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
// the Target object URI
call.setTargetObjectURI("http://localhost:8080");
// set the Methodname
call.setMethodName("add");
// make the parameter vector
params.addElement(new Parameter("a", Integer.class, new Integer(a), null));
params.addElement(new Parameter("b", Integer.class, new Integer(b), null));
call.setParams(params);
//invokation
URL url= new URL ("http://localhost:8080");
Response resp= call.invoke(url, "Ch4SOAP#add");
if (resp.generatedFault())
{
Fault fault= resp.getFault();
System.out.println("Fault code" + fault.getFaultCode());
System.out.println("Fault string" + fault.getFaultString());
}
System.out.println("it worked");
}
}
what am I doing wrong
/Kim Falk