HttpWebRequest with XML-file
Hey,
I'm developping the client-side of a webservice. The purpose is that I send three values to the server (xml-file, username and password) and I will get an xml-file in return.
I'm allready able to send information to the webservice but then it 'hangs' and my application is blocked.
How should I attach the xml-file to the webrequest?? What contentType is needed?? More suggestions??
Code:
Dim request As Net.HttpWebRequest = DirectCast(WebRequest.Create(strUrl), HttpWebRequest)
request.Method = "post"
request.ContentLength = "12000"
request.ContentType = "multipart/form-data"
Dim response As Net.HttpWebResponse = CType(request.GetResponse, Net.HttpWebResponse)
Thanks for the effort to try and find me a solution.
Re: HttpWebRequest with XML-file
I believe the ContentType should be text/xml. Have a look at MSDN's example on posting data to a website.
Re: HttpWebRequest with XML-file
Athiest is correct, response type needs to be "text/xml", also the request content type might need to be "application/x-www-form-urlencoded"