CRM webservice error

E

Eric van der Niet

I have thuis webservice. Used to get account information out of microsoft
crm. But is reply's an error! can someone see whats the error in this
code???? Help!

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Diagnostics;

using System.Web;

using System.Web.Services;

using System.Xml;

using Microsoft.Crm.Platform.Proxy;

namespace FetchAllAccounts

{

public class FetchAllAccounts : System.Web.Services.WebService

{

// You must change this to the URL for your Microsoft CRM server.

private const string _strCRMURL = "http://hil-mem-03/mscrmservices/";

/// <summary>

/// Retrieve a summary of all accounts in the database.

/// </summary>

[WebMethod]

public XmlNode Fetch()

{

// Create BizUser proxy object.

BizUser objBizUser = new BizUser();

objBizUser.Credentials

= System.Net.CredentialCache.DefaultCredentials;

objBizUser.Url = _strCRMURL + "BizUser.srf";



// Create CRMQuery proxy object.

CRMQuery objQuery = new CRMQuery();

objQuery.Credentials = objBizUser.Credentials;

objQuery.Url = _strCRMURL + "CRMQuery.srf";

string strAllAccountsFetchXML =

@"<fetch mapping='logical'>

<entity name='account'>

<attribute name = 'name'/>

<attribute name = 'accountid'/>

</entity>

</fetch>";



// Execute the query and return the result set.

// If an exception occurs, return the error message instead.

XmlDocument xmlDoc = new XmlDocument();

try

{

xmlDoc.LoadXml(objQuery.ExecuteQuery(objBizUser.WhoAmI(),

strAllAccountsFetchXML));

return xmlDoc;

}

catch (System.Web.Services.Protocols.SoapException err)

{

xmlDoc.LoadXml("<Error/>");

xmlDoc.DocumentElement.InnerText = strAllAccountsFetchXML; //err.ToString();

return xmlDoc.DocumentElement;

}

}

#region Component Designer generated code

public FetchAllAccounts()

{

//CODEGEN: This call is required by the ASP.NET Web Services Designer

InitializeComponent();

}


//Required by the Web Services Designer

private IContainer components = null;


/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if(disposing && components != null)

{

components.Dispose();

}

base.Dispose(disposing);

}


#endregion

}

}
 
M

Matt Parks

What error are you getting and on which call is it being raised?

Matt Parks
MVP - Microsoft CRM

----------------------------------------
----------------------------------------
I have thuis webservice. Used to get account information out of microsoft
crm. But is reply's an error! can someone see whats the error in this
code???? Help!

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Diagnostics;

using System.Web;

using System.Web.Services;

using System.Xml;

using Microsoft.Crm.Platform.Proxy;

namespace FetchAllAccounts

{

public class FetchAllAccounts : System.Web.Services.WebService

{

// You must change this to the URL for your Microsoft CRM server.

private const string _strCRMURL = "http://hil-mem-03/mscrmservices/";

/// <summary>

/// Retrieve a summary of all accounts in the database.

/// </summary>

[WebMethod]

public XmlNode Fetch()

{

// Create BizUser proxy object.

BizUser objBizUser = new BizUser();

objBizUser.Credentials

= System.Net.CredentialCache.DefaultCredentials;

objBizUser.Url = _strCRMURL + "BizUser.srf";



// Create CRMQuery proxy object.

CRMQuery objQuery = new CRMQuery();

objQuery.Credentials = objBizUser.Credentials;

objQuery.Url = _strCRMURL + "CRMQuery.srf";

string strAllAccountsFetchXML =

@"<fetch mapping='logical'>

<entity name='account'>

<attribute name = 'name'/>

<attribute name = 'accountid'/>

</entity>

</fetch>";



// Execute the query and return the result set.

// If an exception occurs, return the error message instead.

XmlDocument xmlDoc = new XmlDocument();

try

{

xmlDoc.LoadXml(objQuery.ExecuteQuery(objBizUser.WhoAmI(),

strAllAccountsFetchXML));

return xmlDoc;

}

catch (System.Web.Services.Protocols.SoapException err)

{

xmlDoc.LoadXml("<Error/>");

xmlDoc.DocumentElement.InnerText = strAllAccountsFetchXML; //err.ToString();

return xmlDoc.DocumentElement;

}

}

#region Component Designer generated code

public FetchAllAccounts()

{

//CODEGEN: This call is required by the ASP.NET Web Services Designer

InitializeComponent();

}


//Required by the Web Services Designer

private IContainer components = null;


/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if(disposing && components != null)

{

components.Dispose();

}

base.Dispose(disposing);

}


#endregion

}

}
 
E

Eric van der Niet

This is the error:

<?xml version="1.0" encoding="utf-8" ?>
<Error>ErrorMessage: SOAP Server Application Faulted
<detail><error><code>80040225</code><description>The specified user is
either disabled or is not a member of any business
unit.</description><file>d:\crm\build\3297\src\platform\security\crmsecurity\secmain.cpp</file><line>2281</line></error></detail>
Source: System.Web.Services</Error>




Matt Parks said:
What error are you getting and on which call is it being raised?

Matt Parks
MVP - Microsoft CRM

