.net 调用java service 代理类方法
? ? 通過(guò)Svcutil.exe 工具生成代理類調(diào)用
????????????1.找到如下地址“C:\Windows\System32\cmd.exe” ?命令行工具,右鍵以管理員身份運(yùn)行(視系統(tǒng)是否為win7 而定)?
??????????? 2.輸入如下命令:"C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\SvcUtil.exe" /out:C:\WCFClint\ClientCode.cs /config:C:\WCFClint\app.config?http://localhost:81/WCFServiceTest/CNPatentSearchService.svc
????????????? 說(shuō)明:
??????????????參數(shù)1:??“C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\SvcUtil.exe”?? ,是指 SvcUtil.exe 工具的地址
????????????? 參數(shù)2:? “C:\WCFClint\ClientCode.cs ”?? ,是指生成的代理類輸出存放到的地址
??????????????參數(shù)3:? “C:\WCFClint\app.config ”?? ,是指存放到調(diào)用WCF服務(wù)程序目錄下的配置文件的輸出存放地址
????????????? 參數(shù)4: ?“http://localhost:81/WCFServiceTest/CNPatentSearchService.svc?”?? ,是指部署到IIS 的WCF服務(wù)的地址
??????????????
????????????3.運(yùn)行以上命令后,會(huì)在"C:\WCFClint\"目錄下生成兩個(gè)文件,ClientCode.cs? 和app.config
????????? (C:\WCFClint\app.config 中已經(jīng)為我們配置好了WCF服務(wù)的根節(jié)點(diǎn)等必須的信息,當(dāng)然,如果您也可以自己對(duì)部分參數(shù)進(jìn)行修改)
??????????? 4.將ClientCode.cs? 和app.config 添加到需要調(diào)用WCF服務(wù)的項(xiàng)目中
??????????? 5.在需要調(diào)用WCF服務(wù)的項(xiàng)目中添加對(duì)"System.ServiceModel" 和"System.Runtime.Serialization" 程序集的引用
????????????6.自此就完成了部署和代理類生成的所有操作,我們只需要在項(xiàng)目中實(shí)例化 ClientCode.cs 中的服務(wù)類 ,并調(diào)用其中的方法即可
我的實(shí)際操作 "C:\Program?Files?(x86)\Microsoft?SDKs\Windows\v7.0A\bin\SvcUtil.exe"?/out:C:\WCFClint\ClientCode.cs?/config:C:\WCFClint\app.config?http://local:8001/womaiapp/wmsServiceCancelAllocateout?wsdlMicrosoft?(R)?Service?Model?Metadata?Tool
[Microsoft?(R)?Windows?(R)?Communication?Foundation,?Version?3.0.4506.2152]
Copyright?(c)?Microsoft?Corporation.??All?rights?reserved.
Attempting?to?download?metadata?from?'http://local:8001/womaiapp/wmsServic
eCancelAllocateout?wsdl'?using?WS-Metadata?Exchange?or?DISCO.
Generating?files...
C:\WCFClint\ClientCode.cs
C:\WCFClint\app.config
C:\WINDOWS\system32>exit oracle ?查詢 使用 WmsCancelAllocateoutServiceClient client= new WmsCancelAllocateoutServiceClient(); blResult=("1" ==client.cancleAllocateout(allocateOut.AllocateOutNo,allocateOut.TargetWareHouseNo)); 發(fā)現(xiàn)dblink如果很慢可以用這種方式加個(gè)/*+driving_site(xxx)*/,查詢很快
?
轉(zhuǎn)載于:https://www.cnblogs.com/Blogs-Wang/p/6140624.html
總結(jié)
以上是生活随笔為你收集整理的.net 调用java service 代理类方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 15个最受欢迎的Python开源框架
- 下一篇: 高效的半同步/半异步模式的实现