Wrote a few invocation examples:
1,
Import org.apache.axis.client.*;
Import Org.apache.axis.client.Call;
Import Org.apache.axis.client.Service;
Import Javax.xml.namespace.QName;
Import Javax.xml.rpc.ParameterMode;
Import javax.xml.rpc.JAXRPCException;
Import Javax.xml.rpc.ServiceFactory;
public class TestWebService {
/**
* @param args
*/
public static void Main (string[] args) {
TODO auto-generated Method Stub
System.out.println ("Start invoking ...");
Try
{
String endpoint= "Http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx";
Service service = new service ();
Call call = (call) Service.createcall ();
Call.settargetendpointaddress (New Java.net.URL (EndPoint));
Call.setoperation ("Getversiontime");
Call.setusesoapaction (TRUE);
Call.setsoapactionuri ("Http://WebXml.com.cn/getVersionTime");
Call.setoperationname (New QName (""));
Call.setreturntype (Org.apache.axis.encoding.XMLType.XSD_STRING);
String str= (String) Call.invoke (new object[]{});
System.out.println (str);
}catch (Exception e)
{
E.printstacktrace ();
}
}
}
2,
Import java.util.LinkedList;
Import java.util.List;
Import Java.util.Map;
Import Java.util.Vector;
Import Javax.xml.namespace.QName;
Import Org.apache.axis.client.Call;
Import Org.apache.axis.client.Service;
public class Getipcontent
{
Private String url= "Http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx";
Private String soapaction= "http://WebXml.com.cn/";
Public Getipcontent ()
{
Service service=new service ();
try{
Call Call= (call) Service.createcall ();
Call.settargetendpointaddress (URL);
Call.setoperationname (New QName (SOAPAction, "Getgeoipcontext"));
Call.setreturntype (New QName (SOAPAction, "Getgeoipcontext"), Vector.class);
Call.setusesoapaction (TRUE);
Call.setsoapactionuri (SOAPAction + "Getgeoipcontext");
Vector v= (vector) Call.invoke (new object[]{});//calling method and passing parameters
for (int i=0;i<v.size (); i++)
{
System.out.println (V.get (i));
}
}catch (Exception ex)
{
Ex.printstacktrace ();
}
}
public static void Main (String args[])
{
Getipcontent gip=new getipcontent ();
}
}
3,
Import java.util.LinkedList;
Import java.util.List;
Import Java.util.Map;
Import Java.util.Vector;
Import Javax.xml.namespace.QName;
Import Org.apache.axis.client.Call;
Import Org.apache.axis.client.Service;
public class Putweather
{
Private String Url= "provides an address for an interface
Private String soapaction= "http://WebXml.com.cn/"; Domain name, which is defined in the server
Public Putweather ()
{
String city= "Beijing";
Service service=new service ();
try{
Call Call= (call) Service.createcall ();
Call.settargetendpointaddress (URL);
Call.setoperationname (New QName (SOAPAction, "getweatherbycityname")); Set which method to call
Call.addparameter (New QName (SOAPAction, "Thecityname"),//Set parameters to pass
Org.apache.axis.encoding.XMLType.XSD_STRING,
Javax.xml.rpc.ParameterMode.IN);
Call.setreturntype (New QName (SOAPAction, "Getweatherbycityname"), Vector.class); The data type to return (custom type)
Call.setreturntype (Org.apache.axis.encoding.XMLType.XSD_STRING);//(Standard type)
Call.setusesoapaction (TRUE);
Call.setsoapactionuri (SOAPAction + "Getweatherbycityname");
Vector v= (vector) Call.invoke (new object[]{city});//calling method and passing parameters
for (int i=0;i<v.size (); i++)
{
System.out.println (V.get (i));
}
}catch (Exception ex)
{
Ex.printstacktrace ();
}
}
public static void Main (String args[])
{
Putweather pw=new Putweather ();
}
}
The third one is reproduced, unfortunately, the address does not know ...
--! Sorry