Java code
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 MyWebServices
{
Private String url = "http://www.mxtong.net.cn/GateWay/Services.asmx"; // address that provides the interface
Private String soapaction = "http://tempuri.org/"; // domain name, which is defined on the server
Public MyWebServices ()
{
String userids = "876890 ";
String Account = "admin ";
String Password = "******";
String Phones = "134 *********; 1234 ";
String Content = "hello, this is a test! This is a test! ";
String SendTime = "Maid 16:07:00 ";
String SendType = "1 ";
String PostFixNumber = "1 ";
Service service = new Service ();
Try {
Call call = (Call) service. createCall ();
Call. setTargetEndpointAddress (url );
Call. setOperationName (new QName (soapaction, "DirectSend"); // you can specify the method to call.
Call. addParameter (new QName (soapaction, "UserID"), // set the parameter to be passed
Org. apache. axis. encoding. XMLType. XSD_STRING,
Javax. xml. rpc. ParameterMode. IN );
Call. addParameter (new QName (soapaction, "Account"), // set the parameter to be passed
Org. apache. axis. encoding. XMLType. XSD_STRING,
Javax. xml. rpc. ParameterMode. IN );
Call. addParameter (new QName (soapaction, "Password"), // set the parameter to be passed
Org. apache. axis. encoding. XMLType. XSD_STRING,
Javax. xml. rpc. ParameterMode. IN );
Call. addParameter (new QName (soapaction, "Phones"), // set the parameter to be passed
Org. apache. axis. encoding. XMLType. XSD_STRING,
Javax. xml. rpc. ParameterMode. IN );
Call. addParameter (new QName (soapaction, "Content"), // set the parameter to be passed
Org. apache. axis. encoding. XMLType. XSD_STRING,
Javax. xml. rpc. ParameterMode. IN );
Call. addParameter (new QName (soapaction, "SendTime"), // set the parameter to be passed
Org. apache. axis. encoding. XMLType. XSD_STRING,
Javax. xml. rpc. ParameterMode. IN );
Call. addParameter (new QName (soapaction, "SendType"), // set the parameter to be passed
Org. apache. axis. encoding. XMLType. XSD_STRING,
Javax. xml. rpc. ParameterMode. IN );
Call. addParameter (new QName (soapaction, "PostFixNumber"), // set the parameter to be passed
Org. apache. axis. encoding. XMLType. XSD_STRING,
Javax. xml. rpc. ParameterMode. IN );
Call. setReturnType (new QName (soapaction, "DirectSend"), 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 + "DirectSend ");
Vector v = (Vector) call. invoke (new Object [] {UserID, Account, Password, Phones, Content, SendTime, SendType, PostFixNumber}); // 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 [])
{
MyWebServices pw = new MyWebServices ();
}
}
Author "sljackson"