Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. webservice response giving problem [modified]

webservice response giving problem [modified]

Scheduled Pinned Locked Moved ASP.NET
csharpsysadmindata-structuresdebugging
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    keroed_edmond
    wrote on last edited by
    #1

    i created a simple webservice _ Public Function HelloWorld(ByVal person As String) As String Return "Hello" + person End Function andi created a vb.net application that i jus wanted to post the name and get back the response ' Create the web request request = DirectCast(WebRequest.Create("http://localhost:80/WebService_RPC2"), HttpWebRequest) ' Set type to POST request.Method = "POST" request.ContentType = "application/x-www-form-urlencoded" ' Create a byte array of the data we want to send byteData = System.Text.UTF8Encoding.UTF8.GetBytes(data.ToString()) ' Set the content length in the request headers request.ContentLength = data.Length ' Write data Try postStream = request.GetRequestStream() postStream.Write(byteData, 0, byteData.Length) Catch ex As Exception MessageBox.Show(ex.Message) Finally If Not postStream Is Nothing Then postStream.Close() End Try Try ' Get response response = DirectCast(request.GetResponse(), HttpWebResponse) ' Get the response stream into a reader reader = New StreamReader(response.GetResponseStream()) ' Console application output Console.WriteLine(reader.ReadToEnd()) Catch ex As Exception MessageBox.Show(ex.Message) Finally If Not response Is Nothing Then response.Close() End Try Dim responseString As String = Convert.ToString(reader) but this doesn't work when i debug the code i see that the request goes through and no exception is thrown as soon as i try to read the response response = DirectCast(request.GetResponse(), HttpWebResponse) i get an exceptiong is thrown saying Quote: the remote server return an error405)Method Not allowed can anyone tell me what i am doing wrong is there something i am not doing correcly from the webservice side? -- modified at 23:53 Saturday 10th February, 2007

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups