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 » HTTP Client IIB9

Post new topic  Reply to topic
 HTTP Client IIB9 « View previous topic :: View next topic » 
Author Message
sleepyjamie
PostPosted: Fri Jul 31, 2015 12:18 pm    Post subject: HTTP Client IIB9 Reply with quote

Centurion

Joined: 29 Apr 2015
Posts: 135

I'm trying to set the HTTP Headers in a Java Compute node. I've found documentation for it, however it is all shown in ESQL.

I'm in the process of learning the IIB Java API. Here is what I am trying to do:

SET OutputRoot.HTTPRequestHeader."Content-Type" = 'application/json';
SET OutputRoot.HTTPRequestHeader."Authorization" = 'key=abc';
SET OutputRoot.JSON = ""
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jul 31, 2015 12:21 pm    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/ac30320_.htm%23ac30320_
Back to top
View user's profile Send private message
sleepyjamie
PostPosted: Fri Jul 31, 2015 12:32 pm    Post subject: Reply with quote

Centurion

Joined: 29 Apr 2015
Posts: 135

Thanks.


MbElement elRoot = outMessage.getRootElement();
MbElement elHttpRequestHeader = elRoot.createElementAsLastChild(MbElement.TYPE_NAME, "HTTPRequestHeader", null);
elHttpRequestHeader.createElementAfter(MbElement.TYPE_NAME_VALUE, "Authorization", "key=ABC");
elHttpRequestHeader.createElementAfter(MbElement.TYPE_NAME_VALUE, "Content-Type", "application/json");

MbElement body = outMessage.getRootElement().getFirstElementByPath("BLOB");
body.setValue("{\"to\":\"/topics/test\",\"data\":{\"message\":\"Test message from IIB\"}}");
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Jul 31, 2015 1:33 pm    Post subject: Reply with quote

Grand High Poobah

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

sleepyjamie wrote:
Thanks.


MbElement elRoot = outMessage.getRootElement();
MbElement elHttpRequestHeader = elRoot.createElementAsLastChild(MbElement.TYPE_NAME, "HTTPRequestHeader", null);
elHttpRequestHeader.createElementAfter(MbElement.TYPE_NAME_VALUE, "Authorization", "key=ABC");
elHttpRequestHeader.createElementAfter(MbElement.TYPE_NAME_VALUE, "Content-Type", "application/json");

MbElement body = outMessage.getRootElement().getFirstElementByPath("BLOB");
body.setValue("{\"to\":\"/topics/test\",\"data\":{\"message\":\"Test message from IIB\"}}");


Looks like you 're doing it the hard way and missing half of what you should be doing for lack of understanding.

Please try this out first: Use the palette to add an HTTPRequestHeader and set the values you want in the properties.
Then in the subsequent JCN you can explore the InputMessage and HTTPRequestHeader and get a feel for it.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon Aug 03, 2015 4:41 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Did you do something to create OutputRoot.BLOB.BLOB first?

Should you be using OutputRoot.JSON instead?
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 » HTTP Client IIB9
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.