Can't get any examples to work urgent!
Damien Cummins <[email protected]> Fri, 25 Jul 2003 15:09:37 +0200
| Newsgroups | gmane.comp.java.enhydra.ksoap |
|---|---|
| Organization | CDS |
| Message-ID | <[email protected]> |
import java.io.*;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;
import javax.xml.rpc.ParameterMode;
public class Sesame {
public String getNameResolved(String name)
{
String ret = null;
try{
String endpoint ="http://cdsws.u-strasbg.fr/axis/Sesame.jws";
String method ="Sesame";
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(method);
call.addParameter( "op1",XMLType.XSD_STRING,ParameterMode.IN );
call.setReturnType( XMLType.XSD_STRING );
ret = (String)call.invoke( new Object [] {name} );
}
catch (Exception e) { System.out.println("getNameResolved : " + e);}
return ret;
}
public static void main(String [] args) throws Exception {
Sesame sesame = new Sesame();
//String result = sesame.getNameResolved(args[0]);
String example ="M 51";
String result = sesame.getNameResolved(example);
if(result != null)
System.out.println("The result is : "+ result);
else
System.out.println("sorry but no result found ");
}
}
D. Cummins