Question: Consume WebService which provides a CSV format
infonote
Member Posts: 233
Hi,
I need to consume a web-service which provides a text return in CSV format (comma separated). I was thinking of doing this using an XMLPort.
The data will contain an ID linked to a Nav table, which will then modify the records in the table, with two or more other fields. This will be a daily process, so the amount of data may be quite large at times.
Has anyone ever implemented this? In the XMLPort, there are properties which allow text format so I assume it is possible to do so.
Thanks in advance.
I need to consume a web-service which provides a text return in CSV format (comma separated). I was thinking of doing this using an XMLPort.
The data will contain an ID linked to a Nav table, which will then modify the records in the table, with two or more other fields. This will be a daily process, so the amount of data may be quite large at times.
Has anyone ever implemented this? In the XMLPort, there are properties which allow text format so I assume it is possible to do so.
Thanks in advance.
Blog: http://www.kaizenlog.com
0
Comments
-
the webservices returns a csv file directly, or an xml and within the xml a node contains a csv file?
the first one i have done by saving the result to a csv file. Then reading the csv file manually.0 -
Thanks for the reply.
The Web-Service will return a string/text which will contain 3 fields (ID, and 2 other fields). The fields will be comma separated and each "record" will be filtered by a semi-colon;.
E.g.
ID Field1 Field2
1 20/09/2012 A
2 20/09/2012 B
3 20/09/2012 C
1,20/09/2012,A;2,20/09/2012,B;3,20/09/2012,C
NAV will then need to modify the records of a particular table for each "record".Blog: http://www.kaizenlog.com0 -
Hi
You can do this by using the XmlPort import by designing the XmlPort using the temporary Integer table and then use RecordRef and FieldRef to point to the table and fields you want to insert values for.
Below is an sample xmlport object that can insert into a given table identified by the ID and then a couple of date and time fields.
OBJECT XMLport 50000 Sample code
{
PROPERTIES
{
Format=Variable Text;
}
ELEMENTS
{
{ [{0C6358F9-D6FF-46EA-84E4-C1A93947B2EC}]; ;Root ;Element ;Text }
{ [{1BD9C664-3DF7-490E-93A1-F62814E501CD}];1 ;Records ;Element ;Table ;
SourceTable=Table2000000026;
Temporary=Yes;
AutoSave=No;
Import::OnBeforeInsertRecord=VAR
VarDate@1000 : Date;
VarTime@1001 : Time;
VarID@1002 : Integer;
BEGIN
EVALUATE(VarID,ID);
RecRef.OPEN(VarID);
FieldRef1 := RecRef.FIELD(2);
EVALUATE(VarDate,Field1);
FieldRef1.VALUE(VarDate);
FieldRef2 := RecRef.FIELD(3);
EVALUATE(VarTime,Field2);
FieldRef2.VALUE(VarTime);
RecRef.INSERT;
RecRef.CLOSE;
END;
}
{ [{5EDA8113-81CD-4C26-A9F8-547655C1F450}];2 ;ID ;Element ;Text }
{ [{194DB95E-5A59-4E89-B7FB-60BA2896E8E1}];2 ;Field1 ;Element ;Text }
{ [{30DD09E5-445B-4406-8E0E-743A55981524}];2 ;Field2 ;Element ;Text }
}
CODE
{
VAR
RecRef@1000 : RecordRef;
FieldRef1@1001 : FieldRef;
FieldRef2@1002 : FieldRef;
}
}“This posting is provided "AS IS" with no warranties, and confers no rights.”
Lars-Bo Christensen
Software Developer @ Microsoft0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K 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
- 324 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