Java Call (AXIS2) WebService pass Object type parameter (source code)

Source: Internet
Author: User
Tags soap

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.