WebService common client Code

Source: Internet
Author: User

Package test;

Import Javax.xml.namespace.QName;
Import Org.apache.axis.client.Call;
Import Org.apache.axis.client.Service;
Import Org.apache.axis.description.OperationDesc;
Import Org.apache.axis.description.ParameterDesc;

public class TestWS2 {

public static void Main (string[] args) {

try {

Web Service Path

String endpoint = "Http://10.1.3.142:8001/ats/GetUserFund";

String endpoint = "Http://10.1.3.113/ls/services/ATSTransWSService";

Operationdesc oper = new Operationdesc ();

Getextendsystemxmldata method of->web service for invocation

Oper.setname ("Getextendsystemxmldata");

Parameterdesc param = new Parameterdesc (New Javax.xml.namespace.QName ("", "arg0"), parameterdesc.in,

New Javax.xml.namespace.QName ("Http://www.w3.org/2001/XMLSchema", "string"), Java.lang.String.class, False, false);

Oper.addparameter (param);

Oper.setreturntype (New Javax.xml.namespace.QName ("Http://www.w3.org/2001/XMLSchema", "string"));

Oper.setreturnclass (Java.lang.String.class);

Oper.setreturnqname (New Javax.xml.namespace.QName ("", "arg0"));

Oper.setstyle (Org.apache.axis.constants.Style.RPC);

Oper.setuse (Org.apache.axis.constants.Use.ENCODED);

Service service = new service ();

Call Call Service.createcall ();

Call.settargetendpointaddress (new Java.net.URL (endpoint));

Call.setusesoapaction (TRUE);

Call.setsoapactionuri ("");

Call.setoperation (oper);

Call.setoperationname (New QName ("http://impl.getUseFund.webservice.ats.fund.hundsun.com/", " Getextendsystemxmldata "));

Request XML for document specification;

String xmlstr = "<?xml version=\" 1.0\ "encoding=\" utf-8\ "?>"

+ "<packet type=\" request\ "version=\" 1.0\ ">"

+ "<HEAD>"

+ "<REQUEST_TYPE>09</REQUEST_TYPE>"

+ "<SYSTYPE>101</SYSTYPE>"

+ "</HEAD>"

+ "<BODY>"

+ "<DETAILITEM>"

+ "<RECORDSOURCE_BATNO>2590</RECORDSOURCE_BATNO>"

+ "<ORIGIN_NOTE>5138</ORIGIN_NOTE>"

+ "</DETAILITEM>"

+ "</BODY>"

+ "</PACKET>";

Res-> return document standard receipt xml,xmlstr-> document specification request XML

string res = (string) call.invoke (new object[] {xmlstr});

System.out.println (RES);

} catch (Exception e) {

E.printstacktrace ();

}
}
}

WebService common client Code

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.