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 IndexIBM MQ API SupportCRLF 's Stripped out from Message and Data Formatted wrong

Post new topicReply to topic Goto page 1, 2  Next
CRLF 's Stripped out from Message and Data Formatted wrong View previous topic :: View next topic
Author Message
anil kumar
PostPosted: Thu Jan 31, 2019 1:18 am Post subject: CRLF 's Stripped out from Message and Data Formatted wrong Reply with quote

Acolyte

Joined: 22 Jan 2017
Posts: 64
Location: somewhere under the sky

Hi All,

we are using IBM MQ 9 and Rest API Concept to put and get messages from IBM MQ using MQ Rest for messaging as mentioned in the info centre

https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.ref.dev.doc/q130750_.htm#q130750___requestformat

I am able to post(HTTP post ) and read messages(using HTTP delete) to and from the queue. I don't have any trouble when working with the XML, JSON messages. but when I tried with the flat file messages the messages are wrongly formatting in the queue. The queue is not considering carriage returns and line feeds posted in the HTTP post method's body.
yes I have correctly sent the media type to accepted format but messages are missing CR LF
below are examples

I'm using SOAP UI to test my MQ Rest API below are the cases I've encountered

Case 1:
Code:
input :

Hellow

World

Media type :

text/plain;charset=utf-8

output in queue :

00000000 HellowWorld

 

Case 2:

Code:
input :

Hellow

World

Media type :

text/html;charset=utf-8

output in queue :

00000000 HellowWorld

 


Case 3:
Code:
input :                         

Hellow

World

Media type :

text/xml;charset=utf-8

output in queue :

00000000 HellowWorld




Please suggest how to get the message posted to queue as is without any reformatting.


_________________
Anil Varma
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Jan 31, 2019 4:19 am Post subject: Reply with quote

Grand High Poobah

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

I don't see any immediate difference in the posted output.

Even though you've set them to UTF-8, are they? What are the OS involved?

The behavior you're describing is a classic for Windows <-> UNIX.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
anil kumar
PostPosted: Thu Jan 31, 2019 5:26 am Post subject: Reply with quote

Acolyte

Joined: 22 Jan 2017
Posts: 64
Location: somewhere under the sky

Hi Vitor ,

yes, the Operating system is windows.

What am expecting here is CRLF in Queue.
This is a dummy test data but
Expected output is
Code:

Hellow(expecting CRLF)

World (expecting CRLF)


not
Code:
 HellowWorld .missing CRLF


All this is i want to post a flat file in fixed length format which is not formatting exactly as posted
below is example:

when I tried to post FixedLength Data which has a lot of CRLF the message was posted to Queue as a Single string in the linearized way all CR LF is missing.

Sample Input which has CRLF sent

Code:


HEADER here header data some data
A1000000121312321313123123213213123123123123123123 TEST DATA 12312321321321
A101000000147752729000000603954082000000000000001TESTDATADUMMYDATA       000000000000000
A101000000147752729000000603954082000000000000002TESTDATADUMMYDATA       000000000000000
A201000000147752729000000603954082000000000000003TESTDATADUMMYDATA       000000000000000
A201000000147752729000000603954082000000000000004TESTDATADUMMYDATA       000000000000000
A201000000147752729000000603954082000000000000005TESTDATADUMMYDATA       000000000000000


Code:

HTTP logs in SOAP UI

Thu Jan 31 18:43:19 IST 2019:DEBUG:>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]"
Thu Jan 31 18:43:19 IST 2019:DEBUG:>> "[\r][\n]"
Thu Jan 31 18:43:19 IST 2019:DEBUG:>> "HEADER here header data some data[\n]"
Thu Jan 31 18:43:19 IST 2019:DEBUG:>> "A1000000121312321313123123213213123123123123123123 TEST DATA 12312321321321[\n]"
Thu Jan 31 18:43:19 IST 2019:DEBUG:>> "A101000000147752729000000603954082000000000000001TESTDATADUMMYDATA       000000000000000[\n]"
Thu Jan 31 18:43:19 IST 2019:DEBUG:>> "A101000000147752729000000603954082000000000000002TESTDATADUMMYDATA       000000000000000[\n]"
Thu Jan 31 18:43:19 IST 2019:DEBUG:>> "A201000000147752729000000603954082000000000000003TESTDATADUMMYDATA       000000000000000[\n]"
Thu Jan 31 18:43:19 IST 2019:DEBUG:>> "A201000000147752729000000603954082000000000000004TESTDATADUMMYDATA       000000000000000[\n]"
Thu Jan 31 18:43:19 IST 2019:DEBUG:>> "A201000000147752729000000603954082000000000000005TESTDATADUMMYDATA       000000000000000[\n]"
Thu Jan 31 18:43:19 IST 2019:DEBUG:<< "HTTP/1.1 201 Created[\r][\n]"



Output In Queue :
Code:

00000000 HEADER here header data some dataA1000000121312321313123123213213123123123123123123 TEST DATA 12312321321321A101000000147752729000000603954082000000000000001TESTDATADUMMYDATA       000000000000000A101000000147752729000000603954082000000000000002TESTDATADUMMYDATA       000000000000000A201000000147752729000000603954082000000000000003TESTDATADUMMYDATA       000000000000000A201000000147752729000000603954082000000000000004TESTDATADUMMYDATA       000000000000000A201000000147752729000000603954082000000000000005TESTDATADUMMYDATA       000000000000000




Expecting output as

Code:

HEADER here header data some data
A1000000121312321313123123213213123123123123123123 TEST DATA 12312321321321
A101000000147752729000000603954082000000000000001TESTDATADUMMYDATA       000000000000000
A101000000147752729000000603954082000000000000002TESTDATADUMMYDATA       000000000000000
A201000000147752729000000603954082000000000000003TESTDATADUMMYDATA       000000000000000
A201000000147752729000000603954082000000000000004TESTDATADUMMYDATA       000000000000000
A201000000147752729000000603954082000000000000005TESTDATADUMMYDATA       000000000000000


what i'm expecting is data to be well formatter and outputted to Queue as is Am I missing something?
_________________
Anil Varma
Back to top
View user's profile Send private message
bruce2359
PostPosted: Thu Jan 31, 2019 5:56 am Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 8387
Location: US: west coast, almost. Otherwise, enroute.

anil kumar wrote:
Hi Vitor ,

yes, the Operating system is windows.

What am expecting here is CRLF in Queue.
This is a dummy test data but
Expected output is
Code:

Hellow(expecting CRLF)

World (expecting CRLF)


not
Code:
 HellowWorld .missing CRLF


All this is i want to post a flat file in fixed length format which is not formatting exactly as posted
below is example:

when I tried to post FixedLength Data which has a lot of CRLF the message was posted to Queue as a Single string in the linearized way all CR LF is missing.

Sample Input which has CRLF sent

Code:


HEADER here header data some data
A1000000121312321313123123213213123123123123123123 TEST DATA 12312321321321
A101000000147752729000000603954082000000000000001TESTDATADUMMYDATA       000000000000000
A101000000147752729000000603954082000000000000002TESTDATADUMMYDATA       000000000000000
A201000000147752729000000603954082000000000000003TESTDATADUMMYDATA       000000000000000
A201000000147752729000000603954082000000000000004TESTDATADUMMYDATA       000000000000000
A201000000147752729000000603954082000000000000005TESTDATADUMMYDATA       000000000000000



What app are you using to display this? Does not look like output from the IBM-supplied utility app amqsbcg.

Display the messages in queue using amqsbcg. Post the results here.
_________________
There are two types of people in this world:
1) Those that can extrapolate from incomplete data
Back to top
View user's profile Send private message
anil kumar
PostPosted: Thu Jan 31, 2019 8:59 am Post subject: Reply with quote

Acolyte

Joined: 22 Jan 2017
Posts: 64
Location: somewhere under the sky

Hi Bruce ,

Im using RFHUTIL tool to view data . Also i have used HTTP Delete method to get the message from queue using SOAP UI . Both gave same respone .

I have run fresh test using same input and peformed GET using amqsbcg command the output is as below :

Code:


 MQGET of message number 1, CompCode:0 Reason:0
****Message descriptor****

  StrucId  : 'MD  '  Version : 2
  Report   : 0  MsgType : 8
  Expiry   : -1  Feedback : 0
  Encoding : 273  CodedCharSetId : 1208
  Format : 'MQSTR   '
  Priority : 4  Persistence : 0
  MsgId : X'414D5120534443514D47522E533120209488515C21E85502'
  CorrelId : X'000000000000000000000000000000000000000000000000'
  BackoutCount : 0
  ReplyToQ       : '                                                '
  ReplyToQMgr    : 'MYQMGR                                     '
  ** Identity Context
  UserIdentifier : '     '
  AccountingToken :
   X'0000000000000000000000000000000000000000000000000000000000000000'
  ApplIdentityData : '                         '
  ** Origin Context
  PutApplType    : '7'
  PutApplName    : 'IBM MQ Web Admin/REST API   '
  PutDate  : '20190131'    PutTime  : '16544489'
  ApplOriginData : '    '

  GroupId : X'000000000000000000000000000000000000000000000000'
  MsgSeqNumber   : '1'
  Offset         : '0'
  MsgFlags       : '0'
  OriginalLength : '-1'

****   Message      ****

 length - 548 of 548 bytes

00000000:  4845 4144 4552 2068 6572 6520 6865 6164 'HEADER here head'
00000010:  6572 2064 6174 6120 736F 6D65 2064 6174 'er data some dat'
00000020:  6141 3130 3030 3030 3031 3231 3331 3233 'aA10000001213123'
00000030:  3231 3331 3331 3233 3132 3332 3133 3231 '2131312312321321'
00000040:  3331 3233 3132 3331 3233 3132 3331 3233 '3123123123123123'
00000050:  3132 3320 5445 5354 2044 4154 4120 3132 '123 TEST DATA 12'
00000060:  3331 3233 3231 3332 3133 3231 4131 3031 '312321321321A101'
00000070:  3030 3030 3030 3134 3737 3532 3732 3930 '0000001477527290'
00000080:  3030 3030 3036 3033 3935 3430 3832 3030 '0000060395408200'
00000090:  3030 3030 3030 3030 3030 3030 3154 4553 '0000000000001TES'
000000A0:  5444 4154 4144 554D 4D59 4441 5441 2020 'TDATADUMMYDATA  '
000000B0:  2020 2020 2030 3030 3030 3030 3030 3030 '     00000000000'
000000C0:  3030 3030 4131 3031 3030 3030 3030 3134 '0000A10100000014'
000000D0:  3737 3532 3732 3930 3030 3030 3036 3033 '7752729000000603'
000000E0:  3935 3430 3832 3030 3030 3030 3030 3030 '9540820000000000'
000000F0:  3030 3030 3254 4553 5444 4154 4144 554D '00002TESTDATADUM'
00000100:  4D59 4441 5441 2020 2020 2020 2030 3030 'MYDATA       000'
00000110:  3030 3030 3030 3030 3030 3030 4132 3031 '000000000000A201'
00000120:  3030 3030 3030 3134 3737 3532 3732 3930 '0000001477527290'
00000130:  3030 3030 3036 3033 3935 3430 3832 3030 '0000060395408200'
00000140:  3030 3030 3030 3030 3030 3030 3354 4553 '0000000000003TES'
00000150:  5444 4154 4144 554D 4D59 4441 5441 2020 'TDATADUMMYDATA  '
00000160:  2020 2020 2030 3030 3030 3030 3030 3030 '     00000000000'
00000170:  3030 3030 4132 3031 3030 3030 3030 3134 '0000A20100000014'
00000180:  3737 3532 3732 3930 3030 3030 3036 3033 '7752729000000603'
00000190:  3935 3430 3832 3030 3030 3030 3030 3030 '9540820000000000'
000001A0:  3030 3030 3454 4553 5444 4154 4144 554D '00004TESTDATADUM'
000001B0:  4D59 4441 5441 2020 2020 2020 2030 3030 'MYDATA       000'
000001C0:  3030 3030 3030 3030 3030 3030 4132 3031 '000000000000A201'
000001D0:  3030 3030 3030 3134 3737 3532 3732 3930 '0000001477527290'
000001E0:  3030 3030 3036 3033 3935 3430 3832 3030 '0000060395408200'

