Submitting XML to an URL

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default Submitting XML to an URL

    hello,
    I'm not sure this is the right place for this question, but hopefully
    somebody can help.
    I'm trying to build an in-memory XML file and submit it to an URL. Here's a
    sample code:

    //================================================== ==
    HttpWebRequest request =
    (HttpWebRequest)WebRequest.Create("http://localhost/localurl.aspx");
    request.ContentType="application/x-www-form-urlencoded";
    request.Method = "POST";

    Stream myStream = request.GetRequestStream();
    XmlTextWriter writer = new XmlTextWriter(myStream, null);

    writer.WriteStartElement("orders");
    writer.WriteAttributeString("value","205");
    writer.WriteEndElement();

    writer.Flush();
    myStream.Close();
    //================================================== ==

    For some reason, the URL I'm submitting to does not receive the XML.
    Anybody has any ideas why?

    Thnks in advance.
    Vi Guest

  2. Similar Questions and Discussions

    1. Submitting Forms
      I followed the directions for creating a web form in publisher. When I click submit it says The page cannot be displayed and the url at the top...
    2. Submitting whole PDF to server
      Hello all, I am working on a small project and cannot seem to locate the information I require... I have a PDF form that has been created in Adobe...
    3. Page is not submitting
      Loop Relevant code snippet? Ray at work "DK" <dmitriy10@hotmail.com> wrote in message news:065601c36112$d585fee0$a101280a@phx.gbl...
    4. Submitting input
      I'm in a bind, I've searched the website, and all attemps have come up short of what I need. I have a form that a friend created, and it's...
    5. Submitting photos
      My photos are on my pbase site. How can I submit Challenge candidates from there? Thank you. EDIT: A lot of the photos are of my toddler/baby...
  3. #2

    Default Re: Submitting XML to an URL

    Vi,
    > hello,
    > I'm not sure this is the right place for this question, but hopefully
    > somebody can help.
    > I'm trying to build an in-memory XML file and submit it to an URL. Here's
    > a
    > sample code:
    >
    > //================================================== ==
    > HttpWebRequest request =
    > (HttpWebRequest)WebRequest.Create("http://localhost/localurl.aspx");
    > request.ContentType="application/x-www-form-urlencoded";
    > request.Method = "POST";
    >
    > Stream myStream = request.GetRequestStream();
    > XmlTextWriter writer = new XmlTextWriter(myStream, null);
    >
    > writer.WriteStartElement("orders");
    > writer.WriteAttributeString("value","205");
    > writer.WriteEndElement();
    >
    > writer.Flush();
    > myStream.Close();
    > //================================================== ==
    >
    > For some reason, the URL I'm submitting to does not receive the XML.
    > Anybody has any ideas why?
    a) I'm assuming you're using GetResponse() at the end, right?

    b) If your content encoding is application/x-www-form-urlencoded, then the
    way you're sending it is probably not correct. the way you're writing it is
    usually used for text/xml instead.


    --
    Tomas Restrepo
    [email]tomasr@mvps.org[/email]
    [url]http://www.winterdom.com/[/url]


    Tomas Restrepo \(MVP\) Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139