webService接口的定义、发布和使用.docx

上传人:牧羊曲112 文档编号:4926076 上传时间:2023-05-23 格式:DOCX 页数:13 大小:484.10KB
返回 下载 相关 举报
webService接口的定义、发布和使用.docx_第1页
第1页 / 共13页
webService接口的定义、发布和使用.docx_第2页
第2页 / 共13页
webService接口的定义、发布和使用.docx_第3页
第3页 / 共13页
webService接口的定义、发布和使用.docx_第4页
第4页 / 共13页
webService接口的定义、发布和使用.docx_第5页
第5页 / 共13页
亲,该文档总共13页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《webService接口的定义、发布和使用.docx》由会员分享,可在线阅读,更多相关《webService接口的定义、发布和使用.docx(13页珍藏版)》请在三一办公上搜索。

1、webService接口的定义、发布和使用、准备工作(以下为本项目实例的使用工具)1、 MyEclipse-20132、JDK 1.7.0_80二、创建服务端(用来写接口和发布接口)1、新建一个【Web Service Project】项目,并为其命名,此项目命名为【MyService】Q MyEdiiase- Jhvb Enterpri-se - MyfElip-se Enttqa rise- WortcbefichFile EditRefactor N明iga怕 Search Project MyEdipw Run Mobile Window H亩口主 PackageTypeHier|-3

2、-七空白地右键NewShow InAJt+占h匾+W M 叫Ctrl4-CCapry Qualified Nenne国口如#CtrlVOeete迪 Import.Ezport.皆 Re4tIiF5曰 Preview in Motnle Web Simulator浦 Image Pre 以 电 nippetL| B寿_华或匆同EJb窜EJB ProjectIE nt er prise Application Pr ejectWeb ProjectApplication Client ProjectConntctor ProjectWeb Service ProjectJava ProjectRe

