The request failed with http status 405

Mar 4, 2009 at 8:44 AM
Hello,

First, thank you for your time.

I have installed IWeb and inserted an IWeb module onto a page.  I also implemented numerous web methods and can successfully run each of them from the link provided from the IWeb module: DesktopModules/IWeb/webservice.asmx.

In my windows application I want to consume the webservices.  I have written the following code:

Public Class WebServiceInterface
        Public Sub New()
                MyBase.New()
                moOmsWebServices = New OmsWebServices.WebService
                moOmsWebServices.Url = http://localhost//DesktopModules/IWeb/webservice.asmx

                ‘ The following two lines were added to remove the error: Access denied.  Http 401.
                moOmsWebServices.PreAuthenticate = True
                moOmsWebServices.Credentials = System.Net.CredentialCache.DefaultCredentials

                moWebAuthendicationHeader = New OmsWebServices.IWebAuthendicationHeader
                moWebAuthendicationHeader.PortalID = 0
                moWebAuthendicationHeader.Username = "hostUsername"
                moWebAuthendicationHeader.Password = "hostPassword"
                moWebAuthendicationHeader.Encrypted = "False"
                moOmsWebServices.IWebAuthendicationHeaderValue = moWebAuthendicationHeader
        End Sub


        Public Function OmsTest() As String
                Dim sValue As String

                Try
                     sValue = moOmsWebServices.OmsTest
                Catch ex As Exception
                    sValue = ex.Message
                End Try
                Return sValue
        End Function
End Class


' To call the webmethod OmsTest all I have to do is:
Dim oWSI as WebServiceInterface = New WebServiceInterface
oWSI.OmsTest        ' The request failed with http status 405

By the way:  From IIS Manager I enabled my virtual directory to allow anonymous access
Is there some other configuration that I need to do in order to make this call work?

Again, thank you very much for your time.
Michael Carr


Coordinator
Mar 4, 2009 at 1:30 PM
Your code looks correct. Also if you can get to the methods in your web browser it appears you have everything set-up. Perhaps your proxy in your windows application is not correct. I would suggest getting the IWeb Connector working (it is a windows program) and then add code to call your methods in that program. You can get the source code for the IWeb connector on this site.
Mar 4, 2009 at 8:02 PM
I downloaded IWeb Connector a few days ago and when using it, I can successfully connect to and run my web methods.  I can even load my website into one instance of Visual Studio and load IWebConnector into another instance of Visual Studio,  and successfully debug/step from IWebConnector to the website code.  A totally successful debugging experience.

I then copied IWebConnector to MyWebConnector and modified the code.  Attempting and hoping to recreate another successful debugging experience, I loaded the website into one instance of Visual Studio and MyWebConnector into another instance of Visual Studio.  When I run my version an error message pops up saying:  "Unable to automatically step into the server.  The remote procedure could not be debugged.  This usually indicates that debugging has not been enabled on the server."  And the exception message that is caught says, "The request failed with HTTP status 405.  Method not allowed"

I think this might not be a code issue but rather a configuration issue.  Do you have any ideas of what I am doing wrong?
Any help would be greatly appreciated.

Again, thank you for your time and expertise,
Michael Carr
Coordinator
Mar 4, 2009 at 9:29 PM
I think the issue is with the proxy. How did you create it? You may have amad a WCF proxy not a .asmx one.
Mar 4, 2009 at 10:22 PM
Edited Mar 4, 2009 at 10:46 PM
In the web service world, I am still learning the vocabulary.  If proxy means the web reference, then here is how I went about creating it.

Within Visual Studio,
1) Right clicked on the project and selected 'Add Web Reference'
2) Selected 'Web services on the local machine'
3) Clicked on 'Web Service'
4) Entered 'OmsWebService' in the web reference textbox.
4) Clicked on 'Add Reference'
5) Clicked on 'Ok'

Then I used this reference in the following class fragment:
Public Sub New()
        MyBase.New()
        moOmsWebServices = New OmsWebServices.WebService
        moOmsWebServices.Url = WebserviceURL
        moOmsWebServices.PreAuthenticate = False
        moOmsWebServices.Credentials = System.Net.CredentialCache.DefaultCredentials

        moWebAuthendicationHeader = New OmsWebServices.IWebAuthendicationHeader
        moWebAuthendicationHeader.PortalID = 0
        moWebAuthendicationHeader.Username = "hostUsername"
        moWebAuthendicationHeader.Password = "hostPassword"
        moWebAuthendicationHeader.Encrypted = "False"
        moOmsWebServices.IWebAuthendicationHeaderValue = moWebAuthendicationHeader
End Sub

Is this the correct definition of proxy?  Do I need to do something other than what I have done?

Again, thank you,
Michael Carr
 
Coordinator
Mar 4, 2009 at 10:29 PM
Edited Mar 4, 2009 at 10:51 PM
It looks ok to me except the PreAuthenticate and Credentials line :)
So I'm stumped.
Mar 4, 2009 at 10:49 PM
Are you suggesting that I remove the PreAuthenticate and Credentials lines?
By the way, do I have the correct understanding of proxy?

Again, thank you.
Michael Carr
Coordinator
Mar 4, 2009 at 10:50 PM
The PreAuthenticate and Credentials lines are not used in the IWebConnector sample.

Your proxy seems correct to me.
Sep 14, 2010 at 11:56 PM

I'm having the same problem.  My client is a WCF service referencing IWeb module inside DNN website.  I can't step into my IWeb methods.  Please help asap.