国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

利用PocketSOAP鏈接webservice(1)---.net

2024-07-10 13:01:46
字體:
供稿:網(wǎng)友

pocketsoap
this is a soap client com component for the windows family, originally targeted at pocketpc (hence the name), there is also a win32 version that works on windows 95/98/me/nt4/2000/xp. the package includes a http transport for making http based soap requests, however the transport is separate from the main soap core, so any other transports can be easily added. james clark's excellent expat xml parser is used for parsing the response soap messages.
如果你想執(zhí)行文章中給出了代碼你需要下載并安裝pocketsoap
至于如何建立webservice我就不費力氣講了,今天的主要目的是如何利用pocketsoap使一些事情變得簡單。
1.在.net中使用pocketsoap
如果在安裝pocketsoap的過程中是根據(jù)系統(tǒng)默認選項的話那么在“c:/program files/simonfell/pocketsoap1.2/”中你就會發(fā)現(xiàn)psoap32.dll文件
我們需要導入這個pocketsoap namespace
例如:
using pocketsoap;using system;public class test{    public static void main(string[] args)    {        console.writeline("starting c# pocketsoap for echostring");        coenvelope soap=new coenvelope();        httptransport h=new httptransport();        soap.methodname="echostring";        soap.uri="urn:xmethodsinterop";        soap.parameters.create("inputstring", "hello world", "", null, null);        h.soapaction = "http://soapinterop.org/" ;        h.send ( "http://www.whitemesa.net/interop/std", soap.serialize() );        soap.parse(h, null);        console.writeline(soap.parameters.get_item(0).value);    }}
編譯的時候加入pocketsoap.dll
csc test.cs /r:pocketsoap.dll
例子2:
using pocketsoap;using system;public class test{    public static void main(string[] args)    {        console.writeline("starting c# pocketsoap for echostringarray");        coenvelope soap = new coenvelope();        httptransport h = new httptransport();        soap.methodname = "echostringarray";        soap.uri        = "http://soapinterop.org/";                object[] sa = new object[2];        sa[0] = "hello";        sa[1] = "goodbye";        soap.parameters.create ( "inputstringarray", sa, "", null,null ) ;        console.writeline("encoding style: "+soap.encodingstyle);        console.writeline("method name : "+soap.methodname);        console.writeline("uri : "+soap.uri);        console.writeline(soap.serialize());        h.soapaction = "http://soapinterop.org/" ;        h.send("http://www.whitemesa.net/interop/std", soap.serialize());        soap.parse(h, null);        object[] res = (object[])soap.parameters.get_item(0).value;        console.writeline(res[0]);        console.writeline(res[1]);    }}例子3:
using system;using system.collections;using pocketsoap; public class xmlistings{    public static void main()    {        coenvelope soap=new coenvelope();        httptransport h=new httptransport();        h.soapaction="";        soap.methodname="getallsoapservices";        soap.uri="urn:xmethodsservicesmanager";        h.send("http://www.xmethods.net/soap/servlet/rpcrouter", soap.serialize());                soap.parse(h, null);        object[] u = (object[])soap.parameters.get_item(0).value;        foreach (isoapnode x in u)        {            console.writeline(x.nodes.get_itembyname("name","").value);            console.writeline(x.nodes.get_itembyname("owner","").value);            console.writeline(x.nodes.get_itembyname("serverimplementation","").value);            console.writeline("-------------------------------");        }        return;    }}
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 浦城县| 三明市| 吉木乃县| 垣曲县| 吐鲁番市| 邳州市| 大英县| 中山市| 平安县| 建始县| 富源县| 新宾| 黄陵县| 宜都市| 贵州省| 兴山县| 南昌县| 南陵县| 彭水| 云梦县| 高唐县| 保定市| 珠海市| 子洲县| 垣曲县| 吴川市| 北流市| 丁青县| 图们市| 轮台县| 阿荣旗| 乌苏市| 巧家县| 瓮安县| 子长县| 海城市| 扶绥县| 东辽县| 株洲市| 全椒县| 苍梧县|