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 IndexWebSphere Message Broker SupportText Request Message with Spaces and Tabs into SOAP Message

Post new topicReply to topic
Text Request Message with Spaces and Tabs into SOAP Message View previous topic :: View next topic
Author Message
shashivarungupta
PostPosted: Thu Aug 30, 2018 11:41 am Post subject: Text Request Message with Spaces and Tabs into SOAP Message Reply with quote

Grand Master

Joined: 24 Feb 2009
Posts: 1343
Location: Floating in space on a round rock.

Hi,

A "Text" Request Message with Spaces and Tabs including New Line and special Characters (like /, @, -, _ ) read as File Input. Objective is to send the same whole "Text" within SOAP message.
For example:
"Text" Message is :
Code:
ABC    CDE        EFG    ABC@DEF.COM        12/12/2010            HIJKLMNOP

SOAP Message expected is:
Code:
<S1:Envelope xmlns:S1="http://www.w3.org/2003/05/soap-envelope">
   <S1:Header/>
   <S1:Body>
      <S1:field1>ABC    CDE        EFG    ABC@DEF.COM        12/12/2010            HIJKLMNOP      </S1:field1>
   </S1:Body>
</S1:Envelope>


In the conversion to SOAP message, "Text" Message from File shouldn't loose Space, Tabs and Special Characters.
Following is written in ESQL but doesn't solve the purpose, it creates CDATA within XML tag. Can anyone please suggest if there is a better way do that ?
How does XMLNSC Parser behave when it finds Special Characters and Spaces and Tabs in the value of a Field?

Code:
declare s1 namespace 'http://www.w3.org/2003/05/soap-envelope'
DECLARE INVAL BLOB InputRoot.BLOB.BLOB;
CREATE LASTCHILD OF OutputRoot.XMLNSC.s1:Envelope.s1:Body.s1:field1 VALUE CAST(INVAL AS CHAR CCSID 1208);


Thank You.

IIBv10.0.0.10
MQ v7.5


_________________
*Life will beat you down, you need to decide to fight back or leave it.
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Thu Aug 30, 2018 12:10 pm Post subject: Re: Text Request Message with Spaces and Tabs into SOAP Mess Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25164
Location: Ohio, USA

shashivarungupta wrote:
How does XMLNSC Parser behave when it finds Special Characters and Spaces and Tabs in the value of a Field?


When it finds unescaped special characters or characters not allowed in an XML document at all, it throws a parser error and blows up. The same should be true of any compliant parser.

Tabs and other whitespace will be stripped from between tags by the XMLNSC domain (hence the C on the end) so in the example you posted there would be no newline characters (which you've used to get each tag on it's on line) in the message tree.

I would suspect you're getting a CDATA section because you've told it it's a BLOB that needs to be a CHAR, so it's hedging it's bets and wrapping it up.

Taking a step back, what exactly is driving this requirement? I'd have thought whoever's on the receiving end of this XML would be happier if all the components of the input were neatly parsed and placed in tags! Who wants to parse an XML document, then parse a string in the document that's not even delimited???
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
shashivarungupta
PostPosted: Thu Aug 30, 2018 12:42 pm Post subject: Re: Text Request Message with Spaces and Tabs into SOAP Mess Reply with quote

Grand Master

Joined: 24 Feb 2009
Posts: 1343
Location: Floating in space on a round rock.

Vitor wrote:

When it finds unescaped special characters or characters not allowed in an XML document at all, it throws a parser error and blows up. The same should be true of any compliant parser.
I agree.

Vitor wrote:
I would suspect you're getting a CDATA section because you've told it it's a BLOB that needs to be a CHAR, so it's hedging it's bets and wrapping it up.

Yes, I am receiving text as BLOB and later Casting as Character, but when the formulated soap message hits SOAPRequest node, it gets CDATA tag.

Vitor wrote:

Taking a step back, what exactly is driving this requirement? I'd have thought whoever's on the receiving end of this XML would be happier if all the components of the input were neatly parsed and placed in tags! Who wants to parse an XML document, then parse a string in the document that's not even delimited???

You're right, who wouldn't want the XML values in the fields after being neatly parsed by the XMLNSC parser by removing extra spaces or tabs. But, an application (don't know who wrote it and seems to be written in past era before evolution of SOAP and XMLNSC) expects the whole Text within XML tag and more over I think they must have written a dirty looking custom code to handle character values separated by tabs and spaces.

But the question remain, can the text be treated as text and parsing can be skipped (I tried Opaque Parsing). Not sure if the Opaque Parsing takes effect on Request Message when hits SOAPRequest IN terminal.


_________________
*Life will beat you down, you need to decide to fight back or leave it.
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Fri Aug 31, 2018 5:00 am Post subject: Re: Text Request Message with Spaces and Tabs into SOAP Mess Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25164
Location: Ohio, USA

shashivarungupta wrote:
But the question remain, can the text be treated as text and parsing can be skipped (I tried Opaque Parsing). Not sure if the Opaque Parsing takes effect on Request Message when hits SOAPRequest IN terminal.


If you've set Opaque Parsing then the parser has even less idea what the data looks like and is more likely to CDATA it.

shashivarungupta wrote:
I think they must have written a dirty looking custom code to handle character values separated by tabs and spaces.




With the number of frameworks available to handle this, you'd think someone would have spent 5 minutes updating it.

There might be a way to achieve this, and someone more ingenious than me may suggest it in a moment, but if I was in your place I'd build the XML by concatenating strings together:

Code:
 SET Message = '<S1:Envelope ....  etc ' ||  CAST(INVAL AS CHAR CCSID 1208) || '</S1:field .... ';


and send it through an HTTP node.

I'd also give the owner of the application a really hard time.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
timber
PostPosted: Sat Sep 01, 2018 3:50 pm Post subject: Reply with quote

Sentinel

Joined: 25 Aug 2015
Posts: 838

Ideally you should convert the text data to a stream of bytes (a BLOB) and encode the BLOB as xsd:base64Binary or xsd:hexBinary. However, you cannot do that because the receiving application is expecting an XML tag containing a formatted string of characters.

It sounds as if the SOAPRequest node is inserting the CDATA section, so you could try using XMLNSC to assemble the SOAP envelope and body, and then send the SOAP request using an HTTPRequest node. That's a hack, but if the receiving application cannot be changed then it may be the only viable solution.

Forget using the opaque parsing feature - that only affects the parsing of XML, not the writing of it.
Back to top
View user's profile Send private message
shashivarungupta
PostPosted: Wed Sep 05, 2018 11:15 am Post subject: Reply with quote

Grand Master

Joined: 24 Feb 2009
Posts: 1343
Location: Floating in space on a round rock.

Thank you for your responses.

As mentioned in the OP, following code works. It was the issue with the provider service which was converting the SOAP message into the CDATA format. In the following code, BLOB
Domain is at the entry point of the flow. Later it is CAST-ed into CHARACTER with CCSID 1208. It works.

Code:
SET OutputRoot.Properties = InputRoot.Properties;
DECLARE s1 NAMESPACE 'http://www.w3.org/2003/05/soap-envelope';
SET OutputRoot.XMLNSC.s1:Envelope.s1:Body.s1:field1 = CAST(InputRoot.BLOB.BLOB AS CHARACTER CCSID 1208);



_________________
*Life will beat you down, you need to decide to fight back or leave it.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportText Request Message with Spaces and Tabs into SOAP 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.