Search code examples
wcfmicrosoft-dynamicsdynamics-gp

405 Method Not Allowed - Dynamics GP 2010 Web Service


I am trying to access my client's GP 2010 web service, but I get this error:

The request failed with HTTP status 405: Method Not Allowed.

The URL is http://www.xyz.com:48620/Dynamics/GPService

In Visual Studio, I see this URL in the add web reference box:

xyz:48620/Metadata/WCF/Full/schemas.microsoft.com.dynamics.gp.2010.01.wsdl

When I visit the URL in the browser, I can see the WSDL:

enter image description here

Here is the WSDL code:

http://pastebin.com/0VU7ZRbE

The customer has installed the GP2010 web service and it appears in the browser. I cannot add a reference to it in Visual Studio. The customer has added an inbound and an outbound firewall rule.

Am I using the wrong URL or is there something else to install?


Solution

  • When you add a web reference, you add localhost:48620/Dynamics/GPService . If you need to authenticate to another one, add change the URL:

     // Create an instance of the service
            DynamicsGP.Core.DynamicsGPService.DynamicsGP wsDynamicsGP = new DynamicsGP.Core.DynamicsGPService.DynamicsGP();
            wsDynamicsGP.Url = "http://www.mysite.com:48620/DynamicsGPWebServices/DynamicsGPService.asmx";
            // Be sure the default credentials are used
            wsDynamicsGP.UseDefaultCredentials = true;
            wsDynamicsGP.Credentials = new NetworkCredential("username", "password", "domain");
    
            CompanyCriteria cc = new CompanyCriteria();
            Company[] c = wsDynamicsGP.GetCompanyList(cc, new Context());
    
    
            return wsDynamicsGP;