Desktop version

Main > Forum > 1C:Enterprise Platform > Bugs and functionality requests to 1C:Enterprise platform > MXL specification

Forum

Search UsersRules
MXL specification
#1
Just came
Points:: 0
Joined:: Jul 10, 2018

Hi!
I want to integrate 1C with some .net core web service, and for faster data processing I want to make c# service response to 1C with MXL format. So all the flow will look like - 1C make HTTP request and send it to .net service. Service process data and send to 1C response with MXL. 1C use method ValueFromFile() to the response and get a ValueTable object. There's only one problem - I can't find anywere document with MXL specification for 1C ValueTable object, does such exists? I just want to be sure there is no errors in MXL file that I'll prepare on C# side.

Profile
#2
Administrator
Points:: 0
Joined:: Oct 3, 2019

Hello Dmitry,

it is not advisable to use the MXL format for data exchange between 1C and third-party solutions.

To create an exchange between 1C and another information system, the best choice at the moment is the JSON format and JSON serialization.

The main advantage of this solution is that the JSON format is used in most modern IT solutions. All modern programming languages ​​have frameworks to work with this format, which greatly simplifies the work.

And the exchange process itself will look exactly the same: you create a web service on .net, 1C posts data to this service, but instead of ValueToFile(), you convert to JSON. And also when receiving a response from the server.

You can see a small example of how this works here: https://1c-dn.com/blog/work-with-http-services-in-1c-part-2-post-method/

Profile
#3
Just came
Points:: 0
Joined:: Jul 10, 2018

Yep, I know that MXL is not advisable, and I know that JSON are better, but:
1. I'm talking about big files with millions of records - serialization of JSON becomes too slow.
2. 1C JSON serialization is broken. For example:
JSONReader = New JSONReader;
JSONReader.OpenFile(FilePath);

JSONObject = XDTOFactory.ReadJSON(JSONReader);
If your JSON starts as array: [{"rates":[{ ... }]}] then you'll get ar error. Also some symbols like \u0000 leads to error. So to work with JSON in 1C you need to write something like:
// Reading response:
FilePath = GetTempFileName();
Text = Response.GetBodyAsString();
If Text = "[]" Then
Continue;
EndIf;
Text = "{""items"":" + StrReplace(Text, "\u0000", "") + "}";  // for parser not to get crazy

TextDoc = New TextDocument;
TextDoc.SetText(Text);
TextDoc.Write(FilePath);

JSONReader = New JSONReader;
JSONReader.OpenFile(FilePath);
ObjectJSON = XDTOFactory.ReadJSON(JSONReader);

Profile
#4
Just came
Points:: 0
Joined:: Jul 10, 2018

So, can please give me MXL specification?

Profile
#5
Just came
Points:: 0
Joined:: Aug 15, 2018

The best way - you can create wsdl service, and put all info there. In wsdl you can select 1c configuration types, and got the same, what you want.
Or use - XML serializator and got the same. Not JSON, and you already know - why.
And not forgot, that when you read xml with serializator, or with ValueFromFile - that mean, that all info will be load into your RAM, and if you got 1b rows, then you have to cut it by part, or read like simple xml, tag by tag.

I got some knowledge about mxl, and in real case - its too difficult type. Couse it has too much thing, what you do not need. Example - region name, localization, few tab doc in one with different columns, and - it can be changed with platform version.

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.