Author |
Message
|
next |
Posted: Sun Jul 11, 2010 11:54 pm Post subject: How to Remove \n chars from xml message..??!!! |
|
|
Voyager
Joined: 02 May 2010 Posts: 75
|
Can anybody suggest how to remove '\n' chars from an xml message...??
I am setting the whole message in a httpRequestURL and because of these chars the message is getting chopped and it is not going properly to the target....
I tried replace with '', but it isnt working
Regards,
Suresh. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Jul 12, 2010 3:59 am Post subject: Re: How to Remove \n chars from xml message..??!!! |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
next wrote: |
Can anybody suggest how to remove '\n' chars from an xml message...?? |
Why do you need to? Most XML parsers (including those supplied with WMB) ignore them or identify them as whitespace, hence logically remove them. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jul 12, 2010 4:04 am Post subject: Re: How to Remove \n chars from xml message..??!!! |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vitor wrote: |
next wrote: |
Can anybody suggest how to remove '\n' chars from an xml message...?? |
Why do you need to? Most XML parsers (including those supplied with WMB) ignore them or identify them as whitespace, hence logically remove them. |
Because as next said, they are including it in an httpRequestUrl, i.e. as a GET parameter, ?='<xml....', which goes into the URL string. URLs don't like line endings in the middle of them.
I'm just wondering what the value of 'it isn't working' is. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Jul 12, 2010 4:13 am Post subject: Re: How to Remove \n chars from xml message..??!!! |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
Because as next said, they are including it in an httpRequestUrl, i.e. as a GET parameter, ?='<xml....', which goes into the URL string. URLs don't like line endings in the middle of them. |
Granted, but if it's being built from the contents of a message tree then those tree elements won't have line feeds in them unless they're business data inside a tag value (which is easy to strip out).
It does, as you say, depend a lot on what "it's not working" means in this context. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
next |
Posted: Mon Jul 12, 2010 10:10 pm Post subject: |
|
|
Voyager
Joined: 02 May 2010 Posts: 75
|
Hi Guys,
Thanks for you responses.
The problem i was facing was when i tried to set the message in the HTTPRequestURL it was like the below
https://localhost:8080/servlet?request=<input>
<parm>1</parm>
</input>
So the target servlet could not take the full message. It took only
"https://localhost:8080/servlet?request=<input>" because of the line feed chars.
I was trying to manually remove the '\n' chars with '' using string replace function which didnt work.
I actually changed the parser from XML to XMLNSC which removed the line feed chars from the xml message without any issues and the message is going fully along with the url.
But i had to replace all the spaces with '%20' manually because the same problem happened with spaces in the message as well.
Please let me know if there are any ways to encode the url instead of replacing spaces manually.
Thanks,
Suresh. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jul 13, 2010 12:32 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
mgk |
Posted: Tue Jul 13, 2010 12:40 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hello.
As long as you are using 6.1.0.4 or later you do not need any extra code to urlencode or urldecode query strings for an HTTP Request node as the HTTP Request node can do this for you automatically. You simply place the name value pairs that make up the query string into the LocalEnvrionment and the node does the rest. See the docs under topic ac04595 for the HTTPReuest node.
Kind regards,
MGK _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|