pocketsoap
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; }}
新闻热点
疑难解答
图片精选