Hi Rico,

This is how i implemented the Http post.


String result = string.Empty;

StreamWriter myWriter = null;

string url = ConfigurationManager.AppSettings["Host"];

//Creating a WebRequest

HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);

httpWebRequest.Method = "POST";

httpWebRequest.ContentLength = xmlMessage.Length;

httpWebRequest.ContentType = "text/xml;charset=ISO-8859-1";

httpWebRequest.Headers.Add(HttpRequestHeader.Authorization,
ConfigurationManager.AppSettings["Authorization"]);

try

{

myWriter = new StreamWriter(httpWebRequest.GetRequestStream());

//Writes to the host sever

myWriter.Write(xmlMessage);

}

catch (Exception e)

{

throw e;

}

finally

{

if (myWriter != null)

{

myWriter.Close();

}

}

//Getting response from host server for our request

HttpWebResponse objResponse = (HttpWebResponse)httpWebRequest.GetResponse();

using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))

{

result = sr.ReadToEnd();

// Close and clean up the StreamReader

sr.Close();

}
Regards,
Nivas

On Thu, May 28, 2009 at 11:42 AM, Rico <[email protected]> wrote:

>
> Hello Nivas,
>
> I'm trying to do a similar thing.  Could you please post your code for
> the POST and for the web service?
>
> Thanks,
> Rico
>
> On May 26, 11:04 pm, (¯`·._.·NIVAS·._.·´¯) <[email protected]> wrote:
> > Hi Cipto,
> >
> > Thanks for your reply. I have implemented that usin HttpWebRequest and is
> > done.
> > Thanks all.
> >
> >
> >
> >
> >
> > On Tue, May 26, 2009 at 8:14 AM, cipto john <[email protected]> wrote:
> > > if from javascript
> > > Use post on xmlhttprequest. set to post and then set your xml as
> > > string.handle it on server write the string to xml file
> >
> > > if from other type application
> > > Using FTP would be nice.
> >
> > > of you build your tcp listener accept client bla bla bla
> >
> > > There is nothing to do with ssl, ssl is just encryption.
> >
> > > On Mon, May 25, 2009 at 9:12 PM, ¯`·._.·NIVAS·._.·´¯ <
> [email protected]>wrote:
> >
> > >> Hi Chris,
> > >> Its not meagre upload file. I have to send xml content as data using
> http
> > >> post and inturn another webserver will give response for my request.
> >
> > >> On Fri, May 22, 2009 at 4:54 PM, Chris Marks <[email protected]
> >wrote:
> >
> > >>> "Send" ? - perhaps use of a webservice, or if it's just literally to
> > >>> send/upload a file an XML file to a remote webserver, how about
> > >>> connecting via FTP?
> >
> > >>> On May 22, 7:38 am, Nivas <[email protected]> wrote:
> > >>> > Hi,
> >
> > >>> > i need to send a xml file to another webserver, which i want to do
> in
> > >>> > csharp. how to do this?
> > >>> > Maybe have to do something with SSLSocket.
> >
> > >>> > Thanks in advance.
> >
> > >> --
> > >> Tha.Nivas,
> > >>http://cdnivas.blogspot.com
> >
> > --
> > Tha.Nivas,http://cdnivas.blogspot.com- Hide quoted text -
> >
> > - Show quoted text -
>



-- 
Regards,
tha.NIVAS

Reply via email to