Anyone with a solution to this ?
Customer_Card_Service css = new Customer_Card_Service();
css.Credentials = CredentialCache.DefaultCredentials;
Customer_Card cust = new Customer_Card();
cust.Name = "TEST";
css.Create(ref cust);
This code errors with :
Customer No. '' does not exist.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.Services.Protocols.SoapException: Customer No. '' does not exist.
Source Error:
Line 307: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:microsoft-dynamics-schemas/page/customer_card:Create", RequestNamespace="urn:microsoft-dynamics-schemas/page/customer_card", ResponseElementName="Create_Result", ResponseNamespace="urn:microsoft-dynamics-schemas/page/customer_card", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
Line 308: public void Create(ref Customer_Card Customer_Card) {
Line 309: object[] results = this.Invoke("Create", new object[] {
Line 310: Customer_Card});
Line 311: Customer_Card = ((Customer_Card)(results[0]));
Stack Trace:
[SoapException: Customer No. '' does not exist.]
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +507386
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +215
Customer_Card_Ref.Customer_Card_Service.Create(Customer_Card& Customer_Card) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\2f133f42\e78cef49\App_WebReferences._eb_3n10.8.cs:309
crm2011_accountcreate_to_navision.Page_Load(Object sender, EventArgs e) in d:\Userfiles\My Documents\Visual Studio 2012\Projects\pcsdoc4\pcsdoc4\crm2011\accountcreate_to_navision.aspx.cs:89
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
0
Comments
This is strange it looks like the variable "cust" is not instantiated at all.
It is difficult to say what is wrong as we also need to see the definition for the variables.
The correct code
https://msdn.microsoft.com/en-us/library/dd355316%28v=nav.80%29.aspx
is While in your case
Customer_Card_Service css = new Customer_Card_Service();
css.Credentials = CredentialCache.DefaultCredentials;
Customer_Card cust = new Customer_Card();
cust.Name = "TEST";
css.Create(ref cust);
So the line in read is wrong as this is not the correct variable for cust record.
You can also take a look at this example
http://moodle2.karelia.fi/mod/page/view.php?id=85476
I hope this helps
Thanks.