Issue in delete function customer table webservices

Ashish_Gupta
Member Posts: 56
We have prepared the following code unit in NAV
We are receiving the following error :
OBJECT Codeunit 50000 Cust Delete { OBJECT-PROPERTIES { Date=28/08/09; Time=19:33:42; Modified=Yes; Version List=; } PROPERTIES { TableNo=18; OnRun=BEGIN END; } CODE { VAR Customer@1000000000 : Record 18; PROCEDURE DeleteCust@1000000000(VAR CustCode@1000000000 : Text[30]); BEGIN IF Customer.GET(CustCode) THEN Customer.DELETE; END; BEGIN END. } }We have defined the codeunit in Form 810 and marked Publish field true. The codeunit has been called in ASP.NET with C#.NET. The web service has been properly defined and now we have written the following code:
CustDelete cus = new CustDelete(); service.UseDefaultCredentials = true; string a = "C00150"; cus.DeleteCust(ref a);
We are receiving the following error :
The request failed with HTTP status 401: Unauthorized. 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.Net.WebException: The request failed with HTTP status 401: Unauthorized. Source Error: Line 44: [System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:microsoft-dynamics-schemas/codeunit/CustDelete:DeleteCust", RequestNamespace="urn:microsoft-dynamics-schemas/codeunit/CustDelete", ResponseElementName="DeleteCust_Result", ResponseNamespace="urn:microsoft-dynamics-schemas/codeunit/CustDelete", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] Line 45: public void DeleteCust(ref string custCode) { Line 46: object[] results = this.Invoke("DeleteCust", new object[] { Line 47: custCode}); Line 48: custCode = ((string)(results[0]));
Ashish Gupta
Navision Technical Consultant
Navision Technical Consultant
0
Answers
-
I'm assuming insert customer or modifying works?
you are passing Customer by reference, So once you delete the customer, What are expecting to be returned?0 -
it was our fault!!
we are not passing the proper credentials!!Ashish Gupta
Navision Technical Consultant0 -
That's what I thought as well, but wanted to make sure it wasn't just deleting customers.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions