首先,得有一个web service地址:
http://www.baiduc.om/XXServices?wsdl

然后在.net 项目中添加Web引用,并把地址给它输进去

第三、编码:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebServicesTest.XXServices;
 
namespace WebServicesTest
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            GiftCardRequest gcr = new GiftCardRequest();
            gcr.orderRequestId = DateTime.Now.ToString("yyyyMMddHHmmssffff");
 
            gcr.userName = "9001373";
 
            gcr.applyType = 1;
            gcr.applyTypeSpecified = true;
 
            gcr.saleId = null;
 
            gcr.recordNum = 1;
            gcr.recordNumSpecified = true;
 
            GiftCardInfo[] gcis = new GiftCardInfo[gcr.recordNum];
            GiftCardInfo gci = new GiftCardInfo();
            gci.cardType = "cardtype_vc_461999";
            gci.cardValue = 10000;
            gci.cardValueSpecified = true;
            gci.cardCount = 1;
            gci.cardCountSpecified = true;
            gci.cardTotalValue = 10000;
            gci.cardTotalValueSpecified = true;
            gci.giftValue = 0;
            gci.giftValueSpecified = true;
 
            gcis[0] = gci;
            gcr.cardInfo = gcis;
 
            XXServices.XXServicesocss = new XXServices.XXServices();
            GiftCardResponse giftCardResponse = ocss.giftCard(gcr);
 
        }
    }
}

需要注意的一点是,

vs在解析时,会把int,long,double,DateTime等变量解析成改变量名与改变量名加Specified的形式,只要把要传的参数对应的Specified的值=true,这样就能传过去了,否则,这些类型的参数传不过去 

C#.Net 调用Java的Web Service的更多相关文章

  1. SOAP: java+xfire(web service) + php客户端

    作者: 吴俊杰 web service这项技术暂不说它有多落伍,但是项目中用到了,没法逃避!    xml和json各有各的好处,但是JSON无疑是当今数据交互的主流了.客户soap服务器端用的是 j ...

  2. <<Java RESTful Web Service实战>> 读书笔记

    <<Java RESTful Web Service实战>> 读书笔记 第一章   JAX-RS2.0入门 REST (Representational State ransf ...

  3. CentOS 调用.Net 的Web Service,提示连接超时解决方案

    我是使用axis调用.NET 的Web Service ,在Window下跑没有问题,将项目部署到Linux下,发现Web Service 连接超时,百度了下,发现是因为Linux不能直接跑.Net, ...

  4. Java 调用PHP的Web Service(三)

    usoap是PHP环境中的开源soap工具,算是用得比较多的一个工具了. 在utf-8环境中,nusoap可以工作得很好.但是当用于中文环境中时,nusoap经常会出现一些让人不得其解的问题. 最近一 ...

  5. JAVA 用axis1 调用.NET的web service

    1.去官网下载axis的jar包,我下的是1.4版本的 http://axis.apache.org/axis/java/releases.html 2.JAVA 代码: public void my ...

  6. 【转】基于CXF Java 搭建Web Service (Restful Web Service与基于SOAP的Web Service混合方案)

    转载:http://www.cnblogs.com/windwithlife/archive/2013/03/03/2942157.html 一,选择一个合适的,Web开发环境: 我选择的是Eclip ...

  7. JAVA开发Web Service几种框架介绍

    郑重声明:此文为转载来的,出处已不知了,侵告删. 在讲Web Service开发服务时,需要介绍一个目前开发Web Service的几个框架,分别为Axis,axis2,Xfire,CXF以及JWS( ...

  8. Java RESTful Web Service相关概念

    原文地址:http://1.liangtao.sinaapp.com/?p=647 接上一篇文章REST|RESTful初步认识:p=639">http://1.liangtao.si ...

  9. Android调用Asp.net Web Service示例

    WebService代码: using System; using System.Collections.Generic; using System.Linq; using System.Web; u ...

随机推荐

  1. Java 内存屏障

    内存屏障(Memory Barrier,或有时叫做内存栅栏,Memory Fence)是一种CPU指令,用于控制特定条件下的重排序和内存可见性问题.Java编译器也会根据内存屏障的规则禁止重排序. 内 ...

  2. javascript中面向对象的两种构建方式(构造函数)和(原型模式的区别)

    1.构造函数模式--->alert的结果为false <!DOCTYPE html> <html lang="en"> <head> &l ...

  3. shouyexinlianjie

    http://7xj7xs.com1.z0.glb.clouddn.com/trail_1.mp4

  4. 麦子lavarel---10、一些第三方应用注意

    麦子lavarel---10.一些第三方应用注意 一.总结 一句话总结: 其实把重要的几个功能弄一个就好了,邮箱验证,手机号验证,支付验证,都是调用第三方接口,也很简单 1.关于页面和服务端校验的看法 ...

  5. MySQL高可用方案 MHA之一MHA安装

    MHA0.58安装 MHA(Master High Availability)由两部分组成:MHA Manager(管理节点)和MHA Node(数据节点).管理节点mha4mysql-manager ...

  6. python写一个查询接口

    知识点: 1.flask_sqlalchemy查询: Flask-SQLAlchemy 在您的 Model 类上提供了 query 属性.当您访问它时,您会得到一个新的所有记录的查询对象.在使用 al ...

  7. python进行数据库迁移的时候显示(TypeError: __init__() missing 1 required positional argument: 'on_delete')

    进行数据库迁移的时候,显示  TypeError: __init__() missing 1 required positional argument: 'on_delete' 图示: 出现原因: 在 ...

  8. python使用__new__创建一个单例模式(单例对象)

    #单例模式:使一个类只产生一个对象.他们的id地址都指向同一个内存地址 第一步:理解谁创建了对象 # 单例模式# 首先明白,我们在创建一个类的对象的时候,其实是调用的这个类的父类,即继承object, ...

  9. base64编解码的两个函数(安全版本)

    void base64_encode_s(const unsigned char *str, long inlen, std::string& outstr, long* lpBufLen) ...

  10. c# Thread——1.为什么Abort中断线程是不可靠的

    Thread.Abort 方法在c#中用作强制中断线程的执行,大多用于线程内部满足某个特定条件而自己调用关闭自身,比如下面的代码在i自增到3的时候就会停止打印. class Program { sta ...