3、port Web Project Projrct.Peckafl5ClassInte-aceSource- Folde-rF-olderFileAppletHTML (Adi.anced TEpi日昵可JSP (AdvancedXHTML (Advanced Tern platesServletEJB3 Sessiofi BeenEJB3 Entity SeanEJB3 Driven BeenXML 他3心11匚” Template-5)XML (Basic Templates)XML SdieniaUML1 ModtlOther 伍 Problerni5应 Tasksd Web Braver

4、 Q Canide思 Servers 显 PncyKl Migiraticini Z3ProjKlStatus必 New Wet Service ProjectBrowse.Project tonEgurationJAX-ws此处选ftjAX-WS,其他默认即可-WebServices Framework;JavaEE 6 - Web 3.0可以选择本地安装的jdk,也可以默训Java version:J STL Version;Target runtimeMyEdipse Generic Runtime for JavaEE 6.0Add New Runtime.EAR project na

5、me: EARWorking 皿sWorking 5已t5:Select.直接点Finish即可FinishCancelJava EE version:EH Add maven supportJAX-WS version:EAR membershipAdd project to an EARProject locationp Use d&fault location2| Add project to working EatsNew Web Service ProjectWeb,service project creation d&tailsProject name: M脩日rvE日此处房项目宅

6、称Loction: E:WorkspayEclipseiMyerviceL巴niti m自 Nbciut M8ven4MyE(rlii3sa.2、创建【Class类,命名为【ServiceHelloWord】,位于【com.casj.service】包下&登New A岑. apeni in New Windowperil Type Hierarchy Show InF4Alt+Eh;ft+WOS CopyFj Copy dualized Name 值 PasteK DeleteLtrl-CCtrl-VDeleteBuild PothSourceRefactorAh4 ShiftS Alfz+h

7、ift4-T1 I mpOrtsrr ij Export,.,詹 RefreshAssign WorkingF5日 ImageRun AsDebug AzProfile AsTeBmiCom pare- WithRestore -From Local History,.q Preview in Mobile Wc& Simulia car密 MyEclipsePrapertiesA. It* Enterv 笛 MyServiceEJB ProjectEnterpriEff Aipplicatian Project Web Prcrjr-rtApplication Client Project

8、Connector Project Web Seutvicb PrcjedE Jwai ProjectRepoift Web ProjectProjed.PackageClassInterfaceSouirce FoldeirFoldeirFileAppletHTML Advanced Templates JSP (Advanced Terriplate) XHTML (Ad/aneed Templates) ServletEJB? Seseidhi BeanEJB3 Entity BranEJB3 MtsMge Driven Bran XML Advanced Templates XJML

9、(Basic Templates- XML SchemaUML1 Model3 Other.Ctrl-hlModifiers: public O default ) private protectedabstract | finalstaticEZI Constructors from up日rd日弱0Inherited abstract methodsDo you want to add comments? Configure teirnplates and default value herd Generate comments.3、编写供客户端调用的方法,即编译方法代码。H l Serv

10、iceHellaWcrd.jatfa S3 paakaae -som - easj 一 servlc g;import j avaa . jwa- RTtbServicE j定要注意引用的是哪个包1 sport avax . kjlI - ws. EuHpaj. 口匕;|京坎5-二 就是你要实现投布的接口return tieLiu + prama:| 6/* Qiparaixi args */I pbbliu我Sb gid a&gMg arg= 发市服务端以下是岌布到本地,注意查看端是否被占用g/$ TDM JL.Ec:fqniM:rt_u:i rn三匕匕口d :匕业Er.dpc-i nt.

11、publ rh (11 http: / /13 7 .0.0.1: 90 90/Ser vic e/Se rviceHcl laWordBlpn 5 住 mu 3 二.:.是 土 .:.Syatenci. a izt. pr in c Let; | wseTvise- srziccesB ! 11);4、编译并发布Quck, Tpa HMrwEhyRrdbarlocal i-firlonDedmdoi*?Add do Snlppeis.WihShow In、讪1 pftT.fca0 Wb imbjq AsProfile MAapUcB kMlh IMpEctipHW SEnflHHkjWcyr

12、iBja .:褊:!. duj- . Hafaax?iea.!Otuc . mh . HS-lndpoini: .pblici flcxiiq flfecHeirSlSgruiflIpHeLlo p r-urAJ学LMdoT辨蛔Opan OElvHlonOpen Tjpe- H|占仆凸Fn右HnirMhyShM k EdAdcrunb Pre :黑 .Jtl SnippewCnRf匚a网 Quj|d Mama AarteQudi. FuCtd+Zt+SHH+WJClrl+VfPJallc clJLj-a aezviMZfilLcOaxa 1public 4 j tm ppIkjAian眼睥+咒

13、J卜 | JRE Syrtrm library j-aSt-i 6|J#ajEE ED banwk Libr TLH21U4fy* & bRonlB PBckw 就 *J lyppM T MwRJ npnrt. R: Vnrkmsc:A!= .MyErl -.WyC1 i RTtvc. -p -Lin. L.C15J. keep ll Ljj3. 0. 1 : 909(l/jtl/li_.e/oel viL.z:LelluVuL Llparsing WfSDL.ERROR. Invitlid WSDL htip :/127. 0. C. 1 :QiOQO SsrvLce/ServiceH&ll

14、oWord, ?5ipectecl jn I Lp ;AllliSUtlp.Ll=!l i:li LluElii fLLtlL. lLllL i I (lijlfc! 1)bailed t。res.d the MEL docunent: lttp : /127. C. ). 1: 0090/Sevice/Servi sellelloWord .because 1) could not line he docmiEnT: /2.) the document could not be read: 3) the root cl cincrt of the de current ic r.o : ic

15、f ini-ijnc.ERROR. fiiltLl. i.uihiL x i jt-CLuld nul fli.lI wadi: tHi vlchi In liiz: pi uv1l1=ilI V3DL (s::At least one VLDL ivith at least jr.e servi搜狗拼音输入法全:下面是正确的3、在工作空间右键刷新一下N PackageType Hi era 目m 田 com.casj.clientJ GetWord.java|J | GetWordR.esponse.javaT Obj ectFactoryjavsL package-info .javaJ

16、Servi ceHel loWordjavs|J | ServiceHelloWordGervice.ji 也 J RE System Library JavaSE-1.6 B, JavaEE &.0 Generic Library 虱&TL 1.2.1 Library & W&bR.cx?-t MyServi ce如果在其他地方生成,只需将生成的包拷贝或剪切到项目中即可4、开始调用-Pock祯虐菱.t* Type Hier 口 Qj TestGlenLjdv 发v MyCJieni:v 理 src r0 com.cBij.diQrTthiwuic com-CAJj .clleaii.t:.!

17、Lxiox-c coft. oam】.!w 申 t Dm.tr-FfC Drift pi iYpxim|T| TeEleirjavd W JRE Sjflem Library m占SE i rtisvaEE fi.-D tenrrE Librisy gUSH 121 Ubrary* & WrtjHoolpoiDlic olae iBia-rCLlanE. ;Eparui n.1*口鼻patella static vw-id rrjiiji IScrjLrml J arTBj / TCOO Auc-a-ceTieT-B cel netbod scuto5=r-lctKJcllaiozd hell

18、nilczd - tie 5ezvc-ntl lplfcra5ervlce (|.SezvaoeSel loWardFarc f | /Erruia reaulr htllDKariS. geclloid. | WaraR | j生成自己的包和类进行传参和调用编译跟执行测试类1. Prablems Tasks Web Broker 曰 Console S3 4fi Severs Project Migrationterrninested? TrstCilent Jpvci Application O:Program FilF5Mydip5c Pcilrjs,iiDni!Pi1biniiryi:

19、JDm5Ljn.jiayMjdk,win,2.K06 64:1.6,O.u43binjij程 belles Word调用成功四、报错1、客户端jdk版本低于服务端版本土 iPtcghlMiiK 后 T# W血曰 Conscil。房 命 Arvem- K 峙tefTminated Service-1-1 el Io Jaba Applk*atkin| C:jF rcigr2im_FilM!IMiE-cSpem 口 nBinaryiam.m、ma_jdk zrin52.Tifib_fi4_l .O 01 hinavaw-eve- 2014-10|Except5.011 Iri thirld ift

20、filrtH Oili-jn-Xill. iriLiMii -W .iHJLul-RurN irrMIo二lin: n!姑 nuiiifler* e-rrur*: LJrppe心姑 Qrnhan. n3. sun. ml. M t h mal.就-ri*dl- RuhtlMEfkxlele r - getc l-as t BuntlwModNer由心56cop . sun B Knl. int emal. we nwis 1.Funit ineFkxielercdt , sun. panl ,intt rnal Pk?5 rVMMkl. Runt inrHodeler, pnxe s sHet

21、fiod f Rjunti-efiodclb-ipvu:同4:eDr. sun.xml .ifiten.l.ws- .node 1.Rurtiiencdeler.procesCLdsrRmkinteMad-ler.jhYBTmcor. sun.网1.1伯trmal.ws.node 1.Runtiucflodeler .buildRluntineModel(RuntlncHoteHr. j睥乱)wci sajh vtI .interns .W5 $-rvb Endmitf故tov. irg/tMEIHodHr EndDoirrtmuM ”明:掰)con. xun-ktiI .iraternal.

22、w%. teruer.Endpcirrtl actory.cre日t.Enriuui.rrh:lEndpoint:Fisi1:cir.目*目:少,白) cun, %4jn_ jnnl. inttfmal“w%.dpi,ser ver.HbtudpcinL.credtt1 CWSHiijpHjjj止.:4Jcan. BiinrMiil a,w& epi的Efldpoiint cre*(MSEndpo:i毗彻寻;5cnr. sun.xhiI . intrrna j.w% trHn-iport .http, rrrr FncminizTranJ. crf3LEndpoBnI:fEndinl.crejteAnd PubLihEHJtKdnt.f色rirtul 让蚌训;92)at jav-dx.Kml.vvs.Endpaint.pwbli.Eht ERAroinL 福松;17m2、在命令提示窗执行生成命令src路径不可以含有空格假如路径为 E:WorkspacesMyEclipse1My Clientsrc会提示E:WorkspacesMyEclipse1My好了,祝学业有成,大家工作顺利,你可以写自己的webService接口去了!

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号