I wrote several call 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 = 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. Collections list;
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 = 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 [] {}); // call a method and PASS 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. Collections list;
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 = "Address of the provided Interface
Private string soapaction = "http://WebXml.com.cn/"; // domain name, which is defined on the server
Public putweather ()
{
String city = "Beijing ";
Service = new service ();
Try {
Call call = (CALL) service. createcall ();
Call. settargetendpointaddress (URL );
Call. setoperationname (New QNAME (soapaction, "getweatherbycityname"); // you can specify the method to call.
Call. addparameter (New QNAME (soapaction, "thecityname"), // set the parameter to be passed
Org. Apache. axis. encoding. xmltype. xsd_string,
Javax. xml. rpc. parametermode. In );
Call. setreturntype (New QNAME (soapaction, "getweatherbycityname"), vector. Class); // data type to be returned (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}); // call the method and PASS 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 reprinted. Unfortunately, I don't know the address ......
--! Sorry