MXL specification

This forum is intended for cases when a problem can not be solved due to restrictions of the platform: a bug or lack of functionality.

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jul 10, 2018
Company: A.R. Merkeleon GmbH

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.

 
#2
People who like this:0Yes/0No
Administrator
Rating: 8
Joined: Oct 3, 2019
Company:

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/

 
#3
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jul 10, 2018
Company: A.R. Merkeleon GmbH

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);

 
#4
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jul 10, 2018
Company: A.R. Merkeleon GmbH

So, can please give me MXL specification?

 
#5
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Aug 15, 2018
Company:

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.

 
Subscribe
Be the first to know tips & trick on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.