Answered by:
Connect to CrmService --> https

Question
-
In my console application I want to connect to the CrmService of my SaaS server. I have to do this with https. But everytime I get this error: The request failed with HTTP status 401: Unauthorized. [System.Web.Services]
Code:
//CrmAuthenticationToken contains the authentication information for accessing CrmService Web service.
CrmSdk.Metadata.
CrmAuthenticationToken Token = new CrmSdk.Metadata.CrmAuthenticationToken();Token.AuthenticationType = 0;
Token.OrganizationName =
Global.GetKey("OrganisationName");System.Net.NetworkCredential Credentials = new System.Net.NetworkCredential();
Credentials.UserName = Global.GetKey("CredentialsUserName");
Credentials.Password = Global.GetKey("CredentialsPassword");
Credentials.Domain = Global.GetKey("CredentialsDomain");
_service = new CrmSdk.Metadata.MetadataService();
_service.Url = Global.GetKey("MetadataServiceURL");
_service.CrmAuthenticationTokenValue = Token;
_service.Credentials = Credentials;
Is there a secured option?
Thanks in advance.
Wednesday, November 5, 2008 2:12 PM
Answers
-
Hi Zinno,
If that is able to connect that you probably are ok with regard to how you've set up authentication. Unless you're asked to provide explicit credentials with that tool, I would assume it is using default credentials.
Have you been able to add the web reference to MS CRM? Did it specify that you supply credentials?
I'll look for a sample that may work.
Cheers,
karloThursday, November 6, 2008 5:53 PM -
I fixed it. I had to do with the IFD.
Solution:
-C:\Microsoft Dynamics CRM\Tools\CRM4IFDTool.exe Start,
-"Authentication Strategy" change "IFD+On Premise" to "On Premise"
-File=>Apply changesGood luck!
Monday, November 10, 2008 3:50 PM
All replies
-
By SaaS do you mean you are trying to connect to CRM Online? If so, that requires an authentication type of 'Passport' ( = 1).
-Pat
Wednesday, November 5, 2008 8:13 PM -
The SaaS evironment has got Internet Facing Deployment.Wednesday, November 5, 2008 8:32 PM
-
Hmm, maybe you should be using 'Spla' AuthenticationType then:
http://msdn.microsoft.com/en-us/library/bb955408.aspx
Wednesday, November 5, 2008 8:46 PM -
Hi Zinno,
What method of identification are you using at the IIS level? I believe for SSL it needs to be basic. (If you're still stuck after changin the auth type).
Cheers,
KarloWednesday, November 5, 2008 10:36 PM -
I tried all the AuthenticationTypes. Still not working.
IIS level: Integrated Windows Authentication
Thursday, November 6, 2008 8:21 AM -
Hi Zinno,
Could you chase the auth type to Basic? I don't believe integrated will work with SSL.
Cheers,
KarloThursday, November 6, 2008 2:47 PM -
Karlo S wrote: Hi Zinno,
Could you chase the auth type to Basic? I don't believe integrated will work with SSL.
Cheers,
KarloNope Still not working.
If I use the FetchXML tool from Stunnware, I can connect to server.
But what is he doing different?
Thursday, November 6, 2008 3:36 PM -
Hi Zinno,
If that is able to connect that you probably are ok with regard to how you've set up authentication. Unless you're asked to provide explicit credentials with that tool, I would assume it is using default credentials.
Have you been able to add the web reference to MS CRM? Did it specify that you supply credentials?
I'll look for a sample that may work.
Cheers,
karloThursday, November 6, 2008 5:53 PM -
Karlo S wrote: Hi Zinno,
If that is able to connect that you probably are ok with regard to how you've set up authentication. Unless you're asked to provide explicit credentials with that tool, I would assume it is using default credentials.
Have you been able to add the web reference to MS CRM? Did it specify that you supply credentials?
I'll look for a sample that may work.
Cheers,
karloIn the FetchXml tool I've to enter my credentials. I enter the same as in my console application. But with the FetchXml tool it works. I cannot make a webreference to the server. I'll get this error: The HTML document does not contain Web service discovery information.
Url: https://mySaas.net/MSCrmServices/2007/CrmServiceWsdl.aspx (fake address)
Thursday, November 6, 2008 6:39 PM -
I fixed it. I had to do with the IFD.
Solution:
-C:\Microsoft Dynamics CRM\Tools\CRM4IFDTool.exe Start,
-"Authentication Strategy" change "IFD+On Premise" to "On Premise"
-File=>Apply changesGood luck!
Monday, November 10, 2008 3:50 PM -
Yeah, I'm trying exactly the same thing, I have everything else, but I cannot add Web Reference - I click Add Service Reference->Advanced->Add Web Reference and type in as URL: https://xxx.hostedmscrm.com/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx?WSDL and I receive the message HTML document does not contain Web service discovery information.
and the "mini browser" shows:
"CrmDiscoveryService" Description
Methods
- Execute ( Request As Request ) As Response
Executes requests using a message-based approach. The Execute method takes a message request class as a parameter and returns a message response class.
Saturday, January 17, 2009 12:54 AM - Execute ( Request As Request ) As Response
-
Tuesday, January 20, 2009 10:05 AM