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 » HttpRequestNode

Post new topic  Reply to topic Goto page 1, 2, 3  Next
 HttpRequestNode « View previous topic :: View next topic » 
Author Message
tosaurav
PostPosted: Fri Jul 13, 2007 9:07 am    Post subject: HttpRequestNode Reply with quote

Acolyte

Joined: 16 Jan 2007
Posts: 62

Have mqinput-compute-httprequest-compute-mqoutput node in flow.The HTTPrequestNode works fine when flow has httpinput n httpreply.Problem is have to upload a file and few other data to consumed by Servlet.I tried following thing but got failure.

MQINPUT NODE property
Selected BLOB domain (since it worked with pure http node usage)
Compute Node
Selected Compute mode as LocalEnvironment & Message
ESQL is below
HTTPREQUESTNODE
URL :: Target
Message Domain :: BLOB
Rest Deafults
Compute Node (2)
Selected Compute mode as LocalEnvironment & Message


ESQL FOR COMPUTE NODE 1
CALL CopyEntireMessage();
SET Environment.MyMQMD = InputRoot.MQMD;
SET OutputRoot.HTTPRequestHeader."Content-Type" = 'multipart/form-data; boundary=---------------------------7d72771228107e';
DECLARE MH_EAI_GENERIC_ROUTE_TO CHAR 'ALL';
DECLARE MH_SYS_NAME CHAR 'XXXX';
DECLARE inputMsg BLOB;
SET inputMsg = InputRoot.BLOB;
SET input = 'MH_EAI_GENERIC_ROUTE_TO=ALL' || 'MH_SYS_NAME=XXXX' || inputMsg;

SET OutputRoot.BLOB = CAST (input AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);

CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;


ESQL for COPMPUTE NODE (2)
CALL CopyMessageHeaders();
SET OutputRoot.MQMD = Environment.MYMQMD;
SET OutputRoot.Properties.MessageFormat = 'MQSTR';
SET OutputRoot.Properties.Encoding = 546;
SET OutputRoot.Properties.CodedCharSetId = 437;

SET OutputRoot.HTTPResponseHeader = null;
SET OutputRoot.HTTPRequestHeader = null;

-- Format xml by removing raw xml return from webservice
DECLARE MSG CHAR '';
SET MSG = CAST (InputRoot.BLOB AS CHAR CCSID InputRoot.MQMD.CodedCharSetId);
--SET MSG = REPLACE (MSG, '&lt;','<');
--SET MSG = REPLACE (MSG, '&gt;','>');

SET OutputRoot.BLOB = CAST (MSG AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);

RETURN TRUE;
END;

CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;


TRACE1 (After Compute 1 before HttpRequest)
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 437
(0x03000000):Transactional = TRUE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2007-07-13 16:12:15.350'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'MQ'
(0x03000000):Topic = NULL
(0x03000000):ContentType = 'multipart/form-data; boundary=---------------------------7d72771228107e'
)
(0x01000000):MQMD = (
(0x03000000):SourceQueue = 'WS.IN'
(0x03000000):Transactional = TRUE
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 437
(0x03000000):Format = ' '
(0x03000000):Version = 2
(0x03000000):Report = 0
(0x03000000):MsgType = 8
(0x03000000):Expiry = -1
(0x03000000):Feedback = 0
(0x03000000):Priority = 0
(0x03000000):Persistence = 0
(0x03000000):MsgId = X'414d51204e4557514d47522020202020a1c693462015a318'
(0x03000000):CorrelId = X'000000000000000000000000000000000000000000000000'
(0x03000000):BackoutCount = 0
(0x03000000):ReplyToQ = ' '
(0x03000000):ReplyToQMgr = 'NEWQMGR '
(0x03000000):UserIdentifier = 'ssharma1 '
(0x03000000):AccountingToken = X'1601051500000027580e0b473d4c05bb59713a545b020000000000000000000b'
(0x03000000):ApplIdentityData = ' '
(0x03000000):PutApplType = 11
(0x03000000):PutApplName = 'C:\software\ih03\rfhutil.exe'
(0x03000000):PutDate = DATE '2007-07-13'
(0x03000000):PutTime = GMTTIME '16:12:15.350'
(0x03000000):ApplOriginData = ' '
(0x03000000):GroupId = X'000000000000000000000000000000000000000000000000'
(0x03000000):MsgSeqNumber = 1
(0x03000000):Offset = 0
(0x03000000):MsgFlags = 0
(0x03000000):OriginalLength = -1
)
(0x03000000):BLOB = X'4d485f4541495f47454e455249435f524f5554455f544f3d414c4c4d485f5359535f4e414d453d504f5752'
(
(0x03000000):UnknownParserName = ''
(0x03000000):BLOB = X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822203f3e0d0a3c6561692d6966772d696e746572666163653e0d0a093c'... (data of len 974 truncated)'
)
(0x01000000):HTTPRequestHeader = (
(0x03000000):Content-Type = 'multipart/form-data; boundary=---------------------------7d72771228107e'
)
)


