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 » WMBv6.1->HTTP GET Messages

Post new topic  Reply to topic Goto page 1, 2  Next
 WMBv6.1->HTTP GET Messages « View previous topic :: View next topic » 
Author Message
broker_new
PostPosted: Wed Jan 13, 2010 9:34 pm    Post subject: WMBv6.1->HTTP GET Messages Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

Hi Guys,

I have exposed a message flow to receive the HTTP GET messages.

The data is posted as follows
http://{HostName}/:7080/SubmitOrderSvc?User=XXX?Password=XXX&Payload=%3C%3Fxml%20version%3D%221.0%22%3F%3E...........

I am reading the message as BLOB but not able to decode it back to XML?
Is there any way that we can cast it to XML?

i used Java Compute Node to decode it back to XML but as ESQL is more efficient i am posting it as a separate thread. x
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Jan 14, 2010 1:49 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

CAST is for converting between two simple data types, so is probably not what you need.

Are you asking how to convert a BLOB to a message tree using ESQL?
If so, you need a CREATE statement with PARSE and DOMAIN clauses. There are plenty of examples on the forum. Domain will be XMLNSC, of course.
Back to top
View user's profile Send private message
mgk
PostPosted: Thu Jan 14, 2010 4:09 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

You may also be interested to know that from 6.1.0.4 and above the HTTPInput node has a property to parse and url-decode a querystring into name-value pairs in the local environment. This will save you having to parse the querystring by hand. You will still need to use CREATE with PARSE as kimbert suggests to turn the value into an XMLNSC tree through.

Kind Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
broker_new
PostPosted: Thu Jan 14, 2010 8:25 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

let me elaborate more on my problem,

Flow:
HTTPInput>>Compute>>HTTP Reply

On the client side the data is posted as following manner.

http://{HostName}/:7080/SubmitOrderSvc?User=XXX?Password=XXX&Payload=%3C%3Fxml%20version%3D%221.0%22%3F%3E...........

there is no case i read the above data except i read it as BLOB domain.
I cast the input message as Char (CCSID 1208) and REPLACE commands to strip out the "User=XXX?Password=XXX&Payload=" to create an XML message.

Then i parse the message using the CREATE PARSE command or using RCD i can parse it...

But in either of the cases it is not getting parsed because the XML message is encoded, is there a broker capability to decode it back to XML?
Back to top
View user's profile Send private message
mgk
PostPosted: Thu Jan 14, 2010 9:27 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
the XML message is encoded, is there a broker capability to decode it back to XML


Yes, as I said above:
Quote:
from 6.1.0.4 and above the HTTPInput node has a property to parse and url-decode a querystring into name-value pairs in the local environment. This will save you having to parse the querystring by hand


Once you have done this you will have to:
Quote:
parse the message using the CREATE PARSE command

To turn it into an XML tree.

Use a trace node to look at the LocalEnvrionment after the httpinput node once that option is checked, to see what I mean.

Kind Regards.
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
broker_new
PostPosted: Thu Jan 14, 2010 10:13 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

HTTPInput>>Compute>>HTTP Reply

I have set Message Domain as "XMLNSC" and Parse Query String checked ..throwing a parser exception

I tried with Message Domain as "BLOB" but no elements created in LocalEnvironment...am i doing something wrong?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Jan 14, 2010 10:15 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.

Quote:
If so, you need a CREATE statement with PARSE and DOMAIN clauses. There are plenty of examples on the forum. Domain will be XMLNSC, of course.


This is done in ESQL
_________________
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
broker_new
PostPosted: Thu Jan 14, 2010 10:20 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

to be specific my question is what domain i have to use it in HTTPInput Node ? it doesn't work either way (XMLNSC, BLOB)
Back to top
View user's profile Send private message
mgk
PostPosted: Thu Jan 14, 2010 10:57 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Leave the DOMAIN as BLOB in the HTTP Input node. Check the "Parse Query String" property then look at the tree in a trace node. Use a Compute node to do the CREATE PARSE...

Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
broker_new
PostPosted: Thu Jan 14, 2010 1:13 pm    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

Doesn't work for me.

I have set "BLOB" and checked the option "Parse Query String".
Nothing was created in OutputLocaEnvironment tree.

