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 » HTTPInput and application x-www-form-urlencoded

Post new topic  Reply to topic
 HTTPInput and application x-www-form-urlencoded « View previous topic :: View next topic » 
Author Message
goffinf
PostPosted: Thu May 06, 2010 2:27 am    Post subject: HTTPInput and application x-www-form-urlencoded Reply with quote

Chevalier

Joined: 05 Nov 2005
Posts: 401

Version: 6.1.0.3
Platform: Windows

Just checking something.

I use JMeter as one of the tools for performance testing. When I ask it to send messages as an HTTP client using POST it uses a Content-Type of application/x-www-form-urlencoded. Thats fine, but ...

recently I was looking through some related posts on this forum and found this from 'mgk' (in fairness the comment was really about parsing the query string but I just waned to check) :-

mgk wrote:
Unfortunately, WMB does not currently parse 'application/x-www-form-urlencoded' data automatically - but you can use java to parse it as you have been doing.


This made me wonder whether if I set the HTTPInput node message domain property to XMLNSC, it would be honoured or not, and whether I would need to use a different JMeter sampler (such as XML-RPC) so that I can set a different content type (e.g. application/xml).

Trying a sample flow with a trace node just after the HTTPInput (and application/x-www-form-urlencoded) appears to show that Message Broker has no problem parsing the input using the the XMLNSC parser.

So all should be weell. I just wanted to confirm that this is what others would expect.

Thansk

Fraser.
Back to top
View user's profile Send private message
abtimo
PostPosted: Tue Mar 24, 2015 8:38 am    Post subject: Reply with quote

Novice

Joined: 24 Mar 2015
Posts: 23

Yes, you are right, no POST body parsing by default, easiest way to solve the problem : you have to create Java Compute Node and parse the post message manually.

The JCN code will be similar to this :

// ----------------------------------------------------------
// Add user code below

// Retrieve InputRoot/BLOB/BLOB field:
MbElement outerblob = inMessage.getRootElement().getLastChild();
MbElement blob = outerblob.getLastChild();

// Serialize to byte array
byte[] mybytes=(byte[]) blob.getValue();

// Parse byte array to string with UTF 8 encoding
String urlencoded = new String(mybytes, "UTF-8");

// Parse string with POST parameters to key value map
Map asbosub = asMap(urlencoded);

// Create Subscriber from JAXB generated POJO

Subscriber gbosub = new Subscriber();

// Populate standard mailchimp fields
gbosub.setEmail((String)asbosub.get(URLEncoder.encode("data[email]", "utf8")));
gbosub.setFirstName((String)asbosub .get(URLEncoder.encode("data[merges] [FNAME]", "utf8")));
gbosub.setLastName((String)asbosub .get(URLEncoder.encode("data[merges] [LNAME]", "utf8")));

Object outMsgJavaObj = gbosub;

// End of user Java object processing
// ----------------------------------------------------------
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Mar 24, 2015 8:43 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

abtimo wrote:
Yes, you are right, no POST body parsing by default,

Why are you responding to a 5 year old post about a completely obsolete version of Broker?

Have you considered that newer versions of Broker might just handle all this for you?
Back to top
View user's profile Send private message
abtimo
PostPosted: Tue Mar 24, 2015 9:09 am    Post subject: Reply with quote

Novice

Joined: 24 Mar 2015
Posts: 23

>>newer versions of Broker might just handle all this for you?

IIB v9.0.0.1 does not, unless i did not find.... Please show how to do it without JCN coding if you know.
Back to top
View user's profile Send private message
abtimo
PostPosted: Tue Mar 24, 2015 9:26 am    Post subject: Reply with quote

Novice

Joined: 24 Mar 2015
Posts: 23

The 9.0.0.3 knowledge center explain how to get parameters parsed from the query string, but i can not find anything useful about a possibility to parse parameters sent as POST parameters in application/x-www-form-urlencoded format.

http://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ac04565_.htm

Parse Query String : This property causes any query string that is present with an incoming message to be parsed and decoded (according to http://tools.ietf.org/html/rfc3986) into the following location in the local environment as a series of name-value elements that match the names and values present in the query string:

LocalEnvironment.HTTP.Input.QueryString
For example, for this query string:

?myParam1=my%22Value%221&myParam2=my%22Value%222
the following elements are placed into the local environment under the QueryString folder:

myParam1 with a value of my"Value"1
myParam2 with a value of my"Value"2

...
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 » HTTPInput and application x-www-form-urlencoded
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.