Results 1 to 3 of 3

Thread: HttpWebRequest with XML-file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2007
    Posts
    27

    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.

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    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.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3
    Hyperactive Member Arachnid13's Avatar
    Join Date
    Jan 2003
    Location
    England
    Posts
    327

    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"
    Do you wake up in the morning feeling sleepy and grumpy? Then you must be Snow White

Posting Permissions

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



Click Here to Expand Forum to Full Width