ESQL:


DECLARE bodyBlob1 BLOB InputRoot.BLOB.BLOB;
DECLARE creationPtr1 REFERENCE TO OutputRoot;

CREATE LASTCHILD OF creationPtr1 DOMAIN('XMLNSC')
PARSE(bodyBlob1,InputRoot.Properties.Encoding,InputRoot.Properties.CodedCharSetId);


Exception:

Caught exception and rethrowing Error detected, rethrowing
Procedures.XXXXX_MsgFlow_Compute.Main 22.3 RETURN TRUE; XML Parsing Errors have occurred An XML parsing error has occurred while parsing the XML document 1504 2 1 1 An invalid XML character (Unicode: 0x3f) was found in the prolog of the document. /Root/XMLNSC


Here is the POST message:

http://{HostName}:7080/PostSvc1?User=abcd&Password=abcd&Input=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E
Back to top
View user's profile Send private message
mgk
PostPosted: Thu Jan 14, 2010 2:49 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Did you look at the LocalEnvrionment in a TraceNode? If you do you should see that your url-decoded querystring is in the LocalEnvironment. You never need to use the BLOB message in this case as the contents of the BLOB is parsed out into name-value pairs that are placed into the LocalEnvrionment!


Kind Regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
broker_new
PostPosted: Fri Jan 15, 2010 7:55 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

unfortunately, i see only the Request identifier

( ['MQROOT' : 0x791a8c0]
(0x01000000:Name):Destination = (
(0x01000000:Name):HTTP = (
(0x03000000:NameValue):RequestIdentifier = X'414d5120574d42363131514d202020203884504b2000a303' (BLOB)
)
Back to top
View user's profile Send private message
broker_new
PostPosted: Fri Jan 15, 2010 8:08 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

Client code to post the message:

import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;


public class XmlPost {
public XmlPost() {
}
public static void main(String[] args) {
String postUrl ="http://localhost:7080/PostSvc";

try
{
URL url = new URL( postUrl );
URLConnection postCon = url.openConnection();
postCon.setDoInput(true);
postCon.setDoOutput(true);
postCon.setUseCaches(false);
postCon.setDefaultUseCaches(false);
OutputStreamWriter writer = new OutputStreamWriter( postCon.getOutputStream() );
writer.write( buildXmlRequest().toString());
writer.flush();
writer.close();

InputStreamReader reader = new InputStreamReader( postCon.getInputStream() );

StringBuilder buf = new StringBuilder();
char[] cbuf = new char[ 2048 ];
int num;

while ( -1 != (num=reader.read( cbuf )))
{
buf.append( cbuf, 0, num );
}

String result = buf.toString();
System.out.println( "\nWebservice Response:\n" + result );
}
catch( Throwable t )
{
t.printStackTrace( System.out );
}

}


public static String buildXmlRequest() {
StringBuffer sb = new StringBuffer();
String msg = "?User=abcd&Password=abcd&Input=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E";
System.out.println("\n Webservice XML Request:\n" + msg + "\n");
return msg.toString();
}
}
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jan 15, 2010 8:56 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

broker_new wrote:
unfortunately, i see only the Request identifier

Are you using 6.1.0.4?

Did you check the box on the HTTPInput node that mgk mentioned, and redeploy?
Back to top
View user's profile Send private message
broker_new
PostPosted: Fri Jan 15, 2010 9:13 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

C:\IBM\MQSI\6.1>mqsiservice -v
BIPv610 en US
ucnv Console CCSID 437 dft ucnv CCSID 5348
ICUW ibm-5348_P100-1997 ICUA ibm-5348_P100-1997

BIP8996I: Version: 6105
BIP8997I: Product: WebSphere Message Brokers
BIP8998I: CMVC Level: S610-FP05 DH610-FP05
BIP8999I: Build Type: Production

BIP8071I: Successful command completion.


Yes, i followed her steps one by one..

HTTPInput Properties:

Message Domain = BLOB
Checked Parse Query String

Parsed the XML using CREATE PARSE i attached the trace between HTTP Input and Compute ...couldn't find anything
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » WMBv6.1->HTTP GET Messages
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.