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. General Programming
  3. XML / XSL
  4. Web Service Problem...

Web Service Problem...

Scheduled Pinned Locked Moved XML / XSL
helpcsharpcomsysadmin
2 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.
  • J Offline
    J Offline
    Jason Weibel
    wrote on last edited by
    #1

    I’m creating my first web service and running into the following error. A first chance exception of type 'System.Net.WebException' occurred in system.dll Additional information: The remote server returned an error: (401) Unauthorized. The error occurs in the Reference.vb file when I try to retrieve a string value from a function in the asmx file. Here is some of the code from the Reference.vb file. <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/XMLWebServices/ReturnValue", RequestNamespace:="http://localhost/XMLWebServices ", ResponseNamespace:="http://localhost/ XMLWebServices ", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _ Public Function ReturnValue() As String Dim results() As Object = Me.Invoke("ReturnValue", New Object(-1) {}) Return CType(results(0), String) End Function The web method in the asmx file looks like the following. <WebMethod()> Public Function ReturnValue() As String ReturnValue = "Value" End Function All suggestions are greatly appreciated. Jason W.

    J 1 Reply Last reply
    0
    • J Jason Weibel

      I’m creating my first web service and running into the following error. A first chance exception of type 'System.Net.WebException' occurred in system.dll Additional information: The remote server returned an error: (401) Unauthorized. The error occurs in the Reference.vb file when I try to retrieve a string value from a function in the asmx file. Here is some of the code from the Reference.vb file. <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/XMLWebServices/ReturnValue", RequestNamespace:="http://localhost/XMLWebServices ", ResponseNamespace:="http://localhost/ XMLWebServices ", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _ Public Function ReturnValue() As String Dim results() As Object = Me.Invoke("ReturnValue", New Object(-1) {}) Return CType(results(0), String) End Function The web method in the asmx file looks like the following. <WebMethod()> Public Function ReturnValue() As String ReturnValue = "Value" End Function All suggestions are greatly appreciated. Jason W.

      J Offline
      J Offline
      Jason Weibel
      wrote on last edited by
      #2

      Must define Credentials Dim ws As New localhost.WebS() ws.Credentials = System.Net.CredentialCache.DefaultCredentials Jason W.

      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