.Net Compact Framework 调用 Java WebService

 

AuthorQuietwalk

Date2010-9-27

 

.Net Compact Framework 调用 Java WebService ,与访问 IIS中的没什么区别,引用方法也相同,只是需要注意,默认端口 8080也被封了,需要换成其它的端口就可以了。记得以前在.Net 下时被 80 端口阻挡了有一两天的样子,愣是不知道问题出在哪儿,还以为是WS发布出错,一直找IIS的配置问题,不过也好,IIS配置也被我折腾熟了,呵呵,废话少说,上代码以备忘。

 

   

 

关键代码如下:

using GPRSTest.CommonFunctionService;//.net webservice  http://固定IP:87/CommonFunctionService/Service.asmx

 

using GPRSTest.jwsHelloWorld;//java webservice  http://固定IP:8087/ws/wsjdWebService/HelloWorld?wsdl

 

//PDA调用.Net Webservice

  private void btnResult_Click(object sender, EventArgs e)

        {

            this.btnResult.BackColor = Color.Yellow;

 

            int a = Convert.ToInt16(this.tbA.Text.Trim());

            int b = Convert.ToInt16(this.tbB.Text.Trim());

 

            DateTime dtStart = DateTime.Now;

 

            CommonFunctionService.Service cs = new Service();

 

            int iResult = cs.intAdd(a, b);

 

            this.lbHelloWorld.Text = cs.HelloWorld();

 

            DateTime dtEnd = DateTime.Now;

 

            this.lbInfo.Text ="所用时间:  "+QuietwalkClassLibrary.CommonFunctions.GetTimeSpan(dtStart, dtEnd).ToString()+"";

 

 

            this.tbResult.Text = iResult.ToString();

        }

 

//PDA调用Java Webservice

private void btnJavaWS_Click(object sender, EventArgs e)

        {

            this.btnJavaWS.BackColor = Color.Yellow;

            DateTime dtStart = DateTime.Now;

 

            jwsHelloWorld.HelloWordImplService sv = new HelloWordImplService();

 

          

            this.tbJavaResult.Text = sv.getHellWord();

 

            DateTime dtEnd = DateTime.Now;

 

            this.label4.Text = "所用时间:  " + QuietwalkClassLibrary.CommonFunctions.GetTimeSpan(dtStart, dtEnd).ToString() + "";

 

        }

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值