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 » Creating namespaces in Java compute node

Post new topic  Reply to topic
 Creating namespaces in Java compute node « View previous topic :: View next topic » 
Author Message
NAIDU
PostPosted: Wed May 10, 2017 11:49 am    Post subject: Creating namespaces in Java compute node Reply with quote

Novice

Joined: 12 Jan 2016
Posts: 17

Hi All,
I struggle to create namespaces . I wanted to construct message like
<out7:getCustomerSubscriptionInfoResponse xmlns:out7="http://wsdl.ussco.com/CustomerSubscription/CustomerSubscriptionInterface" xmlns:out13="http://wsdl.ussco.com/CustomerSubscription/ShowCustomerSubscription">
<out13:ShowCustomerSubscription>
<SubscriptionDetail>
<TrdParnterId>hello</TrdParnterId>
</SubscriptionDetail>
</out13:ShowCustomerSubscription>
</out7:getCustomerSubscriptionInfoResponse>


Now i was trying with code :

MbElement XMLNSC=outputroot.createElementAsLastChild(MbXMLNSC.PARSER_NAME);

MbElement getCustomerSubscriptionInfoResponse=XMLNSC.createElementAsLastChild(MbElement.TYPE_NAME,"getCustomerSubscriptionInfoResponse",null);

getCustomerSubscriptionInfoResponse.createElementAsLastChild(MbXMLNSC.NAMESPACE_DECLARATION, "xmlns:out7", "http://wsdl.ussco.com/CustomerSubscription/CustomerSubscriptionInterface");

MbElement ShowCustomerSubscription = getCustomerSubscriptionInfoResponse.createElementAsLastChild(MbElement.TYPE_NAME,"ShowCustomerSubscription",null);
ShowCustomerSubscription.createElementAsLastChild(MbXMLNSC.NAMESPACE_DECLARATION, "out13", "http://wsdl.ussco.com/CustomerSubscription/ShowCustomerSubscription");

Can anyone help me out
Back to top
View user's profile Send private message
timber
PostPosted: Wed May 10, 2017 12:03 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1280

Yes, the Java API is not particularly user-friendly when it comes to namespaces. The trick is to set the namespace on each and every node in the message tree ( your code is not doing that; it is only creating namespace declarations).
I think this thread should be helpful:
http://www.mqseries.net/phpBB/viewtopic.php?p=234727&sid=6a0ccb34e9fbbd6e28beaa5b4958a7e1
See my post under the name kimbert on Tue Jan 06, 2009 2:54 pm

When you have worked out what to do, I would strongly advise you to create some Java helper methods to do the boilerplate stuff, otherwise your code will look very messy.
Back to top
View user's profile Send private message
NAIDU
PostPosted: Wed May 10, 2017 12:38 pm    Post subject: Reply with quote

Novice

Joined: 12 Jan 2016
Posts: 17

It quite opposite to my requirement.

now i have tried :

MbElement XMLNSC=outputroot.createElementAsLastChild(MbXMLNSC.PARSER_NAME);


MbElement getCustomerSubscriptionInfoResponse=XMLNSC.createElementAsLastChild(MbElement.TYPE_NAME,"getCustomerSubscriptionInfoResponse",null);

getCustomerSubscriptionInfoResponse.createElementAsLastChild(MbXMLNSC.NAMESPACE_DECLARATION, "xmlns:out7", "http://wsdl.ussco.com/CustomerSubscription/CustomerSubscriptionInterface");

getCustomerSubscriptionInfoResponse.createElementAsLastChild(MbXMLNSC.NAMESPACE_DECLARATION, "xmlns:out13", "http://wsdl.ussco.com/CustomerSubscription/ShowCustomerSubscription");

MbElement ShowCustomerSubscription = getCustomerSubscriptionInfoResponse.createElementAsLastChild(MbElement.TYPE_NAME,"ShowCustomerSubscription",null);


here i need to create doublenamespace for this .. in esql i found

https://www.ibm.com/support/knowledgecenter/SSKM8N_8.0.0/com.ibm.etools.mft.doc/ac67194_.htm

in similar ways i think this suits me.. i am trying tooo
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed May 10, 2017 1:11 pm    Post subject: Reply with quote

Grand High Poobah

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

The example only shows ESQL and as I understand you are struggling in Java.
You have to look at the api and declare the namespace, then set it on the (Mb)Element. Use the setNamespace method of the MbElement object.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Thu May 11, 2017 4:45 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

As mentioned, you have only created namespace declarations.

You have to run setNamespace on every MBElement to the right namespace for that element.

You have to use the *full* namespace. You can't use the namespace declaration values - out7 - but have to use "http://wsdl.ussco.com/CustomerSubscription/CustomerSubscriptionInterface" .

As timber mentions, you should write a function to do this, to make sure your code is clean, if possible.
_________________
chmod -R ugo-wx /
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 » Creating namespaces in Java compute node
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.