Web Service import problem
Kimmo
Member Posts: 2
Hello,
I need to implement Web Service, which can import/export XML-data from/to NAV5. When I'm trying to import XML-data,
NAV doesn't accept the SOAP-request if the XML-data is too long and I get this error message:
The XML Parser return the following fatal error:
Illegal xml character.
Line Number=59 Column Number=1
Import works fine when the XML-data is up to 58 lines long.
Web Service, XML-port and CodeUnit are based on this example.
Here is my CodeUnit code:
ItemPLM2-XML-port includes all field of the Item table.
I have made some changes to the example code. Here's my Insert-method:
SOAP-request:
What should I do to get this work?
I need to implement Web Service, which can import/export XML-data from/to NAV5. When I'm trying to import XML-data,
NAV doesn't accept the SOAP-request if the XML-data is too long and I get this error message:
The XML Parser return the following fatal error:
Illegal xml character.
Line Number=59 Column Number=1
Import works fine when the XML-data is up to 58 lines long.
Web Service, XML-port and CodeUnit are based on this example.
Here is my CodeUnit code:
Documentation()
OnRun()
IF(CREATE(WebService)) THEN BEGIN
WebService.Start();
MESSAGE('Started');
END ELSE BEGIN
MESSAGE('Not started')
END
WebService::Read()
output:=WebService.Output();
XMLPORT.EXPORT(XMLPORT::ItemPLM2,output);
WebService::Insert()
input:=WebService.Input();
XMLPORT.IMPORT(XMLPORT::ItemPLM2, input);
ItemPLM2-XML-port includes all field of the Item table.
I have made some changes to the example code. Here's my Insert-method:
public void Insert(String xml) {
//Forward the message to the navEventListner
navEventListner.SendInsertMessage(xml);
}
SOAP-request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dem="uri://Microsoft.Dynamics.NAV/Demoware">
<soapenv:Header/>
<soapenv:Body>
<dem:Insert>
<dem:xml> <![CDATA[
<Items>
<Item>
<No>12345</No>
<No_2 />
<Description>WsDemo</Description>
<Search_Description>WsDemo</Search_Description>
<Description_2 />
<Bill_of_Materials>0</Bill_of_Materials>
<Base_Unit_of_Measure>PCS</Base_Unit_of_Measure>
<Price_Unit_Conversion>0</Price_Unit_Conversion>
<Inventory_Posting_Group>FINISHED</Inventory_Posting_Group>
<Shelf_No>10</Shelf_No>
<Item_Disc_Group />
<Allow_Invoice_Disc>1</Allow_Invoice_Disc>
<Statistics_Group>0</Statistics_Group>
<Commission_Group>0</Commission_Group>
<Unit_Price>50</Unit_Price>
<Price_Profit_Calculation>0</Price_Profit_Calculation>
<Profit_percent>50</Profit_percent>
<Costing_Method>0</Costing_Method>
<Unit_Cost>25</Unit_Cost>
<Standard_Cost>0</Standard_Cost>
<Last_Direct_Cost>0</Last_Direct_Cost>
<Indirect_Cost_percent>0</Indirect_Cost_percent>
<Cost_is_Adjusted>0</Cost_is_Adjusted>
<Allow_Online_Adjustment>0</Allow_Online_Adjustment>
<Vendor_No>2</Vendor_No>
<Vendor_Item_No>12254</Vendor_Item_No>
<Lead_Time_Calculation></Lead_Time_Calculation>
<Reorder_Point>0</Reorder_Point>
<Maximum_Inventory>0</Maximum_Inventory>
<Reorder_Quantity>0</Reorder_Quantity>
<Alternative_Item_No />
<Unit_List_Price>0</Unit_List_Price>
<Duty_Due_percent>0</Duty_Due_percent>
<Duty_Code />
<Gross_Weight>45</Gross_Weight>
<Net_Weight>12</Net_Weight>
<Units_per_Parcel>0</Units_per_Parcel>
<Unit_Volume>0</Unit_Volume>
<Durability />
<Freight_Type />
<Tariff_No>12122</Tariff_No>
<Duty_Unit_Conversion>0</Duty_Unit_Conversion>
<Country_Region_Purchased_Code />
<Budget_Quantity>0</Budget_Quantity>
<Budgeted_Amount>0</Budgeted_Amount>
<Budget_Profit>0</Budget_Profit>
<Comment>0</Comment>
<Blocked>0</Blocked>
<Cost_is_Posted_to_G_L>1</Cost_is_Posted_to_G_L>
<Last_Date_Modified>2008-10-06</Last_Date_Modified>
<Date_Filter />
<Global_Dimension_1_Filter />
<Global_Dimension_2_Filter />
<Location_Filter />
<Inventory>0</Inventory>
<Net_Invoiced_Qty>0</Net_Invoiced_Qty>
<Net_Change>0</Net_Change>
<Purchases_Qty>0</Purchases_Qty>
<Sales_Qty>0</Sales_Qty>
<Positive_Adjmt_Qty>0</Positive_Adjmt_Qty>
<Negative_Adjmt_Qty>0</Negative_Adjmt_Qty>
<Purchases_LCY>0</Purchases_LCY>
<Sales_LCY>0</Sales_LCY>
<Positive_Adjmt_LCY>0</Positive_Adjmt_LCY>
<Negative_Adjmt_LCY>0</Negative_Adjmt_LCY>
<COGS_LCY>0</COGS_LCY>
<Qty_on_Purch_Order>10</Qty_on_Purch_Order>
<Qty_on_Sales_Order>20</Qty_on_Sales_Order>
<Price_Includes_VAT>0</Price_Includes_VAT>
<Drop_Shipment_Filter>0</Drop_Shipment_Filter>
<VAT_Bus_Posting_Gr_Price />
<Gen_Prod_Posting_Group>RAW MAT</Gen_Prod_Posting_Group>
<Picture />
<Transferred_Qty>0</Transferred_Qty>
<Transferred_LCY>0</Transferred_LCY>
<Country_Region_of_Origin_Code>FI</Country_Region_of_Origin_Code>
<Automatic_Ext_Texts>1</Automatic_Ext_Texts>
<No_Series />
<Tax_Group_Code />
<VAT_Prod_Posting_Group />
<Reserve>1</Reserve>
<Reserved_Qty_on_Inventory>0</Reserved_Qty_on_Inventory>
<Reserved_Qty_on_Purch_Orders>0</Reserved_Qty_on_Purch_Orders>
<Reserved_Qty_on_Sales_Orders>0</Reserved_Qty_on_Sales_Orders>
<Global_Dimension_1_Code />
<Global_Dimension_2_Code />
<Res_Qty_on_Outbound_Transfer>0</Res_Qty_on_Outbound_Transfer>
<Res_Qty_on_Inbound_Transfer>0</Res_Qty_on_Inbound_Transfer>
<Low_Level_Code>1</Low_Level_Code>
<Lot_Size>2</Lot_Size>
<Serial_Nos>SN</Serial_Nos>
<Last_Unit_Cost_Calc_Date />
<Rolled_up_Material_Cost>0.00</Rolled_up_Material_Cost>
<Rolled_up_Capacity_Cost>0.00</Rolled_up_Capacity_Cost>
<Scrap_percent>0</Scrap_percent>
<Inventory_Value_Zero>0</Inventory_Value_Zero>
<Discrete_Order_Quantity>0</Discrete_Order_Quantity>
<Minimum_Order_Quantity>10</Minimum_Order_Quantity>
<Maximum_Order_Quantity>100</Maximum_Order_Quantity>
<Safety_Stock_Quantity>100</Safety_Stock_Quantity>
<Order_Multiple>10</Order_Multiple>
<Safety_Lead_Time><D1></Safety_Lead_Time>
<Flushing_Method>2</Flushing_Method>
<Replenishment_System>1</Replenishment_System>
<Scheduled_Receipt_Qty>0</Scheduled_Receipt_Qty>
<Scheduled_Need_Qty>0</Scheduled_Need_Qty>
<Rounding_Precision>0</Rounding_Precision>
<Bin_Filter />
<Variant_Filter />
<Sales_Unit_of_Measure>PCS</Sales_Unit_of_Measure>
<Purch_Unit_of_Measure>PCS</Purch_Unit_of_Measure>
<Reorder_Cycle><D5></Reorder_Cycle>
<Reserved_Qty_on_Prod_Order>0</Reserved_Qty_on_Prod_Order>
<Res_Qty_on_Prod_Order_Comp>0</Res_Qty_on_Prod_Order_Comp>
<Res_Qty_on_Req_Line>0</Res_Qty_on_Req_Line>
<Reordering_Policy>4</Reordering_Policy>
<Include_Inventory>0</Include_Inventory>
<Manufacturing_Policy>1</Manufacturing_Policy>
<Stockkeeping_Unit_Exists>0</Stockkeeping_Unit_Exists>
<Manufacturer_Code />
<Item_Category_Code>100</Item_Category_Code>
<Created_From_Nonstock_Item>0</Created_From_Nonstock_Item>
<Product_Group_Code>1000</Product_Group_Code>
<Substitutes_Exist>0</Substitutes_Exist>
<Qty_in_Transit>0</Qty_in_Transit>
<Trans_Ord_Receipt_Qty>100</Trans_Ord_Receipt_Qty>
<Trans_Ord_Shipment_Qty>100</Trans_Ord_Shipment_Qty>
<Qty_Assigned_to_ship>100</Qty_Assigned_to_ship>
<Qty_Picked>0</Qty_Picked>
<Service_Item_Group>12</Service_Item_Group>
<Qty_on_Service_Order>0</Qty_on_Service_Order>
<Res_Qty_on_Service_Orders>0</Res_Qty_on_Service_Orders>
<Item_Tracking_Code>SNSALES</Item_Tracking_Code>
<Lot_Nos>WHRI</Lot_Nos>
<Expiration_Calculation><200M></Expiration_Calculation>
<Lot_No_Filter />
<Serial_No_Filter />
<No_of_Substitutes>0</No_of_Substitutes>
<Special_Equipment_Code>TUOT</Special_Equipment_Code>
<Put_away_Template_Code>TESTTEMPLA</Put_away_Template_Code>
<Put_away_Unit_of_Measure_Code>PCS</Put_away_Unit_of_Measure_Code>
<Phys_Invt_Counting_Period_Cod>1224</Phys_Invt_Counting_Period_Cod>
<Last_Counting_Period_Update />
<Next_Counting_Period>26.08.08..03.09.08</Next_Counting_Period>
<Last_Phys_Invt_Date />
<Use_Cross_Docking>1</Use_Cross_Docking>
<Identifier_Code />
<Routing_No>2</Routing_No>
<Production_BOM_No>3</Production_BOM_No>
<Single_Level_Material_Cost>0</Single_Level_Material_Cost>
<Single_Level_Capacity_Cost>0</Single_Level_Capacity_Cost>
<Single_Level_Subcontrd_Cost>0</Single_Level_Subcontrd_Cost>
<Single_Level_Cap_Ovhd_Cost>0</Single_Level_Cap_Ovhd_Cost>
<Single_Level_Mfg_Ovhd_Cost>0</Single_Level_Mfg_Ovhd_Cost>
<Overhead_Rate>0.1</Overhead_Rate>
<Rolled_up_Subcontracted_Cost>0</Rolled_up_Subcontracted_Cost>
<Rolled_up_Mfg_Ovhd_Cost>0</Rolled_up_Mfg_Ovhd_Cost>
<Rolled_up_Cap_Overhead_Cost>0</Rolled_up_Cap_Overhead_Cost>
<Planning_Issues_Qty>0</Planning_Issues_Qty>
<Planning_Receipt_Qty>0</Planning_Receipt_Qty>
<Planned_Order_Receipt_Qty>0</Planned_Order_Receipt_Qty>
<FP_Order_Receipt_Qty>0</FP_Order_Receipt_Qty>
<Rel_Order_Receipt_Qty>0</Rel_Order_Receipt_Qty>
<Planning_Release_Qty>0</Planning_Release_Qty>
<Planned_Order_Release_Qty>0</Planned_Order_Release_Qty>
<Purch_Req_Receipt_Qty>0</Purch_Req_Receipt_Qty>
<Purch_Req_Release_Qty>0</Purch_Req_Release_Qty>
<Order_Tracking_Policy>2</Order_Tracking_Policy>
<Prod_Forecast_Quantity_Base>0</Prod_Forecast_Quantity_Base>
<Production_Forecast_Name />
<Component_Forecast>0</Component_Forecast>
<Qty_on_Prod_Order>0</Qty_on_Prod_Order>
<Qty_on_Component_Lines>0</Qty_on_Component_Lines>
<Critical>0</Critical>
<Common_Item_No>12257</Common_Item_No>
</Item>
</Items>]]>
</dem:xml>
</dem:Insert>
</soapenv:Body>
</soapenv:Envelope>
What should I do to get this work?
0
Comments
-
I suggest to use msmq or this post on implementing webservice in 5.0
http://feeds.feedburner.com/~r/Microsof ... v-5-0.aspx0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
