Author |
Message
|
PaulHolmes |
Posted: Wed Apr 23, 2014 6:58 am Post subject: Problem sending from windows to Unix |
|
|
Newbie
Joined: 23 Apr 2014 Posts: 4
|
I have written a .net service to pull records from a db into an XML string and then post them to a MQ queue.
This has worked ok untill the broker in the middle was removed and I now send directly to a unix box.
My research has shown that the Unix machine is expecting
Encoding 273
CodedCharSetID 819
The code to send this doesnt set any parameters to set this enocding, and is as below. How do I set the encoding and CodedCharSetID variables?
Dim queueManager As MQQueueManager
Dim mqMsg As MQMessage
Dim queueOut As MQQueue
Dim mqPutMsgOpts As MQPutMessageOptions
Try
queueManager = New MQQueueManager(My.Settings.mqmanager)
queueOut = queueManager.AccessQueue(My.Settings.mqsendq, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING)
Catch ex As Exception
clData.AddErrorToMail("Failed to connect to Send to: " + My.Settings.mqmanager + " Error: " + ex.Message)
End Try
For Each dItem In clData.Requestlist
'send message into MQ
Try
mqMsg = New MQMessage()
mqMsg.WriteString(dItem.message)
mqMsg.Format = MQC.MQFMT_STRING
mqPutMsgOpts = New MQPutMessageOptions()
queueOut.Put(mqMsg, mqPutMsgOpts)
Catch ex As Exception
clData.AddErrorToMail("Failed to SEND message: " + ex.Message)
End
End Try
Next |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 23, 2014 7:13 am Post subject: Re: Problem sending from windows to Unix |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
PaulHolmes wrote: |
How do I set the encoding and CodedCharSetID variables? |
Are you sure this will help? If your .NET code is sending the message as (for example) UTF-16 then simply setting the CCSID to 819 will not magically turn your double byte Unicode into single byte ISO Latin.
The better option is to leave your code as it is (or set the CCSID in the MQMD to answer your orginal question) and have the receiving application specify conversion when they get the message from the queue. This will magically turn the message into the 819 they're expecting, irrespective of what your .NET is using. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 23, 2014 7:16 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
But remember, when you set the CCSID in your header you're describing your message's code page not converting it. If you actually want to write a message in 819 you'll need specific code which has nothing to do with WMQ to achieve that. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
PaulHolmes |
Posted: Wed Apr 23, 2014 7:38 am Post subject: |
|
|
Newbie
Joined: 23 Apr 2014 Posts: 4
|
Thanks for the advice, I have used syntax
mqMsg.CharacterSet = 819
mqMsg.Encoding = 273
but now have to wait to see if the message has been recieved as the destination people have gone home for the day. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 23, 2014 8:12 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
PaulHolmes wrote: |
Thanks for the advice, I have used syntax
mqMsg.CharacterSet = 819
mqMsg.Encoding = 273
but now have to wait to see if the message has been recieved as the destination people have gone home for the day. |
Which describes your message as being in ISO Latin. If it's not, and I bet it's not or they wouldn't be having trouble, this will not help.
Plus my limited .NET knowledge indicates another issue.
But we'll see. I've been known to be wrong & I'm under quota on mistakes today. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Wed Apr 23, 2014 8:34 am Post subject: Re: Problem sending from windows to Unix |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
PaulHolmes wrote: |
I have written a .net service to pull records from a db into an XML string and then post them to a MQ queue.
This has worked ok untill the broker in the middle was removed and I now send directly to a unix box. |
What did the broker do to the input before sending it to the queue? What kinds of transformations? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
PaulHolmes |
Posted: Wed Apr 23, 2014 9:40 am Post subject: |
|
|
Newbie
Joined: 23 Apr 2014 Posts: 4
|
The broker recieved the encoding and codedcharsetid of 546 and 1200 and transformed it into 273 and 819.
The new path removing the broker has led to the problem, and the reciever is not able to change the code at the recievor end as it is 1 of a few imports by the poller at the distant end. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 23, 2014 9:45 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
PaulHolmes wrote: |
The broker recieved the encoding and codedcharsetid of 546 and 1200 and transformed it into 273 and 819. |
What you've set in your code will not reproduce that transformation. It will change the description of the message but the payload (your string) will not magically (or automagically) recode into 819. As I mention above.
PaulHolmes wrote: |
the reciever is not able to change the code at the recievor end as it is 1 of a few imports by the poller at the distant end. |
They don't need to change the code; they need to change 1 option (which they should have set anyway) that will be invisible to their code and will fix their problem. Automagically.
Alternatively (and very much as a 2nd choice) your WMQ administrators could configure the channel that links you to perform the conversion for you. I'm assuming a queue manager to queue manager channel as there used to be a broker in the mix. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
PaulHolmes |
Posted: Thu Apr 24, 2014 2:46 am Post subject: |
|
|
Newbie
Joined: 23 Apr 2014 Posts: 4
|
Quote: |
they need to change 1 option |
As you suspected setting the header didn't work. The Q manager has got it working using "QM is set to convert(yes)"
Thanks for your help. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Apr 24, 2014 4:54 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
PaulHolmes wrote: |
The Q manager has got it working using "QM is set to convert(yes)" |
That's the 2nd option I mention above. Be aware this is somewhat non-optimal & can cause issues if you ever send anything which isn't a plain string.
But I'm glad you have your current problem solved. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|