Hey ,
I am new to soap I am invoking one service on xmlmethods.net
My Client code is --
import java.io.*;
import java.net.*;
import java.util.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
public class TempClient{
public static float getTemp (URL url, String zipcode) throws
Exception {
Call call = new Call ();
// Service uses standard SOAP encoding
String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
call.setEncodingStyleURI(encodingStyleURI);
// Set service locator parameters
call.setTargetObjectURI ("urn:xmethods-Temperature");
call.setMethodName ("getTemp");
// Create input parameter vector
Vector params = new Vector ();
params.addElement (new Parameter("zipcode", String.class,
zipcode,null));
call.setParams (params);
// Invoke the service ....
Response resp = call.invoke (url,"");
// ... and evaluate the response
if (resp.generatedFault ()) {
throw new Exception();
} else {
// Call was successful. Extract response parameter and return
Parameter result = resp.getReturnValue ();
Float rate=(Float) result.getValue();
return rate.floatValue();
}
}
// Driver to illustrate service invocation
public static void main(String[] args)
{
try
{
URL url=new
URL("http://services.xmethods.com:80/soap/servlet/rpcrouter");
String zipcode= "94041";
float temp = getTemp(url,zipcode);
System.out.println(temp);
}
catch (Exception e) {e.printStackTrace();}
}
}
I get following error.
[SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket:
Connection
timed out: connect; targetException=java.lang.IllegalArgumentException:
Error op
ening socket: Connection timed out: connect]
at
org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnec
tion.java:324)
at org.apache.soap.rpc.Call.invoke(Call.java:205)
at TempClient.getTemp(TempClient.java:28)
at TempClient.main(TempClient.java:49)
Is any one has any guess, I will really appreciate any help on the same.
Regards,
Vijay
"W. Scott Grant" wrote:
> A signature match usually means that the parameters you send to
> the method do not exactly match the expected order listed. In other
> words if you have the following method
>
> run(String a, String b, int c) and you try to call it using
>
> run(int c, String a, String b) you will get a signature error.
>
> > -----Original Message-----
> > From: C. Schlegelmilch [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, April 12, 2002 3:17 PM
> > To: [EMAIL PROTECTED]
> > Subject: No Signature Match
> >
> >
> > Hello,
> >
> > I've searched the archives and the web and have yet to
> > see a solid answer that works for me:
> >
> > With a SOAP Messaging service implemented using Apache
> > SOAP. My service calls a method called run(). It
> > contains the following signature:
> >
> > public void run (org.apache.soap.Envelope
> > env,org.apache.soap.rpc.SOAPContext
> > reqCtx,org.apache.soap.rpc.SOAPContext resCtx)
> >
> > My service constantly returns the following error:
> > Exception while handling service request:
> > com.cssde.server.RecordRouter.run(org.apache.soap.Envelope,org.apa
> > che.soap.rpc.SOAPContext,org.apache.soap.rpc.SOAPContext)
> > -- no signature match
> >
> > Have no clue why.
> >
> > Running Tomcat 4.0.1 on Win2000 with JDK 1.3.1.
> >
> > Any ideas?
> >
> > Thanks,
> >
> > Craig Schlegelmilch
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Everything you'll ever need on one web page
> > from News and Sport to Email and Music Charts
> > http://uk.my.yahoo.com
> >
> >