Author |
Message
|
vmn |
Posted: Tue Jan 27, 2004 4:25 am Post subject: HTTPRequest node to access a WEB Server without XML support |
|
|
Novice
Joined: 10 Nov 2003 Posts: 16 Location: Helsinki, Finland
|
Hi,
I'm wondering if it is possible to access a WEB server using the ordinary GET or POST method with the new HTTPRequest node.
So, I would like to build the required headers for POST and then optional query parameters with ESQL. The query parameters should be built based on a XML structure.
At the moment, there is no XML support on the target platform. This is why the default functionality of the HTTPRequest node does not work.
The other option, of course, is to write a Java node for the work.
Regards,
Veli-Matti |
|
Back to top |
|
 |
mgk |
Posted: Tue Jan 27, 2004 5:27 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
The anwser is yes for POST. GET is not yet supported. I suggest using CSD2 and above of 5.0, but essentially the request node will pass whatever you want to the remote server, as long as you can build it in the remote servers required format. Essentially you can pass the location body of the message to be sent to the remote server to the request node in the form of an ESQL path, such at InputBody.BLOB.BLOB or Environment.MsgRoot etc. It will then bitstream the elements under this and pass this to the remote server as the HTTP Body. To set custom HTTPHEaders, simple set them in a HTTPRequestHeader in a compute node before the Request Node. _________________ 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 |
|
 |
vmn |
Posted: Wed Jan 28, 2004 1:19 am Post subject: |
|
|
Novice
Joined: 10 Nov 2003 Posts: 16 Location: Helsinki, Finland
|
Thanks,
I'm using V5.0 and CSD02.
Do you have any samples or documentation?
This is what I tried. One of the problems is that Content-Length will be reset to zero when the request comes to the remote web server.
This is my Compute note ESQL:
CREATE COMPUTE MODULE CallAMFService_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
CALL CopyEntireMessage();
SET OutputRoot.HTTPRequestHeader.host = 'my_host';
SET OutputRoot.HTTPRequestHeader."Content-Type" = 'text/plain';
SET Environment.MsgRoot = 'time=0&date=0';
SET OutputRoot.HTTPRequestHeader."Content-Length" = LENGTH(Environment.MsgRoot);
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
This the HTTPRequest node definition:
<nodes xmi:type="ComIbmWSRequest.msgnode:FCMComposite_1" xmi:id="FCMComposite_1_3" location="424,261" URLSpecifier="http://my_host_path" useWholeInputMsgAsRequest="false"
requestMsgLocationInTree="Environment.MsgRoot" generateDefaultHttpHeaders="false" replaceInputMsgWithHTTPError="false" messageDomainProperty="XML">
<translation xmi:type="utility:ConstantString" xmi:id="ConstantString_3">
<string>HTTP Request</string>
</translation>
</nodes> |
|
Back to top |
|
 |
mgk |
Posted: Wed Jan 28, 2004 4:46 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
OK, a couple of things here.
I was too quick to type Environment.MsgRoot, as if you set this to something in a compute note, it is not owned by a parser, so cannot be turned into a bitstream, so sorry about that.
Really you should (if you are trying to send a BLOB for example) create the tree in the environment using CREATE with a DOMAIN of BLOB to cause a parser to be associated with the data you place in it, using ASBITSTREAM to bitstream your data into your the blob parser. Or you could use the MRM to model your data instead if you wish.
Essentially the rest of what you posted looks ok, assuming that you use a parser as above, except your setting of Content-Length. Even if you set Content-Length as you are doing, we reset it for you to what we actually send, as it is very hard in general for you to get the correct value. In your case it is being set to zero, as zero is the number of bytes we are actually sending (or not sending in this case).
Just for the record, you can use GenerateDefaultHeaders in the Request node, but still provide a HttpRequestHeader from a compute node, and this tells the request node to overlay the values you specify in the request header over any generated ones, so you only have to provide the settings you actually want to change in the request header, assuming the other defaults are ok for you. Content-Length is the only header you cannot set yourself.
Cheers, _________________ 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 |
|
 |
vmn |
Posted: Wed Jan 28, 2004 4:49 am Post subject: |
|
|
Novice
Joined: 10 Nov 2003 Posts: 16 Location: Helsinki, Finland
|
Thanks,
Are these things documented somewhere?
Veli-Matti |
|
Back to top |
|
 |
mgk |
Posted: Wed Jan 28, 2004 6:24 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
The documentation was updated in the Eclipse online-help for CSD2, but samples etc are something that we know we need and we are thinking about... _________________ 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 |
|
 |
rsalazar |
Posted: Wed Jan 28, 2004 8:40 am Post subject: |
|
|
Newbie
Joined: 23 Jan 2004 Posts: 5
|
Along the same subject, I'm want to call a webservice that is on the localhost but keep getting a 401 (Access Denied) from the server. I've set the request header in ESQL and allowed the request node create the header and keep seeing the 401. The webservice is available and callable from IE.Any thoughts as to my problem?
TIA,
Robert |
|
Back to top |
|
 |
mgk |
Posted: Wed Jan 28, 2004 9:37 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi Robert,
Can you place a Trace node on the Error terminal of the HTTP Request Node and trace ${Root} and post the contents of the HTTPRequestHeader and the reply from the server here so I can take a look as your issue please.
Cheers _________________ 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 |
|
 |
rsalazar |
Posted: Wed Jan 28, 2004 10:00 am Post subject: |
|
|
Newbie
Joined: 23 Jan 2004 Posts: 5
|
Thanks for the quick reply. Here is the trace you requested. This is just a simple web service to add 2 numbers that is running on my local machine under IIS. I through in the port to see I would get a different behavior but the result was the same.
Trace2
Printing root...
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 0
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2004-01-28 16:30:30.950'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'MQ'
(0x03000000):Topic = NULL
)
(0x01000000):HTTPRequestHeader = (
(0x03000000):Content-Length = '0'
(0x03000000):Host = 'localhost:80/MyWebService1/Service1.asmx'
(0x03000000):SOAPAction = '"http://tempuri.org/Add"'
(0x03000000):Content-Type = 'text/xml; charset=utf-8'
)
(0x01000000):HTTPResponseHeader = (
(0x03000000):X-Original-HTTP-Status-Line = 'HTTP/1.1 401 Access Denied'
(0x03000000):X-Original-HTTP-Status-Code = 401
(0x03000000):Server = 'Microsoft-IIS/5.0'
(0x03000000):Date = 'Wed, 28 Jan 2004 16:31:36 GMT'
(0x03000000):WWW-Authenticate = 'Negotiate, NTLM'
(0x03000000):Content-Length = '4431'
(0x03000000):Content-Type = 'text/html'
)
(0x01000000):BLOB = (
(0x03000000):UnknownParserName = ''
(0x03000000):BLOB
Cheers,
Robert |
|
Back to top |
|
 |
mgk |
Posted: Wed Jan 28, 2004 12:35 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi Robert,
The reason for your problem is the header:
WWW-Authenticate = 'Negotiate, NTLM'
This is basically IIS saying that it requires you to authenticate (login) and we don't support logins. Try turning this off is IIS settings... _________________ 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 |
|
 |
rsalazar |
Posted: Mon Feb 02, 2004 2:30 pm Post subject: |
|
|
Newbie
Joined: 23 Jan 2004 Posts: 5
|
mgk,
I'm on to the next step in my task list. I'm attempting to make a SOAP RPC webservice call and the server keeps responding with a 500 Server Error. This seems to be a catch all error when the server can't classifiy the error that has occured. Below are some traces that might be helpful. I'm using the soap library that is included with WBIMB download IA81v2. The webservice resides on a Websphere App Server within our environment. I do get a positive response when calling the webservice via two other methods so I know it's working.
Any thoughts would be greatly appreciated.
TIA,
Robert
Root Trace
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 437
(0x03000000):Transactional = TRUE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2004-02-02 22:07:09.960'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'MQ'
(0x03000000):Topic = NULL
)
(0x01000000):MQMD = (
(0x03000000):SourceQueue = 'WS.IN'
(0x03000000):Transactional = TRUE
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 437
(0x03000000):Version = 2
(0x03000000):Report = 0
(0x03000000):MsgType = 8
(0x03000000):Expiry = -1
(0x03000000):Feedback = 0
(0x03000000):Priority = 0
(0x03000000):Persistence = 0
(0x03000000):MsgId = X'414d51205742524b2020202020202020be691e4020005901'
(0x03000000):CorrelId = X'000000000000000000000000000000000000000000000000'
(0x03000000):BackoutCount = 0
(0x03000000):ReplyToQ = ' '
(0x03000000):ReplyToQMgr = 'WBRK '
(0x03000000):UserIdentifier = 'userid '
(0x03000000):AccountingToken = X'160105150000006c4d501d3f3e6f211e635e59ea03000000000000000000000b'
(0x03000000):ApplIdentityData = ' '
(0x03000000):PutApplType = 11
(0x03000000):PutApplName = '\MQPubClient\MQPutClient.exe'
(0x03000000):PutDate = DATE '2004-02-02'
(0x03000000):PutTime = GMTTIME '22:07:09.960'
(0x03000000):ApplOriginData = ' '
(0x03000000):GroupId = X'000000000000000000000000000000000000000000000000'
(0x03000000):MsgSeqNumber = 1
(0x03000000):Offset = 0
(0x03000000):MsgFlags = 0
(0x03000000):OriginalLength = -1
(0x03000000):Format = ''
)
(0x01000010):XMLNS = (
(0x01000000)http://schemas.xmlsoap.org/soap/envelope/:Envelope = (
(0x07000012)XMLNS:soapenv = 'http://schemas.xmlsoap.org/soap/envelope/'
(0x01000000)http://schemas.xmlsoap.org/soap/envelope/:Body = (
(0x01000000)http://localhost/com.eds.XXXX.ejb.XXXXFacadeEJB:executeXXXXDeposit = (
(0x01000000):AccountNumber = (
(0x02000000): = 'GJ004809'
)
(0x01000000):MemberNumber = (
(0x02000000): = 'RAS-DEMO'
)
(0x01000000):Mileage = (
(0x02000000): = 333
)
(0x01000000):DestinationCode = (
(0x02000000): = 'BON'
)
(0x01000000):TravelDate = (
(0x02000000): = 20040115
)
)
)
)
)
(0x01000000):HTTPRequestHeader = (
(0x03000000):X-Original-HTTP-URL = 'http://hostname/XXXXWeb/servlet/rpcrouter'
(0x03000000):Content-Type = 'text/xml; charset=utf-8'
(0x03000000):Content-Length = ''
(0x03000000):SOAPAction = ''
)
)
################################
Environment Trace
(
(0x01000000):SOAP = (
(0x01000000):Params = (
(0x01000000):ValidHdrs =
(0x01000000):ValidOps = (
(0x03000000):Operations = 'executeXXXXDeposit'
)
(0x03000000):ServiceType = 'RPC'
(0x03000000):Namespace = 'http://localhost/com.eds.XXXX.ejb.XXXXFacadeEJB'
(0x03000000):Operation = 'executeXXXXDeposit'
)
(0x01000000):Service = (
(0x03000000):ServiceName = ''
(0x03000000):ServiceRole = 'Intermediary'
(0x03000000):ServiceActor = ''
)
(0x01000000):ValidOps = (
(0x01000000):Operations =
)
)
)
################################
Trace Error
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 0
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2004-02-02 22:05:35.875'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'MQ'
(0x03000000):Topic = NULL
)
(0x01000000):HTTPRequestHeader = (
(0x03000000):X-Original-HTTP-URL = 'http://hostname/XXXXWeb/servlet/rpcrouter'
(0x03000000):Content-Type = 'text/xml; charset=utf-8'
(0x03000000):Content-Length = 479
(0x03000000):SOAPAction = ''
)
(0x01000000):HTTPResponseHeader = (
(0x03000000):X-Original-HTTP-Status-Line = 'HTTP/1.1 500 Internal Server Error'
(0x03000000):X-Original-HTTP-Status-Code = 500
(0x03000000):Date = 'Mon, 02 Feb 2004 22:06:38 GMT'
(0x03000000):Server = 'IBM_HTTP_SERVER/1.3.26 Apache/1.3.26 (Win32)'
(0x03000000):Set-Cookie = 'JSESSIONID=0000YMUSZ1DFLLIGFC5DS0S1FTA:-1;Path=/'
(0x03000000):Cache-Control = 'no-cache="set-cookie,set-cookie2"'
(0x03000000):Expires = 'Thu, 01 Dec 1994 16:00:00 GMT'
(0x03000000):Content-Length = '544'
(0x03000000):Connection = 'close'
(0x03000000):Content-Type = 'text/xml; charset=utf-8'
(0x03000000):Content-Language = 'en-US'
)
(0x01000000):BLOB = (
(0x03000000):UnknownParserName = ''
(0x03000000):BLOB = |
|
Back to top |
|
 |
mgk |
Posted: Tue Feb 03, 2004 1:47 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi,
You don't mention the properties of the HTTPRequestNode or exactly where in your message flow the trace of Root is taken (before or after your HTTPRequestNode) or Which version/CSD exactly you are using. Can you check you are on CSD2 level please? _________________ 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 |
|
 |
rsalazar |
Posted: Tue Feb 03, 2004 7:00 am Post subject: |
|
|
Newbie
Joined: 23 Jan 2004 Posts: 5
|
Good day and thank you,
HTTPRequest node properties are as follows:
Basic
Web Service URL: http://hostname/XXXXWeb/servlet/rpcrouter
Request Timeout: 120
HTTP Proxy Location: blank
Follow HTTP redirection: checked
Advanced
Use whole input message: unchecked
Request message location: InputRoot.XMLNS
Replace input message: checked
Response message: blank
Generate Headers: unchecked
Error
all defaults taken
Default
Message Domain: XMLNS
all the rest of the fields are blank
Validation
all defaults taken
Description
all fields are blank
I also tried this with the Generate Headers checked and got the same results. I have also tried this with the proxy enabled and disabled from Windows->Preferences->Internet in the Toolkit and got the same results.
The root and environment trace are immediately before the HTTPRequest node. The error trace is from the error connector of the HTTPRequest node. I'm at CSD 2 of WBIMB. From the Tookit about box I see Version 5.0.2 Build ID 20031009_1516
Thanks again for your help,
Robert |
|
Back to top |
|
 |
mgk |
Posted: Fri Feb 06, 2004 2:23 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi Robert,
Could you please post the bitstream that the blob parser has please
0x01000000):BLOB = (
(0x03000000):UnknownParserName = ''
(0x03000000):BLOB = ??????
I want to see the content returned from the remote server, the response header says there should be 4431 bytes in the response:
(0x03000000):Content-Length = '4431'
Cheers _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Last edited by mgk on Thu Aug 18, 2005 4:07 am; edited 1 time in total |
|
Back to top |
|
 |
JustFriend |
Posted: Sun Aug 14, 2005 10:18 pm Post subject: |
|
|
Novice
Joined: 30 May 2005 Posts: 22
|
Dear All,
My Flow is similar to the your flows:
MQInput >> Compute1 >> HTTPRequest >> Compute2 >> HTTPOutput
Can you please post your ESQL to be used in the Compute-Nodes before and after the HTTPRequest node and the properties to be set in the HTTPRequest Node for making a HTTP POST webservice request
Please....
You can find in the below link the query I have posted recently:
http://www.mqseries.net/phpBB2/viewtopic.php?t=23737 |
|
Back to top |
|
 |
|