cancel
Showing results for 
Search instead for 
Did you mean: 

How can I determine XML file size before sending to WebService?

Former Member
0 Kudos

Hi!

I'm new to XI, and I'm facing this problem: I'm developing a solution where I have to send one or more documents to a government webservice, but this webservice has a XML size limitation of 256kB. I could send one document at time, but this can cause an overload at the gorvernment server, so, I must send one XML with lots of documents in it. But the XML data sent to the webservice must not cross the 256kB limit. Also, each document doesn't have a fixed size.

The question is: how can I determine the size of this XML before sending it?

Oh, almost forgot: I'm using XI 3.0.

Hope I made myself clear.

Thanks in advance.

Andre

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Andre what sort of client you use triggers the request thro' XI?

Former Member
0 Kudos

Hi, Sriram,

The data is sent to XI from BW, through RFC, and it is mapped inside XI.

Thanks,

Andre

former_member206604
Active Contributor
0 Kudos

Hi,

You can try this way a simplest. First measure the size of the XML with 1 record with all maximum entries. Then calculate howmuch you can send it. By this you can send it based on number of records rather than size of the XML. This would be the easier way to do it.

Regards,

Prakash

Former Member
0 Kudos

Andre

As prakash says there is no formal mechanism (to my knowledge,perhaps some one more informed might know) to trap message payload as an event to split messages and process in XI.One way could be evaluate a Upper/lower watermark for processing your webservice by ensuring every field in your RFC is filled to max limit.Then find how many records would limit the XML to 256K and then decide the outflow..But this still remains a crude mechanism

Former Member
0 Kudos

Hi, Prakash,

I already thought doing this way. The documents will be a representation of a Sales Order, with all taxes, etc... So, I can have a Sales Order with one item, or a Sales Order with a thousand items. There will be a text field, where the user can type any text (maximum of 8000 characters). This way, it's really very difficult to determine the size of one single document. One document can have sizes ranging from 500 bytes to more than 256 kB (in this case, I must issue a warning to the user, an the user will split the document in two or more pieces).

BW sends one document at a time to XI, and XI "groups" (I don't know if this is the correct term) one or more documents into one single XML document.

Thank you very much.

Andre

Message was edited by: Andre Luis Arantes Monteiro

former_member206604
Active Contributor
0 Kudos

Hi Andre,

Yes I understand.. so the spliting of the document is not automatic right.. coz even if are finding out the file size on what basis we will split the records? If that is the case you can either use Java mapping or adapter module to find the size of the stream that is coming in and if it is above the limit set a flag and send it back as u said. I guess there should be a function in Java to get the size of the stream. Hmm I think you can use sizeof() function..

One more option is try to fix the number of character for those kind of lengthies fields and then also fix number of line items. So if exceeds those limits send it back. This is just a thought..

Regards,

Prakash

Former Member
0 Kudos

Ok, Prakash,

I'll try to do something like this (although I'm ABAP, and don't know java very well).

Thank you very much!

Andre

former_member206604
Active Contributor
0 Kudos

Hi Andre,

Try it and let us know. Also check if that check can happen in BW instead of coming to XI and going back saying message is big.. rather check in BW. I am not sure if it is possible in BW.

<i>>>>although I'm ABAP, and don't know java very well</i>

No problem Java mapping is'nt that difficult. You can also try with ABAP mapping as well.

Regards,

Prakash

Former Member
0 Kudos

Hi Prakash,

Do you have any documentation or link that explains how I could make the java mapping?

As I'm new to XI, I don't know if I can do this: as there is already a BPM for the whole process, can I create this java mapping immediately before sending the data to the webservice, and this java mapping only measure the size of the data (using the sizeof() function). This mapping would be a sort of dummy mapping, as it would only ceck the size of the data stream. Can it be done?

Thanks again!

Andre

former_member206604
Active Contributor
0 Kudos

Hi Andre,

<i>>>>as there is already a BPM for the whole process, can I create this java mapping immediately before sending the data to the webservice</i>

Yes you can, you can have a transformation step as the first step immediately after receive step. In that transformation you can either use Java mapping of ABAP maiing to just check and give you out a simple structre with flag saying True/False and also the size if needed.

You can strcutre output from the Java/ABAP mapping can this..justan idea

CheckSize

--Flag

--Size

You can refer this document for ABAP mapping.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e3ead790-0201-0010-64bb-9e4...

For Java mapping

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7fa68d90-0201-0010-b18a-861...

Regards,

Prakash

former_member206604
Active Contributor
Former Member
0 Kudos

Thank you, Prakash!

I'll try your solution, and if it works, I'll let you know.

Thank you very much.

Andre

Answers (0)