Warm tip: Axis2 jar bag yo
public static String Pubremotefuc () {
String endpoint = "HTTP://CNBLOGS.COM/QGC/XXXX/SERVICE?WSDL";
String result = "error";
Service service = new service ();
Call call;
//Parameter Object
Searchinfovo d=new Searchinfovo ();
d.setname ("Jian Li");
d.setcardnum ("44xxxxx");
object[] Object = new object[1];
Object[0] = D;//object is the parameter used to store the method
try {
Call = (call) Service.createcall ();
Call.settargetendpointaddress (endpoint);//Remote Call path
QName qn = new QName ("http://nciic.com.cn", "check"); namespace of the interface,please fill in according to your actual interface,and method Name: <soap:envelope xmlns:soap= "Http://www.w3.org/2003/05/soap-envelope" xmlns:nci= "http://nciic.com.cn"
Call.setoperationname (QN);
Sets the type of the parameter (here is the entity object "Searchinfovo") HTTP://CNBLOGS.COM/QGC
call.registertypemapping (SEARCHINFOVO.CLASS,QN,
New Beanserializerfactory (Searchinfovo.class, qn),
New Beandeserializerfactory (Searchinfovo.class, qn));
call.addparameter ("arg0", QN, parametermode.in); "arg0" do not change yo, I have only one parameter here, and the parameter is an entity object HTTP://CNBLOGS.COM/QGC
Set parameter name: HTTP://CNBLOGS.COM/QGC
Call.addparameter ("name",//Parameter name
xmltype.xsd_string,//parameter type: STRING
parametermode.in);//Parameter mode: ' In ' or ' out '
/*/Set parameter name: HTTP://CNBLOGS.COM/QGC
Call.addparameter ("Cardnum",//Parameter name
xmltype.xsd_string,//parameter type: STRING
parametermode.in);//Parameter mode: ' In ' or ' out '
Set parameter name: HTTP://CNBLOGS.COM/QGC
Call.addparameter ("Citizenid",//Parameter name
xmltype.xsd_string,//parameter type: STRING
parametermode.in);//Parameter mode: ' In ' or ' out '
*//Set return value type:
Call.setreturntype (xmltype.xsd_string);//return value type: STRING
Call.setreturntype (xmltype.xsd_string);//return value type: STRING
result = (String) call.invoke (object);//Remote Call
System.out.println (result);
} catch (Serviceexception e) {
E.printstacktrace ();
} catch (RemoteException e) {
E.printstacktrace ();
}
return result;
}
public static void Main (string[] args) throws Exception {
PUBREMOTEFUC ();//Call
}
Java Call (AXIS2) WebService pass Object type parameter (source code)