Home Forums Integration Messages How to evaluate the size of Message object

Tagged: 

Viewing 1 reply thread
  • Author
    Posts
    • #8823
      Aditya PhatakAditya Phatak
      Participant

      Hi,

      While testing a service which uses a message and its sub-parts, we found that the end system has restricted size of the message to 65kb.

      I wanted to check the size of the message which is formed using the given XSD, but there was no such function available.

      Is there a way to convert the message object to a string so that we can evaluate its size using (string-length xmlMessage)?

      OR

      Is there a way to directly evaluate size of a message object in scheme console?

      0
    • #8831
      Ed ShawEd Shaw
      Keymaster

      There is definitely a way to check how large a message will be “on the wire” before sending it. I’m assuming that you have an integration Service that populates a Message which has an XML Format. If you send the message over an HTTP channel, the message will be automatically formatted for you from it’s internal representation (Transfer Object) to its external representation (in this case an XML string, but this would work the same if it was JSON formatted or any of the other supported formats).

      So what we need to do is format our message to XML *before* sending it so we can check it’s size. To do this, simply do the following.

      Test this value against your upper limit and do some error handling or message chunking as appropriate.

       

      Just as a reminder, you have two options for sending messages over HTTP (and other) channels. The first is to just send the message over the channel and let the message get formatted automatically *or* you may format the message yourself and put the resulting text in the body part of an HTTP message. This gives you a bit more dynamic control over the headers, … of the message.

      e.g.

       

      0
Viewing 1 reply thread
  • You must be logged in to reply to this topic.