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 » From vb.net to MQ

Post new topic  Reply to topic
 From vb.net to MQ « View previous topic :: View next topic » 
Author Message
al000y
PostPosted: Sun Jan 12, 2014 12:07 am    Post subject: From vb.net to MQ Reply with quote

Apprentice

Joined: 25 Dec 2013
Posts: 30

Hi All

I create a vb.net application that read rows from the database and insert them to a MQ queue.

The problem a facing from several days is that in my all flows i use to read the input data as XML tree like this

Code:
InputRoot.XML.(XML.Element)REQUEST.HEADER.TIME


But from the vb.net application the data sent to the flow is always BLOB even when the input message is
Code:
<USER_DATA><CUST_NO>" + dr.Item("CUSTOMER_NO") + "</CUST_NO><MOB>" + dr.Item("MOBILE_NO") + "</MOB></USER_DATA>


Anyone can advice me, is there a way to convert these BLOB to XML array or is there a way to send the data directly as XML?
Back to top
View user's profile Send private message
bruce2359
PostPosted: Sun Jan 12, 2014 6:18 am    Post subject: Reply with quote

Poobah

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

Moved to Message Broker forum.
_________________
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
View user's profile Send private message
smdavies99
PostPosted: Sun Jan 12, 2014 6:30 am    Post subject: Re: From vb.net to MQ Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

al000y wrote:


Code:
InputRoot.XML.(XML.Element)REQUEST.HEADER.TIME



Do not use the XML Parser. Use the XMLNSC parser instead

Is this even valid XML?
Quote:

Code:
<USER_DATA><CUST_NO>" + dr.Item("CUSTOMER_NO") + "</CUST_NO><MOB>" + dr.Item("MOBILE_NO") + "</MOB></USER_DATA>




WMQ Does not care what format the payload is in. It could even be is 'Fried Green Tomatoes' format for all it cared.
You decide how your flow is going to parse any messages read by the MQInput node. It defaults to BLOB but you can change it to say 'XMLNSC' in the Node properties.

I have to ask this next question simply because this is the second very similar question that has been posted here in the last week,
Have you attened a proper Broker Training Course?
IIB/Message Broker is a complicated product and not something that is easy to pick up without some decent training as a starter.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
al000y
PostPosted: Tue Jan 14, 2014 5:40 am    Post subject: Reply with quote

Apprentice

Joined: 25 Dec 2013
Posts: 30

Hi smdavies
Honestly i didn't attend any MQ training course, i just want to know this

This is the code that i used to put the XML data to the queue

Code:
 mqMsg = mqSession.AccessMessage()
            mqMsg.WriteString(TextBox2.Text)
            mqMsg.Format = MQFMT_STRING
            mqMsg.CharacterSet = 1200

            mqPutMsgOpts = mqSession.AccessPutMessageOptions()
            Try
                mqQueue.Put(mqMsg, mqPutMsgOpts)
                MsgBox("Message put to queue")
            Catch mqe As IBM.WMQ.MQException
                '* report the error
                MsgBox("MQQueue::Put ended with " + mqe.Message())
            End Try


And as you told me i change the message Domain from the node properties to XMLNSC

Now i am always get this exception:
XML Parsing Errors have occurred

And my input message is 100% valid XML

Code:
<?xml version="1.0" encoding="UTF-8"?>
<note>
   <to>Tove</to>
   <from>Jani</from>
   <heading>Reminder</heading>
   <body>Don't forget me this weekend!</body>
</note>


Anyone can help, i should complete it this week
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Jan 14, 2014 5:50 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Please browse the message on the queue before it is read by the broker flow and post it here.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jan 14, 2014 5:59 am    Post subject: Reply with quote

Grand High Poobah

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

al000y wrote:
Honestly i didn't attend any MQ training course, i just want to know this


So you're trying to use the product without any training and wonder why you're having problems? What will you do when you just want to know something else?

al000y wrote:
Now i am always get this exception:
XML Parsing Errors have occurred


I bet there's more details than that in the exception, and I bet they talk a lot about what the parser feels is wrong. Even if you don't know how to find them in the Exception Tree because you've not done any training and just want to know this.

al000y wrote:
Anyone can help


Not from the limited amount you've posted and given your lack of effort to learn why should we?

al000y wrote:
i should complete it this week


Presumably this deadline comes from the same management who decided you didn't need training before using a complex IBM product? Gosh they're going to regret that decision....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
al000y
PostPosted: Tue Jan 14, 2014 11:17 pm    Post subject: Reply with quote

Apprentice

Joined: 25 Dec 2013
Posts: 30

This is my exact vb code
Code:
Imports IBM.WMQAX
Imports IBM.WMQ.MQC

Public Class testFrm
    ReadOnly queueMGR As String = "SBB"
    ReadOnly queuechannel As String = "NET.CHANNEL"
    ReadOnly queueHost As String = "LOCALHOST(1421)"
    ReadOnly queueName As String = "test.in"

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim mqSession As MQSession                '* MQSession instance
        Dim mqQMgr As MQQueueManager              '* MQQueueManager instance
        Dim mqQueue As MQQueue                    '* MQQueue instance
        Dim mqMsg As MQMessage                    '* MQMessage instance
        Dim mqPutMsgOpts As MQPutMessageOptions   '* MQPutMessageOptions instance

        Dim isContinue As Boolean = True          '* Whether to continue processing

        '*
        '* Create an MQ session
        '*
        mqSession = New MQSession()

        '*
        '* Try to access the queue manager
        '*

        Try
            mqQMgr = mqSession.AccessQueueManager(queueMGR)
        Catch mqe As IBM.WMQ.MQException
            '* stop if failed
            MsgBox("create of MQQueueManager ended with " + mqe.Message())
            isContinue = False
        End Try

        If (isContinue = True) Then
            '*
            '* Try to open the queue
            '*
            Try
                mqQueue = mqQMgr.AccessQueue(TextBox1.Text, MQOO_OUTPUT + MQOO_FAIL_IF_QUIESCING)     '* open queue for output but not if MQM stopping
            Catch mqe As IBM.WMQ.MQException
                '* stop if failed
                MsgBox("MQQueueManager::AccessQueue ended with " + mqe.Message())
                isContinue = False
            End Try
        End If

        If (isContinue = True) Then
            mqMsg = mqSession.AccessMessage()
            mqMsg.WriteString(TextBox2.Text)
            mqMsg.Format = MQFMT_STRING
            mqMsg.CharacterSet = 1200

            mqPutMsgOpts = mqSession.AccessPutMessageOptions()
            Try
                mqQueue.Put(mqMsg, mqPutMsgOpts)
                MsgBox("Message put to queue")
            Catch mqe As IBM.WMQ.MQException
                '* report the error
                MsgBox("MQQueue::Put ended with " + mqe.Message())
            End Try

            mqQueue.Close()
            mqQMgr.Disconnect()
        End If

    End Sub
End Class



And this is my flow
http://i40.tinypic.com/2q87zpd.jpg

And this is the code of the flow
Code:
CREATE COMPUTE MODULE Test_in_Compute
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      CALL CopyMessageHeaders();
      CALL CopyEntireMessage();

      RETURN TRUE;
   END;

   CREATE PROCEDURE CopyMessageHeaders() BEGIN
      DECLARE I INTEGER 1;
      DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
      WHILE I < J DO
         SET OutputRoot.*[I] = InputRoot.*[I];
         SET I = I + 1;
      END WHILE;
   END;

   CREATE PROCEDURE CopyEntireMessage() BEGIN
      SET OutputRoot = InputRoot;
   END;
END MODULE;



And this is the exception
Code:

############### TRACE-START #################
ROOT TRACE:
(
  (0x01000000):Properties = (
    (0x03000000):MessageSet      = ''
    (0x03000000):MessageType     = ''
    (0x03000000):MessageFormat   = ''
    (0x03000000):Encoding        = 546
    (0x03000000):CodedCharSetId  = 1200
    (0x03000000):Transactional   = TRUE
    (0x03000000):Persistence     = FALSE
    (0x03000000):CreationTime    = GMTTIMESTAMP '2014-01-15 06:53:20.640'
    (0x03000000):ExpirationTime  = -1
    (0x03000000):Priority        = 0
    (0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
    (0x03000000):ReplyProtocol   = 'MQ'
    (0x03000000):Topic           = NULL
  )
  (0x01000000):MQMD       = (
    (0x03000000):SourceQueue      = 'test.in'
    (0x03000000):Transactional    = TRUE
    (0x03000000):Encoding         = 546
    (0x03000000):CodedCharSetId   = 1200
    (0x03000000):Format           = 'MQSTR   '
    (0x03000000):Version          = 2
    (0x03000000):Report           = 0
    (0x03000000):MsgType          = 8
    (0x03000000):Expiry           = -1
    (0x03000000):Feedback         = 0
    (0x03000000):Priority         = 0
    (0x03000000):Persistence      = 0
    (0x03000000):MsgId            = X'414d5120534242424b31514d202020207631cd5220005801'
    (0x03000000):CorrelId         = X'000000000000000000000000000000000000000000000000'
    (0x03000000):BackoutCount     = 0
    (0x03000000):ReplyToQ         = '                                                '
    (0x03000000):ReplyToQMgr      = 'SBBBK1QM                                        '
    (0x03000000):UserIdentifier   = 'alhaddad    '
    (0x03000000):AccountingToken  = X'16010515000000ca1b2e3d00b644d4cc6c0c1bf503000000000000000000000b'
    (0x03000000):ApplIdentityData = '                                '
    (0x03000000):PutApplType      = 11
    (0x03000000):PutApplName      = 'M_CUSTUPDATE_DB2Q.vshost.exe'
    (0x03000000):PutDate          = DATE '2014-01-15'
    (0x03000000):PutTime          = GMTTIME '06:53:20.640'
    (0x03000000):ApplOriginData   = '    '
    (0x03000000):GroupId          = X'000000000000000000000000000000000000000000000000'
    (0x03000000):MsgSeqNumber     = 1
    (0x03000000):Offset           = 0
    (0x03000000):MsgFlags         = 0
    (0x03000000):OriginalLength   = -1
  )
  (0x01000010):XML        =
)

ENVIRONMENT TRACE:
 

LOCAL ENVIRONMENT TRACE:
 

EXCEPTION TRACE:
(
  (0x01000000):RecoverableException = (
    (0x03000000):File                 = 'F:\build\S500_P\src\DataFlowEngine\ImbDataFlowNode.cpp'
    (0x03000000):Line                 = 558
    (0x03000000):Function             = 'ImbDataFlowNode::createExceptionList'
    (0x03000000):Type                 = 'ComIbmComputeNode'
    (0x03000000):Name                 = 'Test_in#FCMComposite_1_2'
    (0x03000000):Label                = 'Test_in.Compute'
    (0x03000000):Text                 = 'Node throwing exception'
    (0x03000000):Catalog              = 'BIPv500'
    (0x03000000):Severity             = 3
    (0x03000000):Number               = 2230
    (0x01000000):RecoverableException = (
      (0x03000000):File            = 'F:\build\S500_P\src\DataFlowEngine\ImbRdl\ImbRdlStatementGroup.cpp'
      (0x03000000):Line            = 158
      (0x03000000):Function        = 'SqlStatementGroup::execute'
      (0x03000000):Type            = 'ComIbmComputeNode'
      (0x03000000):Name            = 'Test_in#FCMComposite_1_2'
      (0x03000000):Label           = 'Test_in.Compute'
      (0x03000000):Text            = 'Error detected, rethrowing'
      (0x03000000):Catalog         = 'BIPv500'
      (0x03000000):Severity        = 3
      (0x03000000):Number          = 2488
      (0x01000000):Insert          = (
        (0x03000000):Type = 5
        (0x03000000):Text = '.Test_in_Compute.Main'
      )
      (0x01000000):Insert          = (
        (0x03000000):Type = 5
        (0x03000000):Text = '8.3'
      )
      (0x01000000):Insert          = (
        (0x03000000):Type = 5
        (0x03000000):Text = 'RETURN TRUE;'
      )
      (0x01000000):ParserException = (
        (0x03000000):File            = 'F:\build\S500_P\src\MTI\MTIforBroker\GenXmlParser2\XmlImbParser.cpp'
        (0x03000000):Line            = 394
        (0x03000000):Function        = 'XmlImbParser::parseFirstChild'
        (0x03000000):Type            = ''
        (0x03000000):Name            = ''
        (0x03000000):Label           = ''
        (0x03000000):Text            = 'XML Parsing Errors have occurred'
        (0x03000000):Catalog         = 'BIPv500'
        (0x03000000):Severity        = 3
        (0x03000000):Number          = 5009
        (0x01000000):ParserException = (
          (0x03000000):File     = 'F:\build\S500_P\src\MTI\MTIforBroker\GenXmlParser2\XmlBrokerAsgardParser.cpp'
          (0x03000000):Line     = 804
          (0x03000000):Function = 'XmlBrokerAsgardParser::error'
          (0x03000000):Type     = ''
          (0x03000000):Name     = ''
          (0x03000000):Label    = ''
          (0x03000000):Text     = 'An error has been reported by the BIPXML4C component.'
          (0x03000000):Catalog  = 'BIPv500'
          (0x03000000):Severity = 3
          (0x03000000):Number   = 5004
          (0x01000000):Insert   = (
            (0x03000000):Type = 2
            (0x03000000):Text = '182'
          )
          (0x01000000):Insert   = (
            (0x03000000):Type = 5
            (0x03000000):Text = ''
          )
          (0x01000000):Insert   = (
            (0x03000000):Type = 2
            (0x03000000):Text = '1'
          )
          (0x01000000):Insert   = (
            (0x03000000):Type = 2
            (0x03000000):Text = '1'
          )
          (0x01000000):Insert   = (
            (0x03000000):Type = 5
            (0x03000000):Text = 'Invalid document structure'
          )
          (0x01000000):Insert   = (
            (0x03000000):Type = 5
            (0x03000000):Text = ''
          )
        )
      )
    )
  )
)

############### TRACE-E N D ##################



Anyone able to help?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Jan 15, 2014 12:47 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

There is an error in in your ESQL. Put a TRACE node after the Compute node and set the pattern to

${Root}

Enable user trace and put your message through the flow again. Look at the output of the usertrace. The problem should be fairly obvious.

However please browse the message on the queue and post it here just so that we can see what you are writing to the queue is correct.

Even if you correct the problems in your flow, if the data being read is not good XML then you will see errors when trying to process it.

All of this is covered on the Broker Training Course.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
al000y
PostPosted: Wed Jan 15, 2014 12:58 am    Post subject: Reply with quote

Apprentice

Joined: 25 Dec 2013
Posts: 30

I forgot to post the screenshots

http://tinypic.com/view.php?pic=2q87zpd&s=5#.UtZMAdIW27w
http://tinypic.com/view.php?pic=11qmedh&s=5#.UtZMIdIW27w

And my esql is only that

Code:

CREATE COMPUTE MODULE Test_in_Compute
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      CALL CopyMessageHeaders();
      CALL CopyEntireMessage();

      RETURN TRUE;
   END;

   CREATE PROCEDURE CopyMessageHeaders() BEGIN
      DECLARE I INTEGER 1;
      DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
      WHILE I < J DO
         SET OutputRoot.*[I] = InputRoot.*[I];
         SET I = I + 1;
      END WHILE;
   END;

   CREATE PROCEDURE CopyEntireMessage() BEGIN
      SET OutputRoot = InputRoot;
   END;
END MODULE;



And that is the message in the Queue

Code:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE FCCACCSERVICE SYSTEM "./FCCACCSERVICE.DTD"><FCCACCSERVICE><SHEADER>ACC_LIST<SYSTEM><VAL>BANK</VAL></SYSTEM></SHEADER><QUERY_ACCBAL_SUMMARY><SCODE>BANK</SCODE><XREF>E000001</XREF><CUST_NO>0000001</CUST_NO></QUERY_ACCBAL_SUMMARY></FCCACCSERVICE>
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Jan 15, 2014 1:27 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Ok, the XML Looks reasonable.

The Screenshots are useless for a good number of us as the website you posted them on is blocked by our corporate firewalls.

There is still an error in your ESQL.

Look at some of the samples that use a compute node. That will tell you what is wrong.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
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 » From vb.net to MQ
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.