Hello,
I am having some problems with the http://crmServer:5555/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx web service. When I go to the IIS where the WS is hosted and try to browse it, it shows an empty page (blank).
Then, as I have a IFD + OnPremise installation, and I have my custom ASPX web pages accessing the CrmService, DiscoveryService and MetadataService, I need to handle two different ways of authentication. I saw sdk's example and this is my code:
string server = "http://<serverURL>"; //serverURL = localhost:5555 and I've tried with IP:5555 also
// Initialize an instance of the CrmDiscoveryService Web service proxy.
CrmDiscoveryService disco = new CrmDiscoveryService();
disco.Url = server + "/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx";
//Retrieve a list of available organizations.
RetrieveOrganizationsRequest orgRequest =
new RetrieveOrganizationsRequest();
orgRequest.UserId = domain + "\\" + username;
orgRequest.Password = password;
RetrieveOrganizationsResponse orgResponse =
(RetrieveOrganizationsResponse)disco.Execute(orgRequest);
//Find the desired organization.
foreach (OrganizationDetail orgdetail in orgResponse.OrganizationDetails)
{
if (orgdetail.OrganizationName == organizationName)
{
//Retrieve the ticket.
RetrieveCrmTicketRequest ticketRequest =
new RetrieveCrmTicketRequest();
ticketRequest.OrganizationName = organizationName;
ticketRequest.UserId = domain + "\\" + username;
ticketRequest.Password = password;
RetrieveCrmTicketResponse ticketResponse =
(RetrieveCrmTicketResponse)disco.Execute(ticketRequest);
//Create the CrmService Web service proxy.
CrmAuthenticationToken sdktoken = new CrmAuthenticationToken();
sdktoken.AuthenticationType = 2;
sdktoken.OrganizationName = organizationName;
sdktoken.CrmTicket = ticketResponse.CrmTicket;
service = new CrmService();
service.CrmAuthenticationTokenValue = sdktoken;
service.Url = orgdetail.CrmServiceUrl;
break;
}
}
The application throws an exception when trying to execute the
RetrieveOrganizationsResponse orgResponse =
(RetrieveOrganizationsResponse)disco.Execute(orgRequest);
web method. Does anybody knows what could be the problem? I've seen a number of forums with similar questions but no one could help me. The exception is:
"The request failed with HTTP status 401: Unauthorized."
" at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)\r\n at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)\r\n at CRM.ServiceLayer.CRMDiscoveryService.CrmDiscoveryService.Execute(Request Request) in C:\\CRM\\CRM\\CRM.ServiceLayer\\Web References\\CRMDiscoveryService\\Reference.cs:line 79\r\n at CRM.ServiceLayer.Service.ifdConnection(String organizationName) in C:\\CRM\\CRM\\CRM.ServiceLayer\\Service.cs:line 50\r\n at CRM.ServiceLayer.Service..ctor(String organizationName, Boolean isIFD) in C:\\CRM\\CRM\\CRM.ServiceLayer\\Service.cs:line 29\r\n at CRM.ServiceLayer.Vehiculos..ctor(String organizationName, Boolean isIFD) in C:\\CRM\\CRM\\CRM.ServiceLayer\\Vehiculos.cs:line 41\r\n at CRM.VehiculosRelacionados.CargarEstados() in C:\\CRM\\CRM\\CRM\\VehiculosRelacionados.aspx.cs:line 561\r\n at CRM.VehiculosRelacionados.Page_Load(Object sender, EventArgs e) in C:\\CRM\\CRM\\CRM\\VehiculosRelacionados.aspx.cs:line 112\r\n at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)\r\n at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)\r\n at System.Web.UI.Control.OnLoad(EventArgs e)\r\n at System.Web.UI.Control.LoadRecursive()\r\n at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)"
Any help will be appreciate. Thank you in advance,
Ale
*This post is locked for comments
I have the same question (0)

Report
All responses (
Answers (