zoukankan      html  css  js  c++  java
  • 以post方式发送文档到端口

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml.Linq;
    using System.Xml;
    using System.Net;
    using System.IO;

    namespace WindowsFormService
    {
    public class HttpSend
    {

    public XDocument sendXmlAndGetResponse(XDocument xDocument)
    {
    XmlDocument doc = new XmlDocument();
    doc.LoadXml(xDocument.Document.ToString());
    WebResponse resp;
    string strUrl = XMLTools.getXmlValue("LFListenerAddress", "Address");// "http://localhost:8008/hello/";
    HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(strUrl);
    myRequest.ContentType = "text/xml";
    myRequest.Method = "POST";
    Stream stm = myRequest.GetRequestStream();
    doc.Save(stm);
    stm.Close();
    resp = myRequest.GetResponse();
    stm = resp.GetResponseStream();
    //StreamReader r = new StreamReader(stm);
    //MessageBox.Show(r.ReadToEnd().ToString(), "MESSAGE ");

    var reDoc = new XmlDocument();
    reDoc.Load(stm);

    return reDoc.ToXDocument();
    }
    }
    }

  • 相关阅读:
    语句
    1101 事务存储引擎触发器函数
    1029 作业
    1029 数据库表以及行的基本操作
    1023 笔记
    1022 作业
    1022 笔记
    1021 笔记
    查看pip已经安装过的包
    查看Python支持的.whl文件版本
  • 原文地址:https://www.cnblogs.com/cotty/p/2321872.html
Copyright © 2011-2022 走看看