Hello,

I have a question and I hope I'll be able to get some help from the list.

Most of the SOAP examples that I have seen and worked with so far use RPC to connect 
to  SOAP server as:
---------------start - RPC-----------------------
import org.apache.soap.rpc.*;
URL url = new URL("http://genx:80/soap/servlet/rpcrouter";);
Call call = new Call();
call.setTargetObjectURI("urn:XcelXmlServer");
call.setMethodName("getMeaning");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector();
params.addElement (new Parameter ("wordToLookup", String.class, "toughWord", null));
call.setParams(params);
Response resp = call.invoke(url, "");
Fault fault = resp.getFault();
System.out.print (result.getValue());
---------------end - RPC -----------------------------

But, I need to use sockets instead:

---------------start - Socket -----------------------------
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
String host = "genx"; int port = 80;
String submitURL = "/soap/servlet/rpcrouter";
sslSocket = (SSLSocket)factory.createSocket(host, port);
sslSocket.startHandshake();
socket = new Socket(host, port);
out = new PrintWriter(new BufferedWriter(new 
OutputStreamWriter(socket.getOutputStream())));
out.println("POST " + submitURL + " HTTP/1.1");
out.println("Host: " + host);
out.println("Content-Type: text/xml");
out.println("Content-Length: " + "toughWord".length());
out.println("SOAPAction: \"\"" + "\n");
out.println(SOAP_HEADER + "\n" + toughWord + "\n" + SOAP_FOOTER);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
while ((inputLine = in.readLine()) != null) System.out.println(inputLine);
socket.close();
---------------end - Socket -----------------------------

I have implemented service 'Dictionary' that has a method 'getMeaning'. I can access 
it via RPC but not via sockets. The values in the above code snippet are the exact 
values that I am using in my program.

My question is: Where (and how) in sockets do I specify the equivalent of

call.setTargetObjectURI("urn:XcelXmlServer");
call.setMethodName("getMeaning");


Thanks
Nishi

Reply via email to