Provides the WSDL address of the WebService, how to generate the consumer (client), how to invoke the WSDL interface already provided

Source: Internet
Author: User
Tags wsdl

1. Create a new Java project, and then create a new Web service client.

2. Enter the WSDL address

3, the generated consumer end directory is as follows

How to call interfaces based on the WSDL address provided (handling of parameters and return values)

1  Public StaticMap<string, object>queryrecordmsg (String contno) {2         3Map<string,object> Rootresult =NewHashmap<string,object>();4         Try{5Underwritinghistoryinformationquerysrvbindingqsservice Service =NewUnderwritinghistoryinformationquerysrvbindingqsservice ();6Underwritinghistoryinformationquerysrvporttype PortType =Service.getunderwritinghistoryinformationquerysrvbindingqsport ();7Sysmsgheader Parametersreqheader =NewSysmsgheader ();8 Parametersreqheader.setmsgid (Maketransno ());9 parametersreqheader.setmsgdate (Dateutil.getcurrentdatestr ());TenParametersreqheader.setmsgtime (DATEUTIL.GETCURRENTTIMESTR () + ". 000"); OnePARAMETERSREQHEADER.SETSERVCD ("P00001000884"); APARAMETERSREQHEADER.SETSYSCD ("055"); -Parametersreqheader.setbizid ("03_02_01_i01"); -Parametersreqheader.setbiztype (""); thePARAMETERSREQHEADER.SETORGCD ("86"); -PARAMETERSREQHEADER.SETRESCD (""); -Parametersreqheader.setrestext (""); -PARAMETERSREQHEADER.SETBIZRESCD (""); +Parametersreqheader.setbizrestext (""); -Parametersreqheader.setver ("110.100.000"); +             //Business Messages ACom.newchinalife.service.bd.p00001000884.SrvReqBody Parametersreqbody =Newcom.newchinalife.service.bd.p00001000884.SrvReqBody (); at             //Business Message Header -Srvreqhead Srvreqhead =NewSrvreqhead (); -Srvreqhead.setoperator ("EBT"); -Srvreqhead.setrownumstart ("1"); -Srvreqhead.setpagerownum ("10"); -Srvreqhead.setpageflag ("0"); inSrvreqhead.settotalrownum (""); -Srvreqhead.setorderflag ("0"); toSrvreqhead.setorderfield (""); + Parametersreqbody.setbizheader (srvreqhead); -             //Business Newspaper Style theCom.newchinalife.service.bd.p00001000884.SrvReqBizBody Srvreqbizbody =Newcom.newchinalife.service.bd.p00001000884.SrvReqBizBody (); *Com.newchinalife.service.bd.p00001000884.InputData Inputdata =NewCom.newchinalife.service.bd.p00001000884.InputData (); $Inputdata.setpolno (CONTNO);//Deposit Insurance NumberPanax Notoginseng Srvreqbizbody.setinputdata (inputdata); - parametersreqbody.setbizbody (srvreqbizbody); the             //Initialize the Response object +Holder<sysmsgheader> Parametersresheader =NewHolder<sysmsgheader>(); AHolder<com.newchinalife.service.bd.p00001000884.srvresbody> Parametersresbody =NewHolder<com.newchinalife.service.bd.p00001000884.srvresbody>(); the porttype.underwritinghistoryinformationquery (Parametersreqheader, Parametersreqbody, ParametersResHeader, Parametersresbody); +String ResultCode =parametersResHeader.value.getBizResCd (); -String resultmsg =ParametersResHeader.value.getBizResText (); $Log.error ("according to the insurance Number:" +contno+ "Check the underwriting operation history, ResultCode:" +resultcode+ ", resultmsg:" +resultmsg); $listNewArraylist();  -              -             if("0". Equals (ResultCode)) { thelist<com.newchinalife.service.bd.p00001000884.result> results =parametersResBody.value.getBizBody (). Getoutputdata (). GetResult (); -                  for(Com.newchinalife.service.bd.p00001000884.Result result:results) {Wuyihashmap<string, object> resultmap =NewHashmap<string,object>(); theResultmap.put ("RowNo", Result.getrowno ()); -Resultmap.put ("Polno", Result.getpolno ()); WuResultmap.put ("Opertor", Result.getoperator ()); -Resultmap.put ("StartDate", Result.getstartdate ()); AboutResultmap.put ("Endate", Result.getenddate ()); $Resultmap.put ("state", Result.getstate ()); - Resultlist.add (resultmap); -                 } -             } ARootresult.put ("ResultCode", ResultCode); +Rootresult.put ("Resultmsg", resultmsg); theRootresult.put ("Resultlist", resultlist); -             returnRootresult; $}Catch(Exception e) { the e.printstacktrace (); the         } the         returnRootresult; the}

Summarize:

The above code are related to the project, I hope to help you, if there is a problem, can QQ contact.

Provides the WSDL address of the WebService, how to generate the consumer (client), how to invoke the WSDL interface already provided

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.