• .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() + "";

     

            }

     

     

  • 相关阅读:
    Hive(八)Hive的Shell操作与压缩存储
    Hive(七)Hive分析窗口函数
    Hive(六)内置函数与高级操作
    Hive(五)数据类型与库表操作以及中文乱码
    Hive(四)Hive的3种连接方式与DbVisualizer连接Hive
    iOS性能调优系列(全)
    iOS性能优化-内存优化
    iOS 25个性能优化/内存优化常用方法
    iOS CoreData版本升级和数据库迁移
    FMDB数据迁移
  • 原文地址:https://www.cnblogs.com/quietwalk/p/1836927.html
Copyright © 2020-2023  润新知