首先,得有一个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. python 获取list某个元素下标

    index() 函数用于从列表中找出某个值第一个匹配项的索引位置. list.index(x, start, end) #start end 指示搜索的起始和结尾位置,缺省为整个数组 x-- 查找的对 ...

  2. python魔法属性

    1.__doc__:表示类的描述信息 class Person(object): '''定义人的类''' def func(self): pass print(Person.__doc__) 结果为: ...

  3. Spring Cloud教程(十)自定义引导配置属性源

    可以通过在org.springframework.cloud.bootstrap.BootstrapConfiguration键下添加条目/META-INF/spring.factories来训练引导 ...

  4. js中获取当前系统时间

    使用var myDate = new Date();//获取系统当前时间 获取特定格式的时间: 1 myDate.getYear(); //获取当前年份(2位) 2 myDate.getFullYea ...

  5. POJ 1434 Fill the Cisterns! (模拟 or 二分)

    Fill the Cisterns! 题目链接: http://acm.hust.edu.cn/vjudge/contest/129783#problem/F Description During t ...

  6. Intellij IDEA中使用Debug调试详解

    转载:https://www.linuxidc.com/Linux/2017-09/146772.htm   Intellij IDEA中使用Debug调试详解 Debug用来追踪代码的运行流程,通常 ...

  7. 二十八、python中的os模块

    A.os模块:系统相关的(相对比较常用的有:os.stat('path/filename'),os.path.split(path),os.path.dirname(path),os.path.bas ...

  8. 错误 error: The following untracked working tree files would be overwritten by merge:README.md

    问题类型 相信很多小伙伴在创建新的git仓库后,会选上添加README.md文件,开始我也没太在意,应该也没有什么问题. 但是当我通过git添加远程仓库,给这个仓库上传代码时,出现了如下问题:erro ...

  9. 测开之路九十:css的引用方式

    第一种:内联,直接在标签里面加style属性,优先级别最高,但是不利于维护 第二种:页面嵌入,在head标签里面写一个style标签,以类选择器的形式写入,优先级别第二 第三种:外联,样式表链接,单独 ...

  10. 修改属性item1(1变化)

    给imgList1,7,12,16添加数据 数据层data:{imgList1:[],imgList7:[],imgList12:[],imgList16:[],} 处理层let _this=this ...