国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 洞口县| 开平市| 临高县| 驻马店市| 台湾省| 多伦县| 富蕴县| 巴东县| 馆陶县| 台中县| 石泉县| 巴彦淖尔市| 林州市| 南乐县| 伽师县| 临桂县| 呼伦贝尔市| 仁化县| 巴林右旗| 保定市| 龙南县| 临西县| 苍溪县| 巴里| 庆城县| 崇阳县| 资溪县| 佳木斯市| 象州县| 龙海市| 友谊县| 萍乡市| 阜阳市| 宁安市| 隆回县| 泸西县| 和硕县| 盐池县| 富平县| 西和县| 勃利县|