Pages with subforms in web service (f.e. creating an SO)

Miklos_Hollender
Member Posts: 1,598
Attempt A: setting up page 42 and 46 both as web services, called SOPage and SOLinesPage.
Problem 1: cannot specify Document No. and Line No. However, this can be probably worked around by adding them to the page.
Problem 2: getting exception: "Namespace "urn:microsoft-dynamics-schemas/page/sopage" in message is invalid, expected "urn:microsoft-dynamics-schemas/page/solinespage"
It seems it doesn't like having 2 different we services referenced?
Attempt B: try to do it all through the Sales Order Page service:
Problem 1: again, cannot specify the Document No. and Line No. but again probably can be resolved by adding it to the page.
Problem 2: doesn't compile, "Argument '1': cannot convert from 'ref EnterSalesOrder.SOService.Sales_Order_Line' to 'ref EnterSalesOrder.SOService.SOPage'"
Apparently you cannot supply the subform as a reference to the Create of the main page.
Attempt C: same stuff, but without the last line
(hoping it will create the line too if I just Create the header, the main page: perhaps it creates every record in the page, including the subforms)
Problem: nope, simply nothing happens, no Sales Line record created.
Any other ideas?
SOService.SOPage_Service serv = new EnterSalesOrder.SOService.SOPage_Service(); serv.UseDefaultCredentials = true; serv.Url = "http://localhost:7047/DynamicsNAV/WS/CRONUS_UK_Ltd/Page/SOPage"; SOService.SOPage page = new SOService.SOPage(); page.Sell_to_Customer_No = "10000"; SOLinesService.SOLinesPage_Service lineserv = new SOLinesService.SOLinesPage_Service(); lineserv.UseDefaultCredentials = true; serv.Url = "http://localhost:7047/DynamicsNAV/WS/CRONUS_UK_Ltd/Page/SOLinesPage"; SOLinesService.SOLinesPage lines = new SOLinesService.SOLinesPage(); lines.No = "1000"; lines.Quantity = 1; serv.Create(ref page); lineserv.Create(ref lines);
Problem 1: cannot specify Document No. and Line No. However, this can be probably worked around by adding them to the page.
Problem 2: getting exception: "Namespace "urn:microsoft-dynamics-schemas/page/sopage" in message is invalid, expected "urn:microsoft-dynamics-schemas/page/solinespage"
It seems it doesn't like having 2 different we services referenced?
Attempt B: try to do it all through the Sales Order Page service:
SOService.SOPage_Service serv = new EnterSalesOrder.SOService.SOPage_Service(); serv.UseDefaultCredentials = true; serv.Url = "http://localhost:7047/DynamicsNAV/WS/CRONUS_UK_Ltd/Page/SOPage"; SOService.SOPage page = new SOService.SOPage(); page.Sell_to_Customer_No = CustomerNo; SOService.Sales_Order_Line line = new SOService.Sales_Order_Line(); line.No = "1000"; line.Quantity = 1; serv.Create(ref page); serv.Create(ref line);
Problem 1: again, cannot specify the Document No. and Line No. but again probably can be resolved by adding it to the page.
Problem 2: doesn't compile, "Argument '1': cannot convert from 'ref EnterSalesOrder.SOService.Sales_Order_Line' to 'ref EnterSalesOrder.SOService.SOPage'"
Apparently you cannot supply the subform as a reference to the Create of the main page.
Attempt C: same stuff, but without the last line
(hoping it will create the line too if I just Create the header, the main page: perhaps it creates every record in the page, including the subforms)
Problem: nope, simply nothing happens, no Sales Line record created.
Any other ideas?
0
Comments
-
I think the end result is: following the DIY traditions of NAV, use a codeunit-based webservice and code it manually.0
-
If I understand correctly, you are trying to create a sales line in an order, correct? You don't need to expose the subform (salesline). Consider this code (it is a PO, but it works the same way):
// create new purchase order Purchase_Order newPurchaseOrder = new Purchase_Order(); newPurchaseOrder.Buy_from_Vendor_No = "30000"; // set up the lines Purchase_Order_Line[] orderLineList = new Purchase_Order_Line[1]; orderLineList[0] = new Purchase_Order_Line(); orderLineList[0].Type = PurchaseOrder.Type.Item; orderLineList[0].TypeSpecified = true; orderLineList[0].No = "1906-S"; orderLineList[0].QuantitySpecified = true; orderLineList[0].Quantity = 2.0M; newPurchaseOrder.PurchLines = orderLineList; // create the order purchaseOrderService.Create(ref newPurchaseOrder);
Tom Cornelius
Test Lead
Microsoft Dynamics NAV
This posting is provided "AS IS" with no warranties, and confers no rights.0 -
Ah, I see. So that's an array of objects. Instantiate the array, and an element, then put the array into the page's container. Or whatever. Something like that. I think I got it. Thanks.
Could you perhaps arrange it to get this example into the next version of NAV_ADG?0 -
Miklos Hollender wrote:the next version of NAV_ADG?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