.Net webservice动态调用
直接贴代码吧
public class PmsService
{
/// <summary>
/// pms接口
/// </summary>
/// <param name="invokeBaseData">接口传递数据类</param>
/// <returns> </returns>
public string InvokeService(InvokeBaseData invokeBaseData)
{
string result = "", tempUrl = "", content = "";
tempUrl = "http://115.238.104.156:5031/XRself/HepInterface_Service.asmx/WebConnector";
content = "v=" + invokeBaseData.Version + "&n=" + invokeBaseData.Number +
"&f=" + invokeBaseData.Function + "&q=" + invokeBaseData.QueryString +
"&c=" + invokeBaseData.ClientInfo + "&s=" + invokeBaseData.State;
StreamReader myStreamReader;
var bs = Encoding.UTF8.GetBytes(content);
var request = (HttpWebRequest)HttpWebRequest.Create(tempUrl);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = bs.Length;
try
{
using (Stream reqStream = request.GetRequestStream())
{
reqStream.Write(bs, 0, bs.Length);
reqStream.Close();
}
var wr = request.GetResponse();
var myResponseStream = wr.GetResponseStream();
myStreamReader = new StreamReader(myResponseStream);
result = myStreamReader.ReadToEnd();
}
catch (WebException ce)
{
var res = (HttpWebResponse)ce.Response;
try
{
myStreamReader = new StreamReader(res.GetResponseStream());
result = myStreamReader.ReadToEnd();
}
catch (Exception e)
{
result = ce.Message;
}
}
return result;
}
}
想交流qq联系:1576410833
.Net webservice动态调用的更多相关文章
- C# WebService动态调用
前言 站在开发者的角度,WebService 技术确实是不再“时髦”.甚至很多人会说,我们不再用它.当然,为了使软件可以更简洁,更有层次,更易于实现缓存等机制,我是非常建议将 SOAP 转为 REST ...
- SOA 下实现分布式 调用 cxf+ webService +动态调用
近期项目间隙 自学了 webservice 一下 是我写的 一个demo 首先我们在web.xml 里配置如下 <servlet> <servlet-name>CXFS ...
- webService动态调用及返回至处理
http://www.cnblogs.com/xffy1028/archive/2012/05/07/2487595.html using System; using System.Collectio ...
- WEBService动态调用代码
BasicHttpBinding bind = new BasicHttpBinding(); bind.MaxReceivedMessageSize = int.MaxValue; Endpoint ...
- WebService – 2.动态调用WebService
在本节课程中,将演示如何通过程序动态添加.调用.编译.执行WebService并返回结果. WebService动态调用示意图 WebService相关知识 代码文档对象模型CodeDom的使用 编程 ...
- 调用webservice服务(通过反射的方式动态调用)
调用 ";//系统类别 var jkxlh = "";//接口序列号 var jkid = "68W05";//接口id string WriteXm ...
- c# 动态调用.net编写的webservices接口
创建类WebServiceHelper: public class WebServiceHelper { #region 动态调用WebService动态调用地址 /// < summary&g ...
- .net WebServer示例及调用(接口WSDL动态调用 JAVA)
新建.asmx页面 using System; using System.Collections.Generic; using System.Linq; using System.Web; using ...
- 动态调用WebService
WebService内容 using Microsoft.CSharp;using System;using System.CodeDom;using System.CodeDom.Compiler; ...
随机推荐
- PL/SQL在win7X 64下安装
oracle11g怎么安装在此不作说明,网上到处都是,主要针对PL/SQL的安装配置 下载地址: PLSQL Developer: http://pan.baidu.com/s/1nt7G4cD X6 ...
- Activity生命周期-Android
Activity常见的三种生命周期: 1.完整生命周期 oncreate-->onstart-->onresume-->onpause-->onstop-->ondest ...
- 微软的COM中GUID和UUID、CLSID、IID
摘自:http://blog.csdn.net/zhongguoren666/article/details/6711396 当初微软设计com规范的时候,有两种选择来保证用户的设计的com组件可以全 ...
- jQuery异步分页插件
学校软件工程让写课程设计(其实就是自选语言做个项目),感觉都是重复的东西就没有很认真的去写内容,更加注意写一些之前没有用过的东西. 因为一直都使用TP框架来写PHP,TP又自带分页类,想到这里就想试试 ...
- Session State Pattern会话状态模式
Client Session State 客户会话状态. 在Client端保存会话状态. 运行机制 Client在每次请求时会把所有的会话数据传给Server,Server在响应时把所有的会话状态传给 ...
- 使用notepad++编辑器
使用notepad++编辑器 在公司时经常要用到文本编辑器去写jsp文件,之前使用的是sublime text 3,但是觉得不太顺手,于是转用notepad++编辑器. 这个编辑器最吸引我的地方是层次 ...
- The-ith-Element
Brief: the-ith-element,given a array A with n element , return the i-th element of A. A(n,i) this p ...
- const char *p、char const *p、char * const p的区别?
const char *p和char const *p是一样的,都表示定义一个指向字符常量的指针,指针的内容(字符)不可变.char * const p表示一个指向字符的指针常量,字符可以改变,但是指 ...
- Ping N个IP测试网络连通性
#-----------------------Smokeping移动节点-------------------##! /bin/bashecho "------------- Statin ...
- mongodb的常用操作(二)
继续mongodb的学习: 9.mongodb条件查询 假设有user集合,里面结构如下:{ "_id" : ObjectId("52ab35d281181f853264 ...