ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to Remove \n chars from xml message..??!!!

Post new topic  Reply to topic
 How to Remove \n chars from xml message..??!!! « View previous topic :: View next topic » 
Author Message
next
PostPosted: Sun Jul 11, 2010 11:54 pm    Post subject: How to Remove \n chars from xml message..??!!! Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Mon Jul 12, 2010 3:59 am    Post subject: Re: How to Remove \n chars from xml message..??!!! Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Mon Jul 12, 2010 4:04 am    Post subject: Re: How to Remove \n chars from xml message..??!!! Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Mon Jul 12, 2010 4:13 am    Post subject: Re: How to Remove \n chars from xml message..??!!! Reply with quote

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
View user's profile Send private message
next
PostPosted: Mon Jul 12, 2010 10:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
kimbert
PostPosted: Tue Jul 13, 2010 12:32 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

There's a library class in Java that does what you need. I suggest that you use that.
http://cupi2.uniandes.edu.co/~cupi2/sitio/images/recursos/javadoc/j2se/1.5.0/docs/api/java/net/URLEncoder.html
Back to top
View user's profile Send private message
mgk
PostPosted: Tue Jul 13, 2010 12:40 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to Remove \n chars from xml message..??!!!
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.