• 大小: 1.08MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-29
  • 语言: Java
  • 标签: cxf  spring  web  service  

资源简介

本程序通过CXF-Spring框架来发布一个Webservice(相当于后台,在这里访问数据库),然后由表示层C#来调用其方法。本例子所实现的是从数据库获得的数据通过webservice,显示在C#前台的DataGrid里面。CXF的jar包请本人自己下载。【注意:本人忘记把下面内容放入文档中】本人采用了JNDI来连接数据库。tomcat里面的配置:在%tomcat%\conf\下面有个context.xml文件。在之间添加 就ok了!!希望共同进步!!

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CxfApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {

          //第一种方法:
            CxfApp.localhost.HelloWorld hw = new CxfApp.localhost.HelloWorld();

            CxfApp.localhost.stringArray[] arrays =hw.userinfo();

  //第二种方法:
   //如果是用wsdl.exe生成的类,直接可以使用
           //HelloWorld hw = new HelloWorld();
           //stringArray[] arrays =hw.userinfo();

           DataSet ds = new DataSet();
           DataTable dt = new DataTable();

           ds.Tables.Add(dt);
            
           ds.Tables[0].Columns.Add(“id“typeof(Int32));
           ds.Tables[0].Columns.Add(“name“ typeof(string));
           ds.Tables[0].Columns.Add(“age“ typeof(Int32));
            
           for (int i = 0; i < arrays.Length; i++)
           {
               Console.Write(“第“+(i+1)+“行     “ + arrays[i].item.GetValue(0));
               Console.Write(“     “ + arrays[i].item.GetValue(1));
               Console.Write(“     “ + arrays[i].item.GetValue(2));
               Console.WriteLine();

               DataRow dr = ds.Tables[0].NewRow();
              

               dr[0] = arrays[i].item.GetValue(0);
               dr[1] = arrays[i].item.GetValue(1);
               dr[2] = arrays[i].item.GetValue(2);

               ds.Tables[0].Rows.Add(dr);
                 
               
           }
       

           this.dataGridView1.DataSource = ds.Tables[0];
         
          

        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1261  2009-04-29 17:05  java-C#\c#\CxfApp\CxfApp.sln

    ..A..H.     17408  2009-04-30 17:35  java-C#\c#\CxfApp\CxfApp.suo

     文件       1835  2009-05-03 20:10  java-C#\c#\CxfApp\CxfApp\Form1.cs

     文件       5753  2009-04-30 15:04  java-C#\c#\CxfApp\CxfApp\CxfApp.csproj

     文件        850  2009-04-30 14:49  java-C#\c#\CxfApp\CxfApp\app.config

     文件        465  2009-04-29 17:03  java-C#\c#\CxfApp\CxfApp\Program.cs

     文件        718  2009-04-29 17:08  java-C#\c#\CxfApp\CxfApp\CxfApp.csproj.user

     文件       2901  2009-04-29 17:23  java-C#\c#\CxfApp\CxfApp\Form1.Designer.cs

     文件       5814  2009-04-29 17:23  java-C#\c#\CxfApp\CxfApp\Form1.resx

     文件       1852  2009-05-03 20:10  java-C#\c#\CxfApp\CxfApp\Form1.cs.bak

     文件      11887  2009-04-29 14:40  java-C#\c#\CxfApp\CxfApp\myProxy.cs

     文件       5612  2009-04-29 17:03  java-C#\c#\CxfApp\CxfApp\Properties\Resources.resx

     文件       1160  2009-04-29 17:03  java-C#\c#\CxfApp\CxfApp\Properties\AssemblyInfo.cs

     文件       2866  2009-04-29 17:03  java-C#\c#\CxfApp\CxfApp\Properties\Resources.Designer.cs

     文件       1672  2009-04-30 14:49  java-C#\c#\CxfApp\CxfApp\Properties\Settings.Designer.cs

     文件        489  2009-04-30 14:49  java-C#\c#\CxfApp\CxfApp\Properties\Settings.settings

     文件       5632  2005-12-08 14:51  java-C#\c#\CxfApp\CxfApp\bin\Debug\CxfApp.vshost.exe

     文件      28672  2009-04-30 15:04  java-C#\c#\CxfApp\CxfApp\bin\Debug\CxfApp.exe

     文件      38400  2009-04-30 15:04  java-C#\c#\CxfApp\CxfApp\bin\Debug\CxfApp.pdb

     文件     212992  2009-04-30 14:06  java-C#\c#\CxfApp\CxfApp\bin\Debug\Interop.MSxml2.dll

     文件        850  2009-04-30 14:49  java-C#\c#\CxfApp\CxfApp\bin\Debug\CxfApp.exe.config

     文件       5632  2005-12-08 14:51  java-C#\c#\CxfApp\CxfApp\bin\x86\Debug\CxfApp.vshost.exe

     文件      16384  2009-04-29 17:05  java-C#\c#\CxfApp\CxfApp\bin\x86\Debug\CxfApp.exe

     文件      19968  2009-04-29 17:05  java-C#\c#\CxfApp\CxfApp\bin\x86\Debug\CxfApp.pdb

     文件        656  2009-04-30 15:17  java-C#\c#\CxfApp\CxfApp\obj\CxfApp.csproj.FileList.txt

     文件        180  2009-04-30 14:15  java-C#\c#\CxfApp\CxfApp\obj\Debug\CxfApp.Properties.Resources.resources

     文件      28672  2009-04-30 15:04  java-C#\c#\CxfApp\CxfApp\obj\Debug\CxfApp.exe

     文件        180  2009-04-30 14:15  java-C#\c#\CxfApp\CxfApp\obj\Debug\CxfApp.Form1.resources

     文件     212992  2009-04-30 14:06  java-C#\c#\CxfApp\CxfApp\obj\Debug\Interop.MSxml2.dll

     文件        568  2009-04-30 14:06  java-C#\c#\CxfApp\CxfApp\obj\Debug\CxfApp.csproj.ResolveComReference.cache

............此处省略75个文件信息

评论

共有 条评论