(Migrated) Using zato to compress XML requests

(This message has been automatically imported from the retired mailing list)

Hello,

I want to use Zato as a XML proxy. TL;DR compress XML to json to use less
bandwidth.

Below the example:

Website request XML -> Zato(transform into JSON) -> INTERNET -> Zato(JSON)
-> Transform to XML -> XML Responser

Any thoughts on this?

Also I was checking this http://msgpack.org/, anyone used this before and
if so how hard it will be to implement on Zato?

Best Regards,

Danilo F. Chilene

Yes!

On Mon, Nov 10, 2014 at 4:20 PM, Dariusz Suchojad dsuch@zato.io wrote:

On 10/11/14 19:17, Danilo Chilene wrote:

Below the example:

Website request XML -> Zato(transform into JSON) -> INTERNET ->
Zato(JSON) -> Transform to XML -> XML Responser

Any thoughts on this?

Hi Danilo,

by XML compression, do you mean transforming XML into JSON?


Dariusz Suchojad

https://zato.io
ESB, SOA, REST, APIs and cloud integrations in Python

Hello,

In attach the XML(request and response).

On Mon, Nov 10, 2014 at 4:25 PM, Dariusz Suchojad dsuch@zato.io wrote:

On 10/11/14 19:22, Danilo Chilene wrote:

Yes!

Ok, this is trivial to easy depending on the message’s format - can you
please attach a few examples of the kind XML you’d like to transform?

thanks,


Dariusz Suchojad

https://zato.io
ESB, SOA, REST, APIs and cloud integrations in Python

Hi,

I think so.

On Mon, Nov 10, 2014 at 4:52 PM, Dariusz Suchojad dsuch@zato.io wrote:

On 10/11/14 19:17, Danilo Chilene wrote:

Also I was checking this http://msgpack.org/, anyone used this before
and if so how hard it will be to implement on Zato?

Ah, I forgot to ask about it - can MsgPack be transported over HTTP? If
so, it will be simple to use it in Zato even without having any
particular support for it directly on the platform.


Dariusz Suchojad

https://zato.io
ESB, SOA, REST, APIs and cloud integrations in Python

On 10/11/14 19:17, Danilo Chilene wrote:

Below the example:

Website request XML -> Zato(transform into JSON) -> INTERNET ->
Zato(JSON) -> Transform to XML -> XML Responser

Any thoughts on this?

Hi Danilo,

by XML compression, do you mean transforming XML into JSON?

On 10/11/14 19:17, Danilo Chilene wrote:

Below the example:

Website request XML -> Zato(transform into JSON) -> INTERNET ->
Zato(JSON) -> Transform to XML -> XML Responser

Any thoughts on this?

Hi Danilo,

by XML compression, do you mean transforming XML into JSON?

On 10/11/14 19:17, Danilo Chilene wrote:

Also I was checking this http://msgpack.org/, anyone used this before
and if so how hard it will be to implement on Zato?

Ah, I forgot to ask about it - can MsgPack be transported over HTTP? If
so, it will be simple to use it in Zato even without having any
particular support for it directly on the platform.

On 10/11/14 19:17, Danilo Chilene wrote:

Also I was checking this http://msgpack.org/, anyone used this before
and if so how hard it will be to implement on Zato?

Ah, I forgot to ask about it - can MsgPack be transported over HTTP? If
so, it will be simple to use it in Zato even without having any
particular support for it directly on the platform.

Hi Dariuz,

Thanks for the explanation, I will give a try on the namespaces problem.

On Tue, Nov 11, 2014 at 11:09 AM, Dariusz Suchojad dsuch@zato.io wrote:

On 10/11/14 19:41, Danilo Chilene wrote:

In attach the XML(request and response).

Zato 2.0 has both xmltodict and huTools on PYTHONPATH by default and it
lets you do things such as in this gist:

https://gist.github.com/dsuch/73bc9b6c5b704fe3aa48

Now your messages use various namespaces and while parsing such requests
is done out of the box with xmltodict, there is no way to automatically
parse JSON into namespace-aware XML messages - obviously there are no
namespaces in JSON.

What you’d need to do in that case is:

  • Prepare a general structure of a response in the service, the major
    nodes, each in its own namespace it requires

  • Only now transform each of the corresponding major elements in JSON to
    its counterpart in XML

In other words, using your examples, create a structure with Segment,
Leg or State and map JSON into each of them individually.

JSON has no namespaces so while converting XML to JSON can be done
automatically, there will always be additional work involved when
converting messages the other way around.

That all assumes that you want to transform entire messages 1:1
XML-JSON-XML. In 2.0 there is a new self.msg.mapper object which lets
one selectively map and transform individual elements of XML, JSON or
dicts as well.