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 » Embedding XML into Pipe delimited file

Post new topic  Reply to topic
 Embedding XML into Pipe delimited file « View previous topic :: View next topic » 
Author Message
ethirajesh
PostPosted: Mon Jul 18, 2011 1:33 am    Post subject: Embedding XML into Pipe delimited file Reply with quote

Apprentice

Joined: 04 Oct 2010
Posts: 46

Hi I need to Generate a Pipe delimited in MB file as below :

Method|InputMessage|MsgFlowIdentfier|TimeStamp|Type etc.,

I am able to construct the above message as a String. In place of 'InputMessage' I need to place a XML file returned by a webservice. To do this I reset the response to BLOB using ResetContentdescriptor node. And In the COmpute node My code is as below :

SET Msg = ASBITSTREAM(InputRoot.BLOB.BLOB);
SET Environment.Variables.InputMessage = CAST(Msg AS CHARACTER CCSID 1208);

And concatenated this which produced as below :

Method|<?xml version="1.0" encoding="utf-8" ?>
<Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">


<ParentTag>
<ChildTag>
<Data>
</ChildTag>
</ParentTag>
<Response> MsgFlowIdentfier|TimeStamp|Type


But I need the output as mentioned below, what should be done to acheive this :

Method|<?xml version="1.0" encoding="utf-8" ?><Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"><ParentTag><ChildTag><Data></ChildTag></ParentTag><Response>MsgFlowIdentfier|TimeStamp|Type
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 18, 2011 4:46 am    Post subject: Re: Embedding XML into Pipe delimited file Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

ethirajesh wrote:
But I need the output as mentioned below, what should be done to acheive this


You've already got the desired output. The particular input xml you're using clearly has line break(s) between the tags. Tools like XMLSpy do this to aid readability for humans and whatever you're using to view the output message is honouring that. But the XML is the same; to an XML parser there's no difference between:

Code:

<Parent>
    <Child>42</Child>
</Parent>


and
Code:

<Parent><Child>42</Child></Parent>


So whatever's consuming your message downstream will be fine, or they need a better XML parser.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Mon Jul 18, 2011 4:46 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

You need to remove the white space from the XML that was received back from the web service.

How did the flow get this XML? And what XML parser was used in the flow?
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Mon Jul 18, 2011 4:49 am    Post subject: Re: Embedding XML into Pipe delimited file Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

Vitor wrote:
So whatever's consuming your message downstream will be fine, or they need a better XML parser.


I think the downstream application is expecting a pipe delimited message and the line breaks in the XML are causing the problem in the file that is being created by the broker.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 18, 2011 4:53 am    Post subject: Re: Embedding XML into Pipe delimited file Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

joebuckeye wrote:
I think the downstream application is expecting a pipe delimited message and the line breaks in the XML are causing the problem in the file that is being created by the broker.


I stand by my comment of "they need a better parser".

Though I do suspect you're right; they're using line feeds as an end-of-record marker so they're getting the message chopped up.

Which I further suspect is going to end up being fixed by the OP because it's "too hard" for the downstream app.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
j.f.sorge
PostPosted: Mon Jul 18, 2011 5:22 am    Post subject: Reply with quote

Master

Joined: 27 Feb 2008
Posts: 218

You may use REPLACE function to remove the line breaks. Use it with BLOB datatype and correct BLOB-expression of the line breaks within you WS response.
_________________
IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 18, 2011 5:27 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

j.f.sorge wrote:
You may use REPLACE function to remove the line breaks. Use it with BLOB datatype and correct BLOB-expression of the line breaks within you WS response.


This may have unfortunate side effects if any of the tags legitimately contain line breaks; a formated address for instance.

Of course, if the data doesn't then you're fine.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
paintpot
PostPosted: Mon Jul 18, 2011 7:52 am    Post subject: Reply with quote

Centurion

Joined: 19 Sep 2005
Posts: 112
Location: UK

Try using the XMLNSC domain for your web service response data
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 18, 2011 8:02 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

paintpot wrote:
Try using the XMLNSC domain for your web service response data


Doh - you threw a fish!
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Mon Jul 18, 2011 10:46 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

Vitor wrote:
This may have unfortunate side effects if any of the tags legitimately contain line breaks ...

Not to mention what happens if the XML legitimately contains pipe characters, when embedding it in a pipe-delimited message ...
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Jul 18, 2011 11:37 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

rekarm01 wrote:
Vitor wrote:
This may have unfortunate side effects if any of the tags legitimately contain line breaks ...

Not to mention what happens if the XML legitimately contains pipe characters, when embedding it in a pipe-delimited message ...


Less likely than line breaks, but yes indeed quite.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
ethirajesh
PostPosted: Mon Jul 18, 2011 10:11 pm    Post subject: Reply with quote

Apprentice

Joined: 04 Oct 2010
Posts: 46

Basically our buisness will use this text file to update in the database in future.

So the end application will consider this as a String only. In this case the line feeds in my output will create problem??
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jul 19, 2011 4:22 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

ethirajesh wrote:
So the end application will consider this as a String only. In this case the line feeds in my output will create problem??


Well, yes. The application thinks it's a string. Depending on how they define "string" their application could easily believe the first line feed is the end of the string and ignore the rest of the data. If however they're breaking the message up by pipe characters and feeding the XML payload to an XML parser then no it's not a problem. Unless the XML has pipe characters in it.

But this question is best directed at the team handling the end application. It's their opionion on line feeds that is the only important one here.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Embedding XML into Pipe delimited file
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.