on 03-28-2006 2:22 PM
Hi,
I have to generate and send an xml file (encoding utf-8)that contains escape characters code.
I mean, I need to put for example § instead of '§' or ~ instead of ~.
Let suppose XI receives an xml that contains these strange characters and let suppose that XI have to change them (in string fields obviously) into their corresponding codes.
I made in the message mapping an user-defined function like this:
+
StringBuffer sb = new StringBuffer();
int n = a.length();
for (int i = 0; i and it does not convert properly the entire code.
So, the displayed result on xml-target is not what I expected to see (§ ???).
Is there anyone of you, guys, that knows a trick to bypass this problem and finally generate an xml target file containing escape characters codes?
thanks in advance
Alex
Hi Alex,
Try using this method:
<b>java.net.URLEncoder.encode(String arg)</b>
Regards,
Ananth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ananth,
I tried the solution you proposed but it's not what I want to do.
I tried to follow other ways (inside the message mappingbut, in any case, my pretty friend XI convert two times '&'.
XI doesn't work properly even if I put my node value inside a CDATA.
I suppose I must find "something" out from the graphical mapping.
Is there anyone else having other suggestions?
I'll appreciate so much.
tnx friends.
Alex
Alex ,
this is the code I always use in my Java mappings to replace < > & and ' at one go. May be you'll get a hint from this.
String currentData = new String(ch, start, length);
currentData =currentData
.replaceAll("&", "&")
.replaceAll("<", "<")
.replaceAll(">", ">")
.replaceAll("'", "'");
Hi Amol,
if I had an XI environment that works properly, I suppose, your solution should be OK.
As I ready tested a similar trick biy using a java mapping, I tell you that the result is:
<myTargetNode>text &lt</myTargetNode>
instead of
<myTargetNode>text <</myTargetNode>
Very strange, isn't it?!?
Alex,
It is clear from your output that your replace logic is getting called like this :
<b><myTargetNode>text ></myTargetNode></b>gets converted to
<b><myTargetNode>text <</myTargetNode></b>and once again the next part which replaces the & in this too
so your output is then
<b><myTargetNode>text &lt;</myTargetNode></b>
May be you could try with a proper replace sequence in this case ...
Hi Amol,
even with a proper replace...it doesn't work.
I tried to do another kind of solution:
The Sender system sends an xml that already contains escape codes. I thought it was a good idea. So, I suppressed all replaces, 'cause they were useless.
Well, do you want to know what Xi has made?
Watch the example here below:
".
I have seen into Communication Channel section (ID)
there is a parameter I can use: an option flag on "Mask Special Characters (URL escaping).
Is it possible that if I choose it, the receiving system receives an xml with escape chars?
Hi Suraj,
I 'm using a HTTP receiver, so I can't use a java module to link to the Communication Channel. HTTP is on ABAP stack.
Anyway, I cannot change the adapter type for the receiving system: the owner doesn't allow to do this.
In few words, I have bounded hands and I have to find a solution without changing the scenario:
Sender(AbapProxy)>>>XI>>>(HTTP)Receiver
I'm going to write an OSS Note 'cause I really don't know what to do.
Perhaps it's useful for you to know "how to do" in these cases: I will update this discussion with solutions proposed by SAP.
Regards and many thanks for your support
Alex
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.