You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Brady Gaster <bg...@distributedobjex.com> on 2001/04/13 17:05:01 UTC
Problems with small App - anyone got any ideas?
I'm having a bit of a problem with a small sample app i'm writing. Can
anyone help out?
import java.io.*;
import java.util.*;
import java.net.*;
import org.w3c.dom.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*;
import org.apache.soap.rpc.*;
import org.apache.soap.transport.http.SOAPHTTPConnection;
class SOAPTester
{
public static void main(String[] args) throws Exception
{
String serviceURL = null;
serviceURL = "http://localhost:123";
System.out.println("The Default URL is: " + serviceURL);
URL url = new URL(serviceURL);
SOAPMappingRegistry smr = new SOAPMappingRegistry();
StringDeserializer sd = new StringDeserializer ();
smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName ("", "Result"), null,
null, sd);
SOAPHTTPConnection st = new SOAPHTTPConnection();
Call call = new Call ();
call.setSOAPTransport(st);
call.setSOAPMappingRegistry (smr);
call.setTargetObjectURI ("http://tempuri.org/message/");
call.setMethodName("MakeXML");
call.setEncodingStyleURI ("http://schemas.xmlsoap.org/soap/encoding/");
Vector params = new Vector ();
params.addElement(new Parameter("f",SOAPTester.class,new
String("brady"),null));
params.addElement(new Parameter("l",SOAPTester.class,new
String("gaster"),null));
call.setParams(params);
Response resp;
resp = call.invoke (url, serviceURL);
Parameter ret = resp.getReturnValue();
Object value = ret.getValue();
System.out.println ("Response: " + value);
}
}
Brady Gaster
Senior Solutions Engineer
Distributed Objex, Inc.
http://www.distributedobjex.com
[tel] 804.355.9360 [cel] 804.677.8313