TRACE 2 (AFTER HttpRequest before Compute 2)
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2007-07-13 16:11:41.577'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'MQ'
(0x03000000):Topic = NULL
(0x03000000):ContentType = 'text/html'
)
(0x01000000):HTTPRequestHeader = (
(0x03000000):Content-Length = '89'
(0x03000000):Content-Type = 'multipart/form-data; boundary=---------------------------7d72771228107e'
(0x03000000):Host = 'mwisit.etc.uspto.gov'
(0x03000000):SOAPAction = '""'
)
(0x01000000):HTTPResponseHeader = (
(0x03000000):X-Original-HTTP-Status-Line = 'HTTP/1.1 200 OK'
(0x03000000):X-Original-HTTP-Status-Code = 200
(0x03000000):Date = 'Fri, 13 Jul 2007 16:12:21 GMT'
(0x03000000):Server = 'IBM_HTTP_Server/6.0.2.19 Apache/2.0.47 (Unix)'
(0x03000000):Content-Length = '0'
(0x03000000):Connection = 'close'
(0x03000000):Content-Type = 'text/html'
(0x03000000):Content-Language = 'en-US'
)
)


Servlet response is just string
Back to top
View user's profile Send private message
wbi_telecom
PostPosted: Fri Jul 13, 2007 10:11 am    Post subject: Reply with quote

Disciple

Joined: 15 Feb 2006
Posts: 188
Location: Harrisburg, PA

In your first compute node you are copying the entire message as well as setting OutputRoot.BLOB which is causing this

(0x03000000):BLOB = X'4d485f4541495f47454e455249435f524f5554455f544f3d414c4c4d485f5359535f4e414d453d504f5752'
(
(0x03000000):UnknownParserName = ''
(0x03000000):BLOB = X'3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822203f3e0d0a3c6561692d6966772d696e746572666163653e0d0a093c'... (data of len 974 truncated)'

I think you will have to copy the message headers only and then set OutputRoot.BLOB.

Cheers,
Back to top
View user's profile Send private message
tosaurav
PostPosted: Fri Jul 13, 2007 10:49 am    Post subject: Reply with quote

Acolyte

Joined: 16 Jan 2007
Posts: 62

Calling complete message because need incoming message too.
Back to top
View user's profile Send private message
wbi_telecom
PostPosted: Fri Jul 13, 2007 11:46 am    Post subject: Reply with quote

Disciple

Joined: 15 Feb 2006
Posts: 188
Location: Harrisburg, PA

In your trace you have 2 elements named BLOB created at the same level (0x03000000) after MQMD. Is that how you want your message ?

Cheers,
Back to top
View user's profile Send private message
tosaurav
PostPosted: Fri Jul 13, 2007 1:28 pm    Post subject: Reply with quote

Acolyte

Joined: 16 Jan 2007
Posts: 62

No that's not what i want - just 1 blob will pass to httprequestnode.
I am confuse with MQInput setting too.Since I want to pass BLOB to httprequest,MQInput property of Message Domain set to what..?? If it is BLOB then how do i alter incoming blob message with additional information to pass to httprequestnode.
Back to top
View user's profile Send private message
wbi_telecom
PostPosted: Fri Jul 13, 2007 1:39 pm    Post subject: Reply with quote

Disciple

Joined: 15 Feb 2006
Posts: 188
Location: Harrisburg, PA

You dont' have to accept the message as BLOB if you want the output to be BLOB. You can put XMLNS domain in your MQInput, manipulate the message in XMLNS (which is a lot easier than doing it in BLOB) and then covert the message into BLOB just before outputting it.
Also you don't have to copy the input message in order to manipulate it, you can only copy the headers, use the data from InputRoot to create the OutputRoot (in whichever domain you want), so what goes out is only the message that you have created in OutputRoot.

Cheers,
Back to top
View user's profile Send private message
mgk
PostPosted: Fri Jul 13, 2007 2:07 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

The body of the message sent in the HTTP Message from the HTTP Request node MUST be the LastChild of the message coming into the request node. You example shows the HTTPRequestHeaders AFTER the "body" so they become the "body" of the message sent on the wire You need to reorder your code to create the tree in the correct order.


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
tosaurav
PostPosted: Mon Jul 16, 2007 5:18 am    Post subject: Reply with quote

Acolyte

Joined: 16 Jan 2007
Posts: 62

New compute 1 code

CALL CopyMessageHeaders();
SET Environment.MyMQMD = InputRoot.MQMD;
SET OutputRoot.HTTPRequestHeader.POST = Target URL;
SET OutputRoot.HTTPRequestHeader."Content-Type" = 'multipart/form-data; boundary=---------------------------7d72771228107e';
DECLARE inputHeaders CHAR '';
SET inputHeaders = 'name1=value name2=value name3=value name4=value name5=value';

DECLARE input CHAR '';
SET input = inputHeaders || InputRoot.XML;

(COMMENT :: InputRoot.XML append just \n\n instead of incoming Complete message)

DECLARE x BLOB;
SET x = CAST(InputRoot.XML AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);

DECLARE y BLOB;
SET y = x || CAST ( inputHeaders AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);

SET OutputRoot.BLOB.BLOB = CAST ( inputHeaders AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);
-- SET OutputRoot.BLOB = CAST (inputMsg AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);
-- SET OutputRoot.BLOB.BLOB = CAST (QRY AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);


Checked in debugger since not complete parametsr are passed, servlet fails to response.

Latest Trace log ::

(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 437
(0x03000000):Transactional = TRUE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2007-07-16 13:06:30.770'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'MQ'
(0x03000000):Topic = NULL
(0x03000000):ContentType = 'multipart/form-data; boundary=---------------------------7d72771228107e'
)
(0x01000000):MQMD = (
(0x03000000):SourceQueue = 'WS.IN'
(0x03000000):Transactional = TRUE
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 437
(0x03000000):Format = 'WSREQHDR'
(0x03000000):Version = 2
(0x03000000):Report = 0
(0x03000000):MsgType = 8
(0x03000000):Expiry = -1
(0x03000000):Feedback = 0
(0x03000000):Priority = 0
(0x03000000):Persistence = 0
(0x03000000):MsgId = X'414d51204e4557514d47522020202020a1c693462015a328'
(0x03000000):CorrelId = X'000000000000000000000000000000000000000000000000'
(0x03000000):BackoutCount = 0
(0x03000000):ReplyToQ = ' '
(0x03000000):ReplyToQMgr = 'NEWQMGR '
(0x03000000):UserIdentifier = 'ssharma1 '
(0x03000000):AccountingToken = X'1601051500000027580e0b473d4c05bb59713a545b020000000000000000000b'
(0x03000000):ApplIdentityData = ' '
(0x03000000):PutApplType = 11
(0x03000000):PutApplName = 'C:\software\ih03\rfhutil.exe'
(0x03000000):PutDate = DATE '2007-07-16'
(0x03000000):PutTime = GMTTIME '13:06:30.770'
(0x03000000):ApplOriginData = ' '
(0x03000000):GroupId = X'000000000000000000000000000000000000000000000000'
(0x03000000):MsgSeqNumber = 1
(0x03000000):Offset = 0
(0x03000000):MsgFlags = 0
(0x03000000):OriginalLength = -1
)
(0x01000000):HTTPRequestHeader = (
(0x03000000):POST = 'http://mwisit.etc.uspto.gov/EaiHubSoftScanWeb/EaiDispatcherServlet'
(0x03000000):Content-Type = 'multipart/form-data; boundary=---------------------------7d72771228107e'
)
(0x01000000):BLOB = (
(0x03000000):BLOB = X'4d485f4541495f47454e455249435f524f5554455f544f3d414c4c204d485f5359535f4e414d453d504f5752204d485f5355424d495353494f4e5f545950453d'... (data of len 125 truncated)'
)
)
Back to top
View user's profile Send private message
wbi_telecom
PostPosted: Mon Jul 16, 2007 6:51 am    Post subject: Reply with quote

Disciple

Joined: 15 Feb 2006
Posts: 188
Location: Harrisburg, PA

Shouldn't you be casting the variable y instead "inputHeaders" of as BLOB in your last ESQL statement ?

SET OutputRoot.BLOB.BLOB = CAST ( y AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);


Cheers,
Back to top
View user's profile Send private message
tosaurav
PostPosted: Mon Jul 16, 2007 7:49 am    Post subject: Reply with quote

Acolyte

Joined: 16 Jan 2007
Posts: 62

It should be but intentionally I passed partial parameters to servlet.Actually incoming XML needs to append with additional parmeters and then as a whole needs to go to Servlet but currently x( varibale to hold incoming XML) is showing \n\n only and hence it appends just blob value of \n\n.As per Servlet requirements, it expect 5 name value parameters and one uploaded file.Out of these, 5 parameters I am hard coded in inputHeaders variable and File content passing to mqInput node as XML so before sending to Servlet I am creating inputHeaders + incoming XML as 1 blob

DECLARE x BLOB;
SET x = CAST(InputRoot.XML AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);


DECLARE y BLOB;
SET y = x || CAST ( inputHeaders AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);
Back to top
View user's profile Send private message
mgk
PostPosted: Mon Jul 16, 2007 8:23 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi,

This is not the way to set the target URL. The docs tell you how to do this properly. All this code does is create a header called POST which I think is not what you want

Code:
SET OutputRoot.HTTPRequestHeader.POST = Target URL;

_________________
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
tosaurav
PostPosted: Mon Jul 16, 2007 9:38 am    Post subject: Reply with quote

Acolyte

Joined: 16 Jan 2007
Posts: 62

Changed the setting of target URL but problem is not there, problem is servlet not getting required parameters.
Debugging the flow for following code show only /n/n whereas expectation is to get complete Incoming XML,once i get this XML along with additional parameters could pass to URL.

DECLARE x BLOB;
SET x = CAST(InputRoot.XML AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);




Compute 1 ESQL

CALL CopyMessageHeaders();
SET Environment.MyMQMD = InputRoot.MQMD;
-- SET OutputRoot.HTTPRequestHeader.POST = 'http://mwisit.etc.uspto.gov/EaiHubSoftScanWeb/EaiDispatcherServlet';
-- SET OutputRoot.HTTPRequestHeader."Content-Type" = 'multipart/form-data; boundary=---------------------------7d72771228107e';


SET OutputRoot.HTTPRequestHeader.POST = '/EaiHubSoftScanWeb/EaiDispatcherServlet';
SET OutputRoot.HTTPRequestHeader.Host = 'mwisit.etc.uspto.gov';
SET OutputLocalEnvironment.Destination.HTTP.RequestURL = 'http://mwisit.etc.uspto.gov/EaiHubSoftScanWeb/EaiDispatcherServlet';

