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 ());
}