000001F0:  3030 3030 3030 3030 3030 3030 3554 4553 '0000000000005TES'
00000200:  5444 4154 4144 554D 4D59 4441 5441 2020 'TDATADUMMYDATA  '
00000210:  2020 2020 2030 3030 3030 3030 3030 3030 '     00000000000'
00000220:  3030 3030                               '0000            '




i have checked the hexa decimal code also still can't find 0D0A
_________________
Anil Varma
Back to top
View user's profile Send private message
bruce2359
PostPosted: Thu Jan 31, 2019 9:30 am Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 8387
Location: US: west coast, almost. Otherwise, enroute.

MQ doesn't know or care about CRLFs. Why do you expect that there should be CRLFs in the message? Does your app insert CRLFs? Display the source input file data here.
_________________
There are two types of people in this world:
1) Those that can extrapolate from incomplete data
Back to top
View user's profile Send private message
anil kumar
PostPosted: Thu Jan 31, 2019 10:37 pm Post subject: Reply with quote

Acolyte

Joined: 22 Jan 2017
Posts: 64
Location: somewhere under the sky

Hi Bruce,

I have run another test collected HTTP log in SOAP UI, there I can see CRLF are sent from Soap UI. So source app is sending the data correctly once posted queue is showing data in a single linearized string.

Below are test result :

Http Post request log :
Code:

Fri Feb 01 08:37:31 IST 2019:DEBUG:>> "POST /ibmmq/rest/v1/messaging/qmgr/MYQMGR/queue/REST.TEST/message HTTP/1.1[\r][\n]"
Fri Feb 01 08:37:31 IST 2019:DEBUG:>> "Content-Type: text/plain;charset=utf-8[\r][\n]"
Fri Feb 01 08:37:31 IST 2019:DEBUG:>> "Content-Length: 562[\r][\n]"
Fri Feb 01 08:37:31 IST 2019:DEBUG:>> "Connection: Keep-Alive[\r][\n]"
Fri Feb 01 08:37:31 IST 2019:DEBUG:>> "[\r][\n]"
Fri Feb 01 08:37:31 IST 2019:DEBUG:>> "HEADER here header data some data[\r][\n]"
Fri Feb 01 08:37:31 IST 2019:DEBUG:>> "A1000000121312321313123123213213123123123123123123 TEST DATA 12312321321321[\r][\n]"
Fri Feb 01 08:37:31 IST 2019:DEBUG:>> "A101000000147752729000000603954082000000000000001TESTDATADUMMYDATA       000000000000000[\r][\n]"
Fri Feb 01 08:37:31 IST 2019:DEBUG:>> "A101000000147752729000000603954082000000000000002TESTDATADUMMYDATA       000000000000000[\r][\n]"
Fri Feb 01 08:37:31 IST 2019:DEBUG:>> "A201000000147752729000000603954082000000000000003TESTDATADUMMYDATA       000000000000000[\r][\n]"
Fri Feb 01 08:37:31 IST 2019:DEBUG:>> "A201000000147752729000000603954082000000000000004TESTDATADUMMYDATA       000000000000000[\r][\n]"
Fri Feb 01 08:37:31 IST 2019:DEBUG:>> "A201000000147752729000000603954082000000000000005TESTDATADUMMYDATA       000000000000000[\r][\n]"


HTTP response which says data has been posted to Queue :

Code:
  Fri Feb 01 08:37:32 IST 2019:DEBUG:<< "HTTP/1.1 201 Created[\r][\n]"
Fri Feb 01 08:37:32 IST 2019:DEBUG:<< "X-Powered-By: Servlet/3.1[\r][\n]"
Fri Feb 01 08:37:32 IST 2019:DEBUG:<< "X-XSS-Protection: 1;mode=block[\r][\n]"
Fri Feb 01 08:37:32 IST 2019:DEBUG:<< "X-Content-Type-Options: nosniff[\r][\n]"
Fri Feb 01 08:37:32 IST 2019:DEBUG:<< "Content-Length: 0[\r][\n]"
Fri Feb 01 08:37:32 IST 2019:DEBUG:<< "Content-Type: text/plain; charset=utf-8[\r][\n]"
Fri Feb 01 08:37:32 IST 2019:DEBUG:<< "ibm-mq-md-messageId: 414d5120534443514d47522e533120209488515c220e7102[\r][\n]" got message id in return from queue
Fri Feb 01 08:37:32 IST 2019:DEBUG:<< "Date: Fri, 01 Feb 2019 03:07:31 GMT[\r][\n]"
Fri Feb 01 08:37:32 IST 2019:DEBUG:<< "[\r][\n]"



below is a message posted to the queue

Code:

AMQSBCG0 - starts here
**********************

 MQOPEN - 'REST.TEST'


 MQGET of message number 1, CompCode:0 Reason:0
****Message descriptor****

  StrucId  : 'MD  '  Version : 2
  Report   : 0  MsgType : 8
  Expiry   : -1  Feedback : 0
  Encoding : 273  CodedCharSetId : 1208
  Format : 'MQSTR   '
  Priority : 4  Persistence : 0
  MsgId : X'414D5120534443514D47522E533120209488515C220E7102'
  CorrelId : X'000000000000000000000000000000000000000000000000'
  BackoutCount : 0
  ReplyToQ       : '                                                '
  ReplyToQMgr    : 'MYQMGR                                      '
  ** Identity Context
  UserIdentifier : '     '
  AccountingToken :
   X'0000000000000000000000000000000000000000000000000000000000000000'
  ApplIdentityData : '                         '
  ** Origin Context
  PutApplType    : '7'
  PutApplName    : 'IBM MQ Web Admin/REST API   '
  PutDate  : '20190201'    PutTime  : '03073171'
  ApplOriginData : '    '

  GroupId : X'000000000000000000000000000000000000000000000000'
  MsgSeqNumber   : '1'
  Offset         : '0'
  MsgFlags       : '0'
  OriginalLength : '-1'

****   Message      ****

 length - 548 of 548 bytes

00000000:  4845 4144 4552 2068 6572 6520 6865 6164 'HEADER here head'
00000010:  6572 2064 6174 6120 736F 6D65 2064 6174 'er data some dat'
00000020:  6141 3130 3030 3030 3031 3231 3331 3233 'aA10000001213123'
00000030:  3231 3331 3331 3233 3132 3332 3133 3231 '2131312312321321'
00000040:  3331 3233 3132 3331 3233 3132 3331 3233 '3123123123123123'
00000050:  3132 3320 5445 5354 2044 4154 4120 3132 '123 TEST DATA 12'
00000060:  3331 3233 3231 3332 3133 3231 4131 3031 '312321321321A101'
00000070:  3030 3030 3030 3134 3737 3532 3732 3930 '0000001477527290'
00000080:  3030 3030 3036 3033 3935 3430 3832 3030 '0000060395408200'
00000090:  3030 3030 3030 3030 3030 3030 3154 4553 '0000000000001TES'
000000A0:  5444 4154 4144 554D 4D59 4441 5441 2020 'TDATADUMMYDATA  '
000000B0:  2020 2020 2030 3030 3030 3030 3030 3030 '     00000000000'
000000C0:  3030 3030 4131 3031 3030 3030 3030 3134 '0000A10100000014'
000000D0:  3737 3532 3732 3930 3030 3030 3036 3033 '7752729000000603'
000000E0:  3935 3430 3832 3030 3030 3030 3030 3030 '9540820000000000'
000000F0:  3030 3030 3254 4553 5444 4154 4144 554D '00002TESTDATADUM'
00000100:  4D59 4441 5441 2020 2020 2020 2030 3030 'MYDATA       000'
00000110:  3030 3030 3030 3030 3030 3030 4132 3031 '000000000000A201'
00000120:  3030 3030 3030 3134 3737 3532 3732 3930 '0000001477527290'
00000130:  3030 3030 3036 3033 3935 3430 3832 3030 '0000060395408200'
00000140:  3030 3030 3030 3030 3030 3030 3354 4553 '0000000000003TES'
00000150:  5444 4154 4144 554D 4D59 4441 5441 2020 'TDATADUMMYDATA  '
00000160:  2020 2020 2030 3030 3030 3030 3030 3030 '     00000000000'
00000170:  3030 3030 4132 3031 3030 3030 3030 3134 '0000A20100000014'
00000180:  3737 3532 3732 3930 3030 3030 3036 3033 '7752729000000603'
00000190:  3935 3430 3832 3030 3030 3030 3030 3030 '9540820000000000'
000001A0:  3030 3030 3454 4553 5444 4154 4144 554D '00004TESTDATADUM'
000001B0:  4D59 4441 5441 2020 2020 2020 2030 3030 'MYDATA       000'
000001C0:  3030 3030 3030 3030 3030 3030 4132 3031 '000000000000A201'
000001D0:  3030 3030 3030 3134 3737 3532 3732 3930 '0000001477527290'
000001E0:  3030 3030 3036 3033 3935 3430 3832 3030 '0000060395408200'

000001F0:  3030 3030 3030 3030 3030 3030 3554 4553 '0000000000005TES'
00000200:  5444 4154 4144 554D 4D59 4441 5441 2020 'TDATADUMMYDATA  '
00000210:  2020 2020 2030 3030 3030 3030 3030 3030 '     00000000000'
00000220:  3030 3030                               '0000            '




_________________
Anil Varma
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Feb 02, 2019 2:42 am Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19981
Location: LI,NY

So what you're saying is that the REST API strips CR/LF from the data?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
bruce2359
PostPosted: Sat Feb 02, 2019 10:27 am Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 8387
Location: US: west coast, almost. Otherwise, enroute.

Where did the data originate? On z/OS perhaps?

What app did you use to create the source data?
_________________
There are two types of people in this world:
1) Those that can extrapolate from incomplete data
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Sun Feb 03, 2019 3:10 pm Post subject: Re: CRLF 's Stripped out from Message and Data Formatted wro Reply with quote

Padawan

Joined: 25 Mar 2003
Posts: 1965
Location: Melbourne, Australia

anil kumar wrote:
Hi All,
we are using IBM MQ 9 and Rest API Concept to put and get messages from IBM MQ using MQ Rest for messaging as mentioned in the info centre
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.ref.dev.doc/q130750_.htm#q130750___requestformat
I am able to post(HTTP post ) and read messages(using HTTP delete) to and from the queue. I don't have any trouble when working with the XML, JSON messages. but when I tried with the flat file messages the messages are wrongly formatting in the queue. The queue is not considering carriage returns and line feeds posted in the HTTP post method's body.
yes I have correctly sent the media type to accepted format but messages are missing CR LF
below are examples
I'm using SOAP UI to test my MQ Rest API below are the cases I've encountered
Please suggest how to get the message posted to queue as is without any reformatting.

It looks like the MQ HTTP POST processing is stripping the CR LF. I could not see anything about multi-line data on the the IBM KC page linked above.
Have you tried the curl command examples? Note that to post a multi-line text file without stripping CR LF you need to use "--data-binary @FileName.txt" (as described at https://ec.haxx.se/http-post.html )
_________________
Glenn
Back to top
View user's profile Send private message
anil kumar
PostPosted: Tue Feb 05, 2019 10:11 pm Post subject: Re: CRLF 's Stripped out from Message and Data Formatted wro Reply with quote

Acolyte

Joined: 22 Jan 2017
Posts: 64
Location: somewhere under the sky

gbaddeley wrote:
anil kumar wrote:
Hi All,
we are using IBM MQ 9 and Rest API Concept to put and get messages from IBM MQ using MQ Rest for messaging as mentioned in the info centre
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.ref.dev.doc/q130750_.htm#q130750___requestformat
I am able to post(HTTP post ) and read messages(using HTTP delete) to and from the queue. I don't have any trouble when working with the XML, JSON messages. but when I tried with the flat file messages the messages are wrongly formatting in the queue. The queue is not considering carriage returns and line feeds posted in the HTTP post method's body.
yes I have correctly sent the media type to accepted format but messages are missing CR LF
below are examples
I'm using SOAP UI to test my MQ Rest API below are the cases I've encountered
Please suggest how to get the message posted to queue as is without any reformatting.

It looks like the MQ HTTP POST processing is stripping the CR LF. I could not see anything about multi-line data on the the IBM KC page linked above.
Have you tried the curl command examples? Note that to post a multi-line text file without stripping CR LF you need to use "--data-binary @FileName.txt" (as described at https://ec.haxx.se/http-post.html )


hi Baddeley,

Hi have used curl and read the data from a file and still missing out the Carriage returns and line feeds.




Code:
Curl Command :


curl -v -k "http://myhost:myport/ibmmq/rest/v1/messaging/qmgr/MYQMGR/queue/REST.TEST/message" -X POST  -H "ibm-mq-rest-csrf-token: token-value" -H "Content-Type:text/plain;charset=utf-8" -H "ibm-mq-md-persistence: nonPersistent"  --data-binary @C:\Users\username\Desktop\dump\testmessage.txt

Code:

Input File (testmessage.txt) data :
HEADER here header data some data
A1000000121312321313123123213213123123123123123123 TEST DATA 12312321321321
A101000000147752729000000603954082000000000000001TESTDATADUMMYDATA       000000000000000
A101000000147752729000000603954082000000000000002TESTDATADUMMYDATA       000000000000000
A201000000147752729000000603954082000000000000003TESTDATADUMMYDATA       000000000000000
A201000000147752729000000603954082000000000000004TESTDATADUMMYDATA       000000000000000
A201000000147752729000000603954082000000000000005TESTDATADUMMYDATA       000000000000000

Code:

output in Queue :
00000000   HEADER h   ere head   48454144 45522068 65726520 68656164
00000016   er data    some dat   65722064 61746120 736F6D65 20646174
00000032   aA100000   01213123   61413130 30303030 30313231 33313233
00000048   21313123   12321321   32313331 33313233 31323332 31333231
00000064   31231231   23123123   33313233 31323331 32333132 33313233
00000080   123 TEST    DATA 12   31323320 54455354 20444154 41203132
00000096   31232132   1321A101   33313233 32313332 31333231 41313031
00000112   00000014   77527290   30303030 30303134 37373532 37323930
00000128   00000603   95408200   30303030 30363033 39353430 38323030
00000144   00000000   00001TES   30303030 30303030 30303030 31544553
00000160   TDATADUM   MYDATA     54444154 4144554D 4D594441 54412020
00000176        000   00000000   20202020 20303030 30303030 30303030
00000192   0000A101   00000014   30303030 41313031 30303030 30303134
00000208   77527290   00000603   37373532 37323930 30303030 30363033
00000224   95408200   00000000   39353430 38323030 30303030 30303030
00000240   00002TES   TDATADUM   30303030 32544553 54444154 4144554D
00000256   MYDATA          000   4D594441 54412020 20202020 20303030
00000272   00000000   0000A201   30303030 30303030 30303030 41323031
00000288   00000014   77527290   30303030 30303134 37373532 37323930
00000304   00000603   95408200   30303030 30363033 39353430 38323030
00000320   00000000   00003TES   30303030 30303030 30303030 33544553
00000336   TDATADUM   MYDATA     54444154 4144554D 4D594441 54412020
00000352        000   00000000   20202020 20303030 30303030 30303030
00000368   0000A201   00000014   30303030 41323031 30303030 30303134
00000384   77527290   00000603   37373532 37323930 30303030 30363033
00000400   95408200   00000000   39353430 38323030 30303030 30303030
00000416   00004TES   TDATADUM   30303030 34544553 54444154 4144554D
00000432   MYDATA          000   4D594441 54412020 20202020 20303030
00000448   00000000   0000A201   30303030 30303030 30303030 41323031
00000464   00000014   77527290   30303030 30303134 37373532 37323930
00000480   00000603   95408200   30303030 30363033 39353430 38323030
00000496   00000000   00005TES   30303030 30303030 30303030 35544553
00000512   TDATADUM   MYDATA     54444154 4144554D 4D594441 54412020
00000528        000   00000000   20202020 20303030 30303030 30303030
00000544   0000              30303030

_________________
Anil Varma
Back to top
View user's profile Send private message
anil kumar
PostPosted: Tue Feb 05, 2019 10:22 pm Post subject: Reply with quote

Acolyte

Joined: 22 Jan 2017
Posts: 64
Location: somewhere under the sky

bruce2359 wrote:
Where did the data originate? On z/OS perhaps?

What app did you use to create the source data?


Hi Bruce,
I'm using notepad++ to create data. and os is windows.

fjb_saper wrote:
So what you're saying is that the REST API strips CR/LF from the data?


yes, I think the rest API is working behind. but not sure that's why asking if anyone of forum users is using this feature or did POC kind of things so that someone may advise.
I would like to get a suggestion on if this feature supports does not support multiline data . or it will only support the XML/JSON only?
any comment on that ?
_________________
Anil Varma
Back to top
View user's profile Send private message
hughson
PostPosted: Tue Feb 05, 2019 11:42 pm Post subject: Reply with quote

Grand Master

Joined: 09 May 2013
Posts: 1105
Location: Bay of Plenty, New Zealand

anil kumar wrote:
fjb_saper wrote:
So what you're saying is that the REST API strips CR/LF from the data?


yes, I think the rest API is working behind. but not sure that's why asking if anyone of forum users is using this feature or did POC kind of things so that someone may advise.
I would like to get a suggestion on if this feature supports does not support multiline data . or it will only support the XML/JSON only?
any comment on that ?

I've been playing with the REST messaging API for a bit too and tried all sorts of combinations to get newlines, but with no luck.

I've asked IBM Hursley to take a look at this thread in the hope of getting you a definitive answer.

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
anil kumar
PostPosted: Wed Feb 06, 2019 9:20 pm Post subject: Reply with quote

Acolyte

Joined: 22 Jan 2017
Posts: 64
Location: somewhere under the sky

Thanks, Morag

please let me also know when you get an update on this.

Thanks,
Anil.
_________________
Anil Varma
Back to top
View user's profile Send private message
mvic
PostPosted: Fri Feb 15, 2019 12:53 pm Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2078

Is there a reason no-one has suggested opening a PMR for this?
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum IndexIBM MQ API SupportCRLF 's Stripped out from Message and Data Formatted wrong
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.