----------------------------------------
----------------------------------------
I have thuis webservice. Used to get account information out of microsoft
crm. But is reply's an error! can someone see whats the error in this
code???? Help!

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Diagnostics;

using System.Web;

using System.Web.Services;

using System.Xml;

using Microsoft.Crm.Platform.Proxy;

namespace FetchAllAccounts

{

public class FetchAllAccounts : System.Web.Services.WebService

{

// You must change this to the URL for your Microsoft CRM server.

private const string _strCRMURL = "http://hil-mem-03/mscrmservices/";

/// <summary>

/// Retrieve a summary of all accounts in the database.

/// </summary>

[WebMethod]

public XmlNode Fetch()

{

// Create BizUser proxy object.

BizUser objBizUser = new BizUser();

objBizUser.Credentials

= System.Net.CredentialCache.DefaultCredentials;

objBizUser.Url = _strCRMURL + "BizUser.srf";



// Create CRMQuery proxy object.

CRMQuery objQuery = new CRMQuery();

objQuery.Credentials = objBizUser.Credentials;

objQuery.Url = _strCRMURL + "CRMQuery.srf";

string strAllAccountsFetchXML =

@"<fetch mapping='logical'>

<entity name='account'>

<attribute name = 'name'/>

<attribute name = 'accountid'/>

</entity>

</fetch>";



// Execute the query and return the result set.

// If an exception occurs, return the error message instead.

XmlDocument xmlDoc = new XmlDocument();

try

{

xmlDoc.LoadXml(objQuery.ExecuteQuery(objBizUser.WhoAmI(),

strAllAccountsFetchXML));

return xmlDoc;

}

catch (System.Web.Services.Protocols.SoapException err)

{

xmlDoc.LoadXml("<Error/>");

xmlDoc.DocumentElement.InnerText = strAllAccountsFetchXML;
//err.ToString();

return xmlDoc.DocumentElement;

}

}

#region Component Designer generated code

public FetchAllAccounts()

{

//CODEGEN: This call is required by the ASP.NET Web Services Designer

InitializeComponent();

}


//Required by the Web Services Designer

private IContainer components = null;


/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if(disposing && components != null)

{

components.Dispose();

}

base.Dispose(disposing);

}


#endregion

}

}
 
M

Matt Parks

The user you are trying to connect to CRM with needs to be a valid, licensed CRM
user. in other words, that user needs to be able to access CRM.

Matt Parks
MVP - Microsoft CRM

----------------------------------------
----------------------------------------

This is the error:

<?xml version="1.0" encoding="utf-8" ?>
<Error>ErrorMessage: SOAP Server Application Faulted
<detail><error><code>80040225</code><description>The specified user is
either disabled or is not a member of any business
unit.</description><file>d:\crm\build\3297\src\platform\security\crmsecurity\secmain.cpp</file><line>2281</line></error></detail>
Source: System.Web.Services</Error>




Matt Parks said:
What error are you getting and on which call is it being raised?

Matt Parks
MVP - Microsoft CRM

----------------------------------------
----------------------------------------
I have thuis webservice. Used to get account information out of microsoft
crm. But is reply's an error! can someone see whats the error in this
code???? Help!

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Diagnostics;

using System.Web;

using System.Web.Services;

using System.Xml;

using Microsoft.Crm.Platform.Proxy;

namespace FetchAllAccounts

{

public class FetchAllAccounts : System.Web.Services.WebService

{

// You must change this to the URL for your Microsoft CRM server.

private const string _strCRMURL = "http://hil-mem-03/mscrmservices/";

/// <summary>

/// Retrieve a summary of all accounts in the database.

/// </summary>

[WebMethod]

public XmlNode Fetch()

{

// Create BizUser proxy object.

BizUser objBizUser = new BizUser();

objBizUser.Credentials

= System.Net.CredentialCache.DefaultCredentials;

objBizUser.Url = _strCRMURL + "BizUser.srf";



// Create CRMQuery proxy object.

CRMQuery objQuery = new CRMQuery();

objQuery.Credentials = objBizUser.Credentials;

objQuery.Url = _strCRMURL + "CRMQuery.srf";

string strAllAccountsFetchXML =

@"<fetch mapping='logical'>

<entity name='account'>

<attribute name = 'name'/>

<attribute name = 'accountid'/>

</entity>

</fetch>";



// Execute the query and return the result set.

// If an exception occurs, return the error message instead.

XmlDocument xmlDoc = new XmlDocument();

try

{

xmlDoc.LoadXml(objQuery.ExecuteQuery(objBizUser.WhoAmI(),

strAllAccountsFetchXML));

return xmlDoc;

}

catch (System.Web.Services.Protocols.SoapException err)

{

xmlDoc.LoadXml("<Error/>");

xmlDoc.DocumentElement.InnerText = strAllAccountsFetchXML;
//err.ToString();

return xmlDoc.DocumentElement;

}

}

#region Component Designer generated code

public FetchAllAccounts()

{

//CODEGEN: This call is required by the ASP.NET Web Services Designer

InitializeComponent();

}


//Required by the Web Services Designer

private IContainer components = null;


/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if(disposing && components != null)

{

components.Dispose();

}

base.Dispose(disposing);

}


#endregion

}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top