Java calls the. NET WebService interface using AXIS2

Source: Internet
Author: User

/**
* Test Abnormal pen number, refund processing
* @return
*/
public static String Refundhandle () {
Logutil.info ("=============== Call Refund interface starts =================");
try {

Propertiesutil proputil = new Propertiesutil ("Refundinf.properties");
Properties pros = proputil.getproperties ();
String WebServiceURL = Pros.getproperty ("WebServiceURL");
String actionstr = Pros.getproperty ("Actionstr");
String actionname = Pros.getproperty ("ActionName");

Rpcserviceclient ser = new Rpcserviceclient ();
Options options = Ser.getoptions ();

Specifies the URL to call WebService
EndpointReference Targetepr = new EndpointReference ("Http://172.16.28.100:8089/PayAPICall.asmx");
EndpointReference Targetepr = new EndpointReference (WebServiceURL);
Options.setto (TARGETEPR);
Options.setaction ("namespace/ws method name");
Options.setaction ("Http://www.hwsoft.com/RefundCallService");
Options.setaction (ACTIONSTR);

Specifying the parameter value of the Sfexpressservice method
object[] Opaddentryargs = new object[] {"Test"};
Class object specifying the data type of the Sfexpressservice method return value
Class[] classes = new class[] {string.class};
Specify the Sfexpressservice method to invoke and the namespace of the WSDL file
QName opaddentry = new QName ("http://www.hwsoft.com/RefundCallService/", "Refundcallservice");
QName opaddentry = new QName (actionstr+ "/", actionname);
Call the Sfexpressservice method and output The return value of the method
object[] str = ser.invokeblocking (Opaddentry, Opaddentryargs, classes);
String sss = str[0].tostring ();
Logutil.info ("=============== Call Refund interface succeeded =================" +SSS);
return SSS;
} catch (Axisfault e) {
TODO auto-generated Catch block
E.printstacktrace ();
Logutil.info ("=============== Call Refund Interface error =================" +e.getmessage ());
}
return null;
}

Java calls the. NET WebService interface using AXIS2

Related Article

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.