DECLARE inputHeaders CHARACTER;
SET inputHeaders = 'MH_EAI_GENERIC_ROUTE_TO=ALL MH_SYS_NAME=POWR MH_SUBMISSION_TYPE=NEW MH_SUBMISSION_ID=testPOWER MH_APPLICATION_NUMBER=59991015';

DECLARE x BLOB;
SET x = CAST(InputRoot.XML AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);

DECLARE y BLOB;
SET y = x || CAST ( inputHeaders AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);

SET OutputRoot.BLOB.BLOB = CAST ( y AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);


TRACE Log


(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 437
(0x03000000):Transactional = TRUE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2007-07-16 17:32:04.090'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'MQ'
(0x03000000):Topic = NULL
(0x03000000):ContentType = ''
)
(0x01000000):MQMD = (
(0x03000000):SourceQueue = 'WS.IN'
(0x03000000):Transactional = TRUE
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 437
(0x03000000):Format = 'WSREQHDR'
(0x03000000):Version = 2
(0x03000000):Report = 0
(0x03000000):MsgType = 8
(0x03000000):Expiry = -1
(0x03000000):Feedback = 0
(0x03000000):Priority = 0
(0x03000000):Persistence = 0
(0x03000000):MsgId = X'414d51204e4557514d47522020202020a1c693462015a330'
(0x03000000):CorrelId = X'000000000000000000000000000000000000000000000000'
(0x03000000):BackoutCount = 0
(0x03000000):ReplyToQ = ' '
(0x03000000):ReplyToQMgr = 'NEWQMGR '
(0x03000000):UserIdentifier = 'ssharma1 '
(0x03000000):AccountingToken = X'1601051500000027580e0b473d4c05bb59713a545b020000000000000000000b'
(0x03000000):ApplIdentityData = ' '
(0x03000000):PutApplType = 11
(0x03000000):PutApplName = 'C:\software\ih03\rfhutil.exe'
(0x03000000):PutDate = DATE '2007-07-16'
(0x03000000):PutTime = GMTTIME '17:32:04.090'
(0x03000000):ApplOriginData = ' '
(0x03000000):GroupId = X'000000000000000000000000000000000000000000000000'
(0x03000000):MsgSeqNumber = 1
(0x03000000):Offset = 0
(0x03000000):MsgFlags = 0
(0x03000000):OriginalLength = -1
)
(0x01000000):HTTPRequestHeader = (
(0x03000000):POST = '/EaiHubSoftScanWeb/EaiDispatcherServlet'
(0x03000000):Host = 'mwisit.etc.uspto.gov'
)
(0x01000000):BLOB = (
(0x03000000):BLOB = X'0a0a4d485f4541495f47454e455249435f524f5554455f544f3d414c4c204d485f5359535f4e414d453d504f5752204d485f5355424d495353494f4e5f545950'... (data of len 127 truncated)'
)
)
Back to top
View user's profile Send private message
mgk
PostPosted: Mon Jul 16, 2007 11:27 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Your Content-Type header suggests you are trying to produce a MIME message. However, the message you are sending is not MIME. If you really want a MIME message, you could either use the MIME parser, or you could construct a MIME message as a BLOB correctly.
_________________
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
tosaurav
PostPosted: Mon Jul 16, 2007 12:33 pm    Post subject: Reply with quote

Acolyte

Joined: 16 Jan 2007
Posts: 62

Yes wanted to produce MIME message ti pass on to Servlet.Please tell me the step with different nodes property, Message Flow is like

MQInput-Compute1-HTTPRequest-Compute2-MqOutput.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jul 16, 2007 12:35 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

"Use the MIME parser" is pretty specific.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2, 3  Next Page 1 of 3

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » HttpRequestNode
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.