ImportOrg.apache.axis.client.Call;ImportOrg.apache.axis.client.Service;/*** @ClassName: Testaxis * @Description: TODO (Describe the role of this class) *@authorroy_70* @date April 18, 2017 morning 9:16:26 **/ Public classTestaxis { Public Static voidMain (string []args) {string Inconditions= "<?xml version=\" 1.0\ "encoding=\" utf-8\ "?><rows><info><sbm>*</sbm></info> <ROW><GMSFHM> Citizenship number </GMSFHM><XM> name </XM></ROW><ROW><GMSFHM> 110101******</gmsfhm><xm> Li Yu </XM><FSD>100600</FSD><YWLX> Personal Loans </YWLX> </ROW><ROW><GMSFHM>3624221952123***</GMSFHM><XM> Lee Smell </xm><fsd>100600 </FSD><YWLX> Personal Loans </YWLX></ROW><ROW><GMSFHM>1234********</GMSFHM>< Xm> Wang Long </XM><FSD>100600</FSD><YWLX> bank account opening </YWLX></ROW><ROW><GMSFHM >110101******</GMSFHM><XM></XM><FSD>100600</FSD><YWLX> Personal car Loan </YWLX> </row><row><gmsfhm>110101******</gmsfhm><xm></xm><fsd>100600</fsd ><ywlx></ywlx></row><row><gmsfhm>230602***</gmsfhm><xm></xm ><fsd>100600</fsd><ywlx> Personal car Loan </YWLX></ROW></ROWS> " ; String Inlicense= "********"; Try{ //Call WebService AddressString url = "Https://www.****.com/services/nciicservices"; //Call Method NameString method= "Nciiccheck"; Service Service=NewService (); //Create a Call object from a serviceCall call =(call) Service.createcall (); //Set up service addressCall.settargetendpointaddress (NewJava.net.URL (URL)); //setting the Calling methodCall.setoperationname (method); Call.setusesoapaction (true); //add a few more parameters to the method//Inlicense is the parameter name, xsd_string is the parameter type, in represents the incomingCall.addparameter ("Inlicense", org.apache.axis.encoding.xmltype.xsd_string,javax.xml.rpc.parametermode.in); Call.addparameter ("Inconditions", org.apache.axis.encoding.xmltype.xsd_string,javax.xml.rpc.parametermode.in); //Set return typeCall.setreturntype (Org.apache.axis.encoding.XMLType.XSD_STRING); Object ret=NULL; Try{ //using the invoke Invoke method, the object data is placed in the passed parameter valueret = Call.invoke (Newobject[] {inlicense,inconditions}); }Catch(Exception e) {e.printstacktrace (); } //Output SOAP Request messageSystem.out.println ("--soap Request:" +Call.getmessagecontext (). Getrequestmessage (). getsoappartasstring ()); //output SOAP return messageSystem.out.println ("--soap Response:" +call.getresponsemessage (). getsoappartasstring ()); //Output return informationSystem.out.println ("result===" +ret.tostring ()); }Catch(Exception e) {e.printstacktrace (); } } }
The following is the output result information:
--soap Request: <?xml version= "1.0" encoding= "UTF-8"? ><soapenv:envelope xmlns:soapenv= "/http/ schemas.xmlsoap.org/soap/envelope/"xmlns:xsd=" Http://www.w3.org/2001/XMLSchema "xmlns:xsi=" http://www.w3.org/ 2001/xmlschema-instance "><soapenv:body><nciiccheck soapenv:encodingstyle="/http schemas.xmlsoap.org/soap/encoding/"><inlicense xsi:type=" xsd:string ">*****</inLicense>< Inconditions xsi:type= "Xsd:string" >*****</inconditions></nciiccheck></soapenv:body></ Soapenv:envelope>--soap Response: <?xml version= "1.0" encoding= "UTF-8"? ><soap:envelope xmlns:soap= "http ://schemas.xmlsoap.org/soap/envelope/"xmlns:xsd=" Http://www.w3.org/2001/XMLSchema "xmlns:xsi=" http://www.w3.org /2001/xmlschema-instance "><soap:body><ns1:nciiccheckresponse xmlns:ns1=" https://api.nciic.org.cn/ Nciicservices "><NS1:OUT>&LT;? XML version="1.0" encoding=" Utf-8"? >< RESPONSE Errorcode="-72" code="0" countrows="1">< rows>< row>< errorcode>-72</errorcode>< errormsg>ip& #x5730;& #x5740;& #x53D7;& #x9650; </errormsg></row> ; </rows></response></ns1:out></ns1:nciiccheckresponse></soap:body ></soap:envelope>result===<?xml version= "1.0" encoding= "UTF-8"? ><response errorcode= " -72" code= " 0 "countrows=" 1 "><ROWS><ROW><ERRORCODE>-72</ERRORCODE><ERRORMSG>IP address limited </ Errormsg></row></rows></response>
Java calls the WebService axis implementation