Java calls netwebservice -- soap, netwebservice -- soap

Source: Internet
Author: User

Java calls netwebservice -- soap, netwebservice -- soap

Java calls netwebservice -- soap:

Try {

String url = "http: // 192.168.12.106/yhcapp/MesServerMng. asmx? Wsdl ";
Service service = new Service ();
Call call = (Call) service. createCall ();
Call. setTargetEndpointAddress (new java.net. URL (url ));

// The interface name described in the WSDL. The parameter description is: QName ("namespace in xml", "method name ");
Call. setOperationName (new QName ("http://www.hustcad.com/InteCAPP/XMLWEBServices/", "Mes_ProjectInfo "));

// ProjectNo is a parameter in the Mes_ProjectInfo method. If there are multiple parameters, copy one line. Pay attention to the following type -- XSD_STRING
Call. addParameter (newQName ("http://www.hustcad.com/InteCAPP/XMLWEBServices/", "ProjectNo"), org. apache. axis. encoding. XMLType. XSD_STRING, javax. xml. rpc. parameterMode. IN); // Interface Parameters
Call. setReturnType (org. apache. axis. encoding. XMLType. XSD_STRING); // you can specify the return type.
Call. setSOAPActionURI ("http://www.hustcad.com/InteCAPP/XMLWEBServices/Mes_ProjectInfo"); // This must be added without an error
String ProjectNo = "data to be imported"
String result = (String) call. invoke (new Object [] {ProjectNo}); // separate multiple variables with commas
System. out. println ("returned result:" + result );

} Catch (Exception e ){
System. out. println (e. getMessage ());
}

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.