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 » Retrieving an input XML element using JCN

Post new topic  Reply to topic
 Retrieving an input XML element using JCN « View previous topic :: View next topic » 
Author Message
Halloween
PostPosted: Tue Dec 01, 2015 11:09 am    Post subject: Retrieving an input XML element using JCN Reply with quote

Acolyte

Joined: 11 Mar 2015
Posts: 60

Hello Everyone,

I have not worked with JAva before.
Can somebody help me with sample code to store each element from input XML into the string variable within Java compute node
I have a requirement where i have to log these XML element values into the database.
Also, i have to do passthrough to SOAP reply from input XML string

Thanks
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Dec 01, 2015 11:14 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

There are a large number of samples that come with the product.

Including a sample using a JCN.

This, and the knowledge center, will show you everything you need to know to access fields in the input message.

Also, if you have not worked with Java before, you should make sure your employer knows this, and then work with a local person who *has* worked with Java before.

Or get a new job.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Dec 01, 2015 11:32 am    Post subject: Re: Retrieving an input XML element using JCN Reply with quote

Grand High Poobah

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

Halloween wrote:
I have not worked with JAva before.


Then you should probably get your feet wet with some basic Java before trying a JCN.

Or better still, use one of the other languages / tools supplied with IIB. Because....

Halloween wrote:
I have a requirement where i have to log these XML element values into the database.


...there's nothing about that requirement that says "I can only be done in Java"

Halloween wrote:
Can somebody help me with sample code


IBM have kindly provided samples with the product. There's also a lot of samples on the web (including but not limited to Roger's site)

Halloween wrote:
Also, i have to do passthrough to SOAP reply from input XML string


This doesn't make sense as written. If you're "passing through" to a SOAP reply, that implies you had a SOAP input. If you've got an input XML string, you're wrapping that in a SOAP envelope and sending it, not replying.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Halloween
PostPosted: Tue Dec 01, 2015 12:07 pm    Post subject: XML elements in JCN Reply with quote

Acolyte

Joined: 11 Mar 2015
Posts: 60

Hello genius Poobah,

Its a passthrough which means there is not transformation logic. Also, dear genius, you were right. I am wrapping XML string within the SOAP envelope.
However, i have to segregate these XML element values and log it into database.

I am not so newbie on java. But its been a long while since i worked.

Thanks for the blunt reply.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Dec 01, 2015 12:14 pm    Post subject: Re: XML elements in JCN Reply with quote

Jedi Council

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

Halloween wrote:
Hello genius Poobah,

Its a passthrough which means there is not transformation logic. Also, dear genius, you were right. I am wrapping XML string within the SOAP envelope.
However, i have to segregate these XML element values and log it into database.

I am not so newbie on java. But its been a long while since i worked.

Thanks for the blunt reply.


A word of caution about Java in a Broker/IIB envirnment. If you have used Java in a J2EE environment before then please forget all the J2EE stuff. Broker is NOT a J2EE App Server. You must use the Broker Java classes for manipulating message trees. The samples use a good number of JCN's. Please read them before starting on this work. It will give you a good introduction into how to use Java properly.
_________________
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 Dec 01, 2015 12:39 pm    Post subject: Re: XML elements in JCN Reply with quote

Grand High Poobah

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

Halloween wrote:
I am wrapping XML string within the SOAP envelope.


So it's not a reply, it's a request. Remember we only know what you tell us.

Halloween wrote:
However, i have to segregate these XML element values and log it into database.


If that's what you need to do, that's what you need to do.

Halloween wrote:
I am not so newbie on java.


That's not very clear from your statement:

Halloween wrote:
I have not worked with JAva before


You're either "not worked with Java" or "not so newbie on Java" in the same way a SOAP message is either a new request or a response.

Halloween wrote:
Thanks for the blunt reply.


I think my worthy associate stated it much better than I could have:

smdavies99 wrote:
A word of caution about Java in a Broker/IIB envirnment. If you have used Java in a J2EE environment before then please forget all the J2EE stuff. Broker is NOT a J2EE App Server. You must use the Broker Java classes for manipulating message trees. The samples use a good number of JCN's. Please read them before starting on this work. It will give you a good introduction into how to use Java properly.


I'm still not seeing anything that indicates why you'd want or need to use Java for any of these requirements.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Halloween
PostPosted: Tue Dec 01, 2015 1:32 pm    Post subject: I'm still not seeing anything that indicates why you'd want Reply with quote

Acolyte

Joined: 11 Mar 2015
Posts: 60

[I'm still not seeing anything that indicates why you'd want or need to use Java for any of these requirements.
]


Because i am using JDBC Type 4 connection.

I do not have data source name for DB2 database.

The only thing i have is the Schema and Table name, with database name, username and password.

Is there any alternative way other than to use java compute node if you are designing a configurable services based on these database details????

I know its very easy in compute node using esql if you have datasource name.

Please understand what i mean to say and then quote your suggestion in stack or tree structure[/quote]
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Dec 01, 2015 10:39 pm    Post subject: Reply with quote

Jedi Council

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

So you don't have an ODBC DSN for the DB2 database....

Have you thought about asking for one (if it does not exist)? Your admins should be able to do that in a few minutes. Then you can use the power and simplicity of ESQL for your DB work.

At my last job we canned all JDBC connections just because they were a real PITA.
With ODBC only life got a lot simpler and more reliable.

Go on, ask. The admins are human too you know.
_________________
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
maurito
PostPosted: Wed Dec 02, 2015 12:53 am    Post subject: Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

smdavies99 wrote:
So you don't have an ODBC DSN for the DB2 database....

Have you thought about asking for one (if it does not exist)? Your admins should be able to do that in a few minutes. Then you can use the power and simplicity of ESQL for your DB work.

At my last job we canned all JDBC connections just because they were a real PITA.
With ODBC only life got a lot simpler and more reliable.

Go on, ask. The admins are human too you know.


maybe he does not need an ODBC connection as he is planning
Quote:

i have to do passthrough to SOAP reply from input XML string

How the op is going to do that , well...
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Dec 02, 2015 5:55 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You can use and ODBC Connection from a JCN.

You can use other nodes than a JCN to use JDBC connections.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Dec 02, 2015 6:32 am    Post subject: Reply with quote

Grand High Poobah

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

mqjeff wrote:
You can use and ODBC Connection from a JCN.

You can use other nodes than a JCN to use JDBC connections.






To both points.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Halloween
PostPosted: Wed Dec 02, 2015 8:19 am    Post subject: Regarding DSN Reply with quote

Acolyte

Joined: 11 Mar 2015
Posts: 60

Thank You all for your valuable suggestion.

I agree with you all that using DSN and compute would make our life lot easier when comes to dealing with database.

I just want to know before i can make this point to my DB admin who can create DSN for me.

Our database is hosted on Unix.
I was wondering only windows system are capable to create ODBC connection and DSN

Since, it has been a Unix hosting the database and they use Type 4 JDBC connection. Is it possible to create DSN for database?

If i get Y for this two lines that i mentioned above, i will make a point to my DB Admin and ask them to create DSN for me.

Thanks
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Dec 02, 2015 9:17 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

http://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/bz90115_.htm?lang=en


_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Dec 02, 2015 10:26 am    Post subject: Re: Regarding DSN Reply with quote

Grand High Poobah

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

Halloween wrote:

Our database is hosted on Unix.
I was wondering only windows system are capable to create ODBC connection and DSN


I'm wondering why you would think that. Many Unix applications (not just IIB) use ODBC, which was developed originally for Unix and ported/borrowed/stolen/plagiarized by Microsoft.

Halloween wrote:
Since, it has been a Unix hosting the database and they use Type 4 JDBC connection. Is it possible to create DSN for database?


Of course it is. Speak to the DBA and whoever manages your broker. Just because Java applications typically use a JDBC connection doesn't mean you can't use an ODBC; nor does it mean you have to write Java code inside IIB to exploit a JDBC connection rather than use the inbuilt tooling.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Halloween
PostPosted: Wed Dec 02, 2015 11:49 am    Post subject: Reply with quote

Acolyte

Joined: 11 Mar 2015
Posts: 60

Thanks Victor. Thanks everyone. I will definitely make this point
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 » Retrieving an input XML element using JCN
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.