I am new to vb.net. I created a web service making use of SoapExtension.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sheldoncs
    New Member
    • Oct 2009
    • 6

    I am new to vb.net. I created a web service making use of SoapExtension.

    Code:
    System.InvalidOperationException was unhandled
      Message="Client found response content type of 'text/plain; charset=utf-8', but expected 'text/xml'. The request failed with the error message: -- System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.UnauthorizedAccessException: Access to the path 'd:\logFile.txt' is denied.    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)    at Orders.SoapDisplayExtension.WriteInput(SoapMessage message) in C:\Inetpub\wwwroot\Orders\Orders\SoapDisplayExtension.vb:line 73    at Orders.SoapDisplayExtension.ProcessMessage(SoapMessage message) in C:\Inetpub\wwwroot\Orders\Orders\SoapDisplayExtension.vb:line 48    at System.Web.Services.Protocols.SoapMessage.RunExtensions(SoapExtension[] extensions, Boolean throwOnException)    at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()    at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()    --- End of inner exception stack trace ---  --."
      Source="System.Web.Services"
      StackTrace:
           at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)    at TestOrders.localhost.Service1.GetOrder(Int32 OrderID) in C:\vbclient\TestOrders\TestOrders\Web References\localhost\Reference.vb:line 80    at TestOrders.Form1.Button1_Click(Object sender, EventArgs e) in C:\vbclient\TestOrders\TestOrders\Form1.vb:line 9    at System.Windows.Forms.Control.OnClick(EventArgs e)    at System.Windows.Forms.Button.OnClick(EventArgs e)    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)    at System.Windows.Forms.Control.WndProc(Message& m)    at System.Windows.Forms.ButtonBase.WndProc(Message& m)    at System.Windows.Forms.Button.WndProc(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)    at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)    at System.Windows.Forms.Application.Run(ApplicationContext context)    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)    at TestOrders.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81    at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)    at System.Threading.ThreadHelper.ThreadStart()
      InnerException:
    Last edited by tlhintoq; Oct 15 '09, 09:31 PM. Reason: [CODE] ...your code here...[/CODE] tags added
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    I am new to vb.net. I created a web service making use of SoapExtension.
    Welcome to fun world of coding.

    Did you have a question you wanted to ask?

    Comment

    • sheldoncs
      New Member
      • Oct 2009
      • 6

      #3
      yes, why am i getting this error

      I run the web service in the ie browser and it works fine but when I am calling the service from a client i get the response error:
      Message="Client found response content type of 'text/plain; charset=utf-8', but expected 'text/xml'. The request failed with the error message: -- System.Web.Serv ices.Protocols. SoapException: Server was unable to process request. ---> System.Unauthor izedAccessExcep tion: Access to the path 'd:\logFile.txt '

      Comment

      • tlhintoq
        Recognized Expert Specialist
        • Mar 2008
        • 3532

        #4
        I run the web service in the ie browser and it works fine but when I am calling the service from a client i get the response error:
        Ok. You get an error message. What is your question? What part of the error message are you not understanding?

        Here's the part that seems significant to me:
        System.Unauthor izedAccessExcep tion: Access to the path 'd:\logFile.txt ' is denied.
        I would guess you are writing to a log file that you don't have access to.

        Comment

        • sheldoncs
          New Member
          • Oct 2009
          • 6

          #5
          Yes, I want to write the incoming soap request to logFile.txt. I have both the client and server on my machine - localhost. It does not make sense to me that I am getting the UnauthorizedAcc essException because the file is on my local machine.

          Comment

          • tlhintoq
            Recognized Expert Specialist
            • Mar 2008
            • 3532

            #6
            I have both the client and server on my machine - localhost.
            Are they both trying to access the same log file?

            One file on hard drive means there should be only one class reading from it or writing to it. Any more than that risks simultaneous attempts to access a single file.

            Your client and your server should be writing to different files.
            Each one should have some type of Logging class that is responsible for the file read/write.
            Everything else in the application should access a method of the logging class to cause a write. I do this by raising an event of "LogThis(st ring Message)"

            By having one one point that is responsible for writing in the log you can easily change the format of the log since there is only one place to make the change. Maybe you want to change it from
            12:34 pm - This Happened
            to
            15oct09 12:34:56.123 - This Happened.

            Comment

            • sheldoncs
              New Member
              • Oct 2009
              • 6

              #7
              hi again

              Actually no,

              The client is calling the server awaiting a response and is not trying to access the logFile. On the other side the server gets the request and through the SoapExtension at the ProcessManager, the BeforeDeseriali ze option consist of a procedure which attempts to write the incoming SOAP Request to the logFile.

              Hope this explains it. I would like to post the code but everything is at the office.

              Sheldon

              Comment

              • sheldoncs
                New Member
                • Oct 2009
                • 6

                #8
                forgot to tell you that the client is a vb form

                Comment

                • sheldoncs
                  New Member
                  • Oct 2009
                  • 6

                  #9
                  I got it to work. it was a permissions problem.

                  Comment

                  Working...