动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > Java教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ Java教程 ]的信息

本月文章推荐
.EJB实质问题.
.J2EE中使用EntityBean和JDO的优缺.
.技术分析Java类加载内幕详细讲解.
.修改ReadMorePlugin.java,使其支.
.Servlet 2.5的新特点:适合你.
.jswdk的配置.
.WebLogic的研究之开发、部署EJB(.
.JavaSocket编程中的一个秘密类.
.手把手教你使用Java来编写ASP组件.
.分享关于Servlet2.5 的新特.
.Collections API定制实现(一).
.初始化基础类.
.我为什么没有使用Spring.
.Java 5.0多线程编程.
.Struts Controller.
.怎样处理Java最终化的内存保留问.
.Java1.5中新的静态导入特性.
.JAVA 编程规范.
.3D建模技巧.
.JScript 语法错误.

Microsoft.Net的Java实现

发表日期:2008-1-5 |



  众所周知,微软公司正在全力打造.Net,并预备将它作为向其他公司进攻的砝码,来保证其在业界的技术领先地位。 其实,微软公司在许多领域都处于领导地位,一些优秀的产品让其他公司难望其项颈,如操作系统
  ,办公软件等基于Windows平台的一些优秀的应用软件(如:IE)。但在美国,许多大公司非常反感微软一手包办的作风,也对微软的不放心,对其产品的安全性的担忧,所以大部分都用Unix 和Linux等非Windows平台,许多服务器也是用的非Windows平台,或是用自己开发的操作系统。但Windows的方便性和界面友好性及众多的工具也是其他平台难以比拟的(应该没什么争议的),而Unix和Linux平台似乎只适合一些专家。能不能找到一个桥梁将Windows产品同其他平台联系起来呢?目前有www.stryon.com公司正在实现这一点,开发了iNet,将Microsoft.Net转换成Java代码来实现跨平台。
  
  例如用Visual Studio.Net开发了一个Web Service程序:
  
  testClient.asmx:
  
  <%@ WebService Language="C#" Class="testClient" %>
  
  
  using System;
  
  using System.Web.Services;
  
  using System.Web.Services.Protocols;
  
  using System.Web.Services.Description;
  
  using System.XML;
  
  using System.Xml.Schema;
  
  using System.Xml.Serialization;
  
  using System.Data;
  
  
  public class testClient : WebService {
  
  
  [WebMethod()]
  
  public int testInt(int a,int b){
  
  return a+b;
  
  }
  
  
  [WebMethod()]
  
  public strUCt1 testStruct(struct1 a){
  
  return a;
  
  }
  
  
  [WebMethod()]
  
  public int[] testIntArr(int[] a){
  
  return a;
  
  }
  
  
  [WebMethod()]
  
  public struct1[] testStrArr(struct1[] a){
  
  return a;
  
  }
  
  
  [WebMethod()]
  
  public struct1 testStructAndArr(struct1 a,struct1[] b){
  
  return a;
  
  }
  
  
  [WebMethod()]
  
  public struct1[][] testStrManyArr(struct1[][] a){
  
  return a;
  
  }
  
  }
  
  
  public class struct1:parent{
  
  
  public int i=1;
  
  public string j="ok";
  
  public struct2 s2;
  
  }
  
  public class parent{
  
  
  public String p;
  
  }
  
  
  public class struct2{
  
  
  public String sField;
  
  }
  
  
  我们可以用il2java 工具转换成java代码(il2java工具可以在www.stryon.com 网站上下载,包括在iNet产品中),如:il2java http://localhost/testClient/testClient.asmx c:\temp,运行这个命令,将在c盘temp目录下产生 testClient.java 和testClient_Info.java:
  
  testClient.java:
  
  
  import system.*;
  
  import system.Reflection.*;
  
  import system.Web.Services.*;
  
  
  public class testClient extends WebService{
  
  
  public int testInt(int a, int b){
  
  return a+b;
  
  }
  
  
  public struct1 testStruct(struct1 a){
  
  return a;
  
  }
  
  
  public int[] testIntArr(int[] a){
  
  return a;
  
  }
  
  
  public struct1[] testStrArr(struct1[] a){
  
  return a;
  
  }
  
  
  public struct1 testStructAndArr(struct1 a, struct1[] b){
  
  return a;
  
  }
  
  
  public struct1[][] testStrManyArr(struct1[][] a){
  
  return a;
  
  }
  
  
  public testClient(){
  
  super();
  
  
  }
  
  }
  
  用来指明Web Service中有哪些Web方法,以便被客户调用;
  
  
  testClient_Info.java:
  
  
  import system.*;
  
  import system.Reflection.*;
  
  import system.Web.Services.*;
  
  
  public class testClient_Info implements IMetaData{
  
  
  public void fillType(Type t){
  
  long value = TypeAttributes.AnsiClass.value__ TypeAttributes.AutoLayout.value__ TypeAttributes.BeforeFieldInit.value__ TypeAttributes.Class.value__ TypeAttributes.Public.value__;
  
  TypeAttributes attributes = new TypeAttributes(value);
  
  t.set_Attributes(attributes);
  
  }
  
  
  public FieldInfo[] GetFieldsImpl(Type t){
  
  return new FieldInfo[0];
  
  }
  
  
  public ConstructorInfo[] GetConstructorsImpl(Type t){
  
  long value = 0;
  
  ConstructorInfo ctor = null;
  
  ParameterInfo param = null;
  
  MethodAttributes attributes = null;
  
  ParameterAttributes paramAttrs = null;
  
  java.util.Vector ctorVec = new java.util.Vector();
  
  
  // public testClient();
  
  value = MethodAttributes.HideBySig.value__ MethodAttributes.Public.value__ MethodAttributes.ReuseSlot.value__ MethodAttributes.RTSpecialName.value__ MethodAttributes.SpecialName.value__;
  
  attributes = new MethodAttributes(value);
  
  ctor = new ConstructorInfo(t);
  
  ctorVec.addElement(ctor);
  
  ctor.set_Attributes(attributes);
  
  ctor.set_Name("testClient");
  
  ctor.set_BindingFlags(BindingFlags.Public.value__ BindingFlags.Instance.value__);
  
  
  Object[] objs = ctorVec.toArray();
  
  ctorVec = null;
  
  ConstructorInfo[] ctors = new ConstructorInfo[objs.length];
  
  java.lang.System.arraycopy(objs, 0, ctors, 0, objs.length);
  
  return ctors;
  
  }
  
  
  public MethodInfo[] GetMethodsImpl(Type t){
  
  long value = 0;
  
  MethodInfo method = null;
  
  ParameterInfo param = null;
  
  MethodAttributes attributes = null;
  
  ParameterAttributes paramAttrs = null;
  
  java.util.Vector mdVec = new java.util.Vector();
  
  
  // public int testInt(int a, int b);
  
  value = MethodAttributes.HideBySig.value__ MethodAttributes.Public.value__ MethodAttributes.ReuseSlot.value__;
  
  attributes = new MethodAttributes(value);
  
  method = new MethodInfo(t);
  
  mdVec.addElement(method);
  
  method.set_Attributes(attributes);
  
  method.set_Name("testInt");
  
  method.set_ReturnType("System.Int32");
  
  method.set_BindingFlags(BindingFlags.Public.value__ BindingFlags.Instance.value__);
  
  value = 0;
  
  paramAttrs = new ParameterAttributes(value);
  
  param = new ParameterInfo(method);
  
  param.set_Attributes(paramAttrs);
  
  param.set_Name("a");
  
  param.set_ParamType("System.Int32");
  
  method.addParameterInfo(param);
  
  value = 0;
  
  paramAttrs = new ParameterAttributes(value);
  
  param = new ParameterInfo(method);
  
  param.set_Attributes(paramAttrs);
  
  param.set_Name("b");
  
  param.set_ParamType("System.Int32");
  
  method.addParameterInfo(param);
  
  
  // public struct1 testStruct(struct1 a);
  
  value = MethodAttributes.HideBySig.value__ MethodAttributes.Public.value__ MethodAttributes.ReuseSlot.value__;
  
  attributes = new MethodAttributes(value);
  
  method = new MethodInfo(t);
  
  mdVec.addElement(method);
  
  method.set_Attributes(attributes);
  
  method.set_Name("testStruct");
  
  method.set_ReturnType("struct1");
  
  method.set_BindingFlags(BindingFlags.Public.value__ BindingFlags.Instance.value__);
  
  value = 0;
上一篇:Java.util包简介如何开发应用之一 人气:520
下一篇:再谈客户端的Java技术 人气:482
浏览全部Java的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-12-1 MyBB v1.4.4 简体中文版 bulid 2
2008-12-1 新云网站内容管理系统 v4.0.0.11
2008-12-1 网趣网上购物系统时尚版 v8.8
2008-12-1 Textpattern v4.0.7 多国语言版
2008-12-1 Piwik ( PHP统计系统,可以和GOOG
2008-12-1 天空网络电影系统SKYUC! v2.6.2
2008-12-1 SiteDynamic企业网站管理系统 v1
2008-12-1 KindEditor HTML在线编辑器 v3.0
2008-12-1 0451sky高校教务管理系统2008 v4
2008-11-29 Tencent Traveler 4.4
2008-11-29 龙卷风网络收音机 v3.0.0.0
2008-11-29 Intel Chipset Software Install
2008-11-29 TweakVI 1.0 Build 1100
2008-11-29 Opera 9.62 Build 10469
2008-11-29 MPlayer WW编译版 SVN-r28044(20
2008-11-29 NetTools网络工具v1.0.0破解版
2008-11-29 3DGallery三维体验1.1破解版
2008-11-29 SecretBook保密本v1.0破解版
  发表评论
姓 名: 验证码:
内 容:
站长工具:网站收录查询 | Google PR查询 | ALEXA排名查询 | CSS在线编辑器 | OPEN参数生成器 | 弹出式窗口代码产生器 | 密码登录生成器 | 在线按钮生成器 | Meta标签生成器 | 多色彩特效字代码生成器 | 网页代码调试器 | 在线FTP登陆 | Flash取色器 | 配色代码对照表 | 配色辞典 | CSS生成器 | 广告代码 | 框架网页代码生成器 | js/vbs加密 | md5加密 | 进制转换 | UTF-8 转换工具 | 在线调色板 | Html转换js | Html转换asp | Html转换php | Html转换perl
实用工具:汉字翻译拼音 | 拼音字典 | 符号对照表 | 个税计算 | 实时汇率查询换算 | 经典小工具 | 汉字简繁转换 | 普通单位换算 | 公制单位换算 | 生辰老黄历 | 国内电话区号 | 国家代码与域名缩写 | 文字加密解密 | 元素周期表 | 健康查询 | 世界时间 | 万年历 | 二十四节气 | 汉字横竖排版 | 手机号码查询 | 计算器 | ip搜索
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2009 www.knowsky.com All rights reserved | 沪ICP备05001343号