Package cn. cehb;
Import java.net. MalformedURLException;
Import java. rmi. RemoteException;
Import org. apache. axis. client. Service;
Import org. apache. axis. client. Call;
Import javax. xml. namespace. QName;
Import javax. xml. rpc. ParameterMode;
Import javax. xml. rpc. ServiceException;
Class Test {
/**
* @ Param args
*/
Public static void main (String [] args) throws MalformedURLException, ServiceException, RemoteException {
String endpoint = "http: // localhost/WebService. asmx ";
Call call;
Object res = "";
Service service = new Service ();
Try {
Call = (Call) service. createCall ();
String cit_account = "123 ";
String cit_pwds = "123 ";
String cit_userkeys = "1234 ";
Call. setTargetEndpointAddress (new java.net. URL (endpoint ));
Call. setOperationName (new QName ("http: // WebService/", "GetUserInfo"); // name of the published Method
// Three parameters, which must be the same as the name in the net interface. The type should be String
Call. addParameter ("cit_account", org. apache. axis. encoding. XMLType. XSD_STRING, ParameterMode. IN );
Call. addParameter ("cit_pwd", org. apache. axis. encoding. XMLType. XSD_STRING, ParameterMode. IN );
Call. addParameter ("cit_userkey", org. apache. axis. encoding. XMLType. XSD_STRING, ParameterMode. IN );
Call. setReturnType (org. apache. axis. encoding. XMLType. XSD_STRING );
Call. setUseSOAPAction (true );
// Note that the address has been referenced by the method name. Find from the net interface
Call. setSOAPActionURI ("http: // \ WebService/GetUserInfo ");
Res = call. invoke (new Object [] {cit_account, cit_pwd, cit_userkey });
// Return value String
System. err. println ("= 11 =>" + res );
} Catch (ServiceException e ){
E. printStackTrace ();
} Catch (MalformedURLException e ){
E. printStackTrace ();
} Catch (RemoteException e ){
E. printStackTrace ();
} Catch (Exception e ){
E. printStackTrace ();
}
Finally {
}
}
}