Author |
Message
|
ktg |
Posted: Thu May 25, 2006 12:14 am Post subject: Help needed to create sample webservice |
|
|
Centurion
Joined: 09 Jan 2006 Posts: 138 Location: India
|
Hi All,
I am learning wbimb and dont know much about web services/wsdl. I am trying to create a simple webservice using http nodes. I seached in net and docs. Now, I am able to create a simple web service which can be invoked from an html page and prints "hello world" @ the browser. I changed my html page to accept user name and I want to print "hello <user name>". I am not able to get the user name in the message flow.
I am getting the following error:
Code: |
<?xml version="1.0" encoding="UTF-8" ?>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server.Exception</faultcode>
<faultstring>BIP3113E: Exception detected in message flow HTTP_Input (broker BROKER)</faultstring>
<faultactor>http://localhost:7080/http_nodes</faultactor>
<detail>BIP2230E: Error detected whilst processing a message in node 'http_nodes.Trace'. : F:\build\S500_P\src\DataFlowEngine\ImbTraceNode.cpp: 349: ImbTraceNode::evaluate: ComIbmTraceNode: http_nodes#FCMComposite_1_6 BIP5009E: XML Parsing Errors have occurred. : F:\build\S500_P\src\MTI\MTIforBroker\GenXmlParser2\XmlImbParser.cpp: 394: XmlImbParser::parseFirstChild: : BIP5004E: XML parsing error (Invalid document structure) encountered on line 1 column 1 while parsing element XML. : F:\build\S500_P\src\MTI\MTIforBroker\GenXmlParser2\XmlBrokerAsgardParser.cpp: 815: XmlBrokerAsgardParser::error: :</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope> |
But, am able to get "hello world", if i switch to debug mode. Don't know what is the problem. I know my esql coding should be changed to print "hello <user name>".... but got struck in accessing user name from the html request (?).
Could you please help me.
Platform: win 2K
wbimb version: 5.0.5
Thanks in advance,
Kalpana |
|
Back to top |
|
 |
sourdas2 |
Posted: Thu May 25, 2006 12:39 am Post subject: |
|
|
 Voyager
Joined: 21 Apr 2006 Posts: 90 Location: Kolkata,India
|
Hi,
Please provide the esql code with little more archtechture component and webservice request html code. It seems that it is a SOAP persing error. _________________ Thanks and Warm Regards
Sourav |
|
Back to top |
|
 |
ktg |
Posted: Thu May 25, 2006 1:33 am Post subject: |
|
|
Centurion
Joined: 09 Jan 2006 Posts: 138 Location: India
|
sourdas2 wrote: |
Hi,
Please provide the esql code with little more archtechture component and webservice request html code. It seems that it is a SOAP persing error. |
I am not doing much in esql.
My flow:
http input node -> Compute node -> http reply node
(trace nodes in between)
My esql is:
Code: |
CREATE COMPUTE MODULE web_service_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
SET OutputRoot.Properties.MessageFormat = 'xml';
SET OutputRoot.XML.Greeting = 'Hello World';
-- CALL CopyEntireMessage();
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; |
|
|
Back to top |
|
 |
elvis_gn |
Posted: Thu May 25, 2006 1:48 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi alpan,
I think you are trying to output an XML message when the HTTPReply node is expecting a SOAP message...
I would suggest you copy the entire body and then try to add or change whatever field you want...
remember to use the debugger...it will help lot...
also you will need to know how to use a namespace...u will get sample code here...the trick for namespace messages is that you cannot reference a field directly...
For example: OutputRoot.XML.Greeting would become OutputRoot.XML.ns:Greeting where ns is the namespace for the element Greeting....You can know what the namespace by looking at the input message itself...
so DECLARE your namespace initially and use it to get to the element..and then populate it.
Regards. |
|
Back to top |
|
 |
ktg |
Posted: Thu May 25, 2006 3:41 am Post subject: |
|
|
Centurion
Joined: 09 Jan 2006 Posts: 138 Location: India
|
Thanks for your kind help.
Quote: |
I think you are trying to output an XML message when the HTTPReply node is expecting a SOAP message... |
In debug mode I can see Message>Properties>ReplyProtocol = SOAP-HTTP. So, how to change it!
Quote: |
I would suggest you copy the entire body and then try to add or change whatever field you want...
remember to use the debugger...it will help lot...
also you will need to know how to use a namespace...u will get sample code here...the trick for namespace messages is that you cannot reference a field directly...
For example: OutputRoot.XML.Greeting would become OutputRoot.XML.ns:Greeting where ns is the namespace for the element Greeting....You can know what the namespace by looking at the input message itself...
so DECLARE your namespace initially and use it to get to the element..and then populate it. |
Elvis, I changed my esql code like this:
Code: |
CREATE COMPUTE MODULE web_service_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE ns01 NAMESPACE 'http://<MY IP>:7080/http_nodes' ;
DECLARE ns NAMESPACE 'Greeting' ;
CALL CopyMessageHeaders();
-- SET OutputRoot.Properties.MessageFormat = 'xml';
-- SET OutputRoot.XML.Greeting = 'Hello World';
CALL CopyEntireMessage();
SET OutputRoot.XML.ns:Greeting = InputBody.ns01:Element1;
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; |
My html code is:
<form method="post" action="http://<MY IP>:7080/http_nodes">
<table border="0">
<tr>
<th scope="row">
<label for="account">Account:</label>
</th>
<td>
<input type="text" name="account" id="account">
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Log On" ></td>
</tr>
</table>
</form>
Still it is not working .... I tried debug mode also.... but could not make out why/what is wrong. I am and I was getting an XML parsing exception. What to do now? |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu May 25, 2006 4:15 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Please post a trace of the message received by the HTTPInput node.
Please post a trace of your message before you pass it to the HTTPReply node. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ktg |
Posted: Thu May 25, 2006 4:39 am Post subject: |
|
|
Centurion
Joined: 09 Jan 2006 Posts: 138 Location: India
|
Trace:
Without attaching agent controller am not getting message after compute node:
Code: |
===========================Message Received by the HTTPInput node===========================
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2006-05-25 12:42:28.736'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-HTTP'
(0x03000000):Topic = NULL
)
(0x01000000):HTTPInputHeader = (
(0x03000000):X-Original-HTTP-Command = 'POST http://200.200.100.93:7080/http_nodes HTTP/1.1'
(0x03000000):Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*'
(0x03000000):Accept-Language = 'en-us'
(0x03000000):Content-Type = 'application/x-www-form-urlencoded'
(0x03000000):Accept-Encoding = 'gzip, deflate'
(0x03000000):User-Agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)'
(0x03000000):Host = '200.200.100.93:7080'
(0x03000000):Content-Length = '35'
(0x03000000):Connection = 'Keep-Alive'
(0x03000000):Cache-Control = 'no-cache'
)
(0x01000010):XML = |
Trace with attaching agent controller
Code: |
===========================Message Received by the HTTPInput node===========================
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2006-05-25 12:42:28.736'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-HTTP'
(0x03000000):Topic = NULL
)
(0x01000000):HTTPInputHeader = (
(0x03000000):X-Original-HTTP-Command = 'POST http://200.200.100.93:7080/http_nodes HTTP/1.1'
(0x03000000):Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*'
(0x03000000):Accept-Language = 'en-us'
(0x03000000):Content-Type = 'application/x-www-form-urlencoded'
(0x03000000):Accept-Encoding = 'gzip, deflate'
(0x03000000):User-Agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)'
(0x03000000):Host = '200.200.100.93:7080'
(0x03000000):Content-Length = '35'
(0x03000000):Connection = 'Keep-Alive'
(0x03000000):Cache-Control = 'no-cache'
)
(0x01000010):XML =
)
===========================Message before HTTPReply node===========================
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2006-05-25 12:42:28.736'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-HTTP'
(0x03000000):Topic = NULL
)
(0x01000000):HTTPInputHeader = (
(0x03000000):X-Original-HTTP-Command = 'POST http://200.200.100.93:7080/http_nodes HTTP/1.1'
(0x03000000):Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*'
(0x03000000):Accept-Language = 'en-us'
(0x03000000):Content-Type = 'application/x-www-form-urlencoded'
(0x03000000):Accept-Encoding = 'gzip, deflate'
(0x03000000):User-Agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)'
(0x03000000):Host = '200.200.100.93:7080'
(0x03000000):Content-Length = '35'
(0x03000000):Connection = 'Keep-Alive'
(0x03000000):Cache-Control = 'no-cache'
)
(0x01000010):XML =
) |
Meanwhile, I changed HTML code to
Code: |
CREATE COMPUTE MODULE web_service_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE ns01 NAMESPACE 'http://200.200.100.93:7080/http_nodes' ;
DECLARE ns NAMESPACE 'Greeting' ;
CALL CopyMessageHeaders();
-- SET OutputRoot.Properties.MessageFormat = 'xml';
-- SET OutputRoot.XML.Greeting = 'Hello World';
-- CALL CopyEntireMessage();
SET OutputRoot.XML.ns:Greeting = InputBody.ns01:account;
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; |
( The line SET OutputRoot.XML.ns:Greeting = InputBody.ns01:account ) |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu May 25, 2006 4:47 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So, looking at the trace of the Input message, what value does InputBody.ns01:account have? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ktg |
Posted: Thu May 25, 2006 5:50 am Post subject: |
|
|
Centurion
Joined: 09 Jan 2006 Posts: 138 Location: India
|
What I expected was InputBody.ns01:account will contain user name entered in the html page. But in the trace XML component has nothing (null ?). Sorry, if it sounds stupid. But am not able to make out what/why/how.
Now, I hav changed my http input node Message domain to xmlns (first it was xml) |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu May 25, 2006 6:35 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
That's kind of my point. That the problem isn't with your code, it's with your message - the data you're trying to get simply isn't there.
XMLNS is absolutely what you should have started with - since you're working with SOAP and namespaces. Although you should really consider XMLNSC these days - apparently.
Try setting the HTTPInput to use BLOB, and see what you get. If you still get NO data in the body - then your POST is not sending what you think it's sending where you think it's sending it. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
elvis_gn |
Posted: Thu May 25, 2006 7:53 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi alpan,
I would suggest you get your WebService working first by using the "NetTool"..
Search this forum for it and you'll find the links and enough info on how to use it...
Once the service is fixed then try to get your html page working.
Regards. |
|
Back to top |
|
 |
ktg |
Posted: Fri May 26, 2006 4:59 am Post subject: |
|
|
Centurion
Joined: 09 Jan 2006 Posts: 138 Location: India
|
Thank you people for your help.
I have not worked on xmlns. So, today I was going through docs and did some experiments. Then, I will create a web request message flow which invokes my web service message flow. And then will think of my html code......Once I complete this, I will let u know what happens.
Jefflowrey,
By setting the HTTPInput to use BLOB, am getting some thing in the messgage body.
Code: |
===========================Message Received by the HTTPInput node===========================
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2006-05-25 13:52:19.364'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-HTTP'
(0x03000000):Topic = NULL
)
(0x01000000):HTTPInputHeader = (
(0x03000000):X-Original-HTTP-Command = 'POST http://200.200.100.93:7080/http_nodes HTTP/1.1'
(0x03000000):Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*'
(0x03000000):Accept-Language = 'en-us'
(0x03000000):Content-Type = 'application/x-www-form-urlencoded'
(0x03000000):Accept-Encoding = 'gzip, deflate'
(0x03000000):User-Agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)'
(0x03000000):Host = '200.200.100.93:7080'
(0x03000000):Content-Length = '35'
(0x03000000):Connection = 'Keep-Alive'
(0x03000000):Cache-Control = 'no-cache'
)
(0x01000000):BLOB = (
(0x03000000):UnknownParserName = ''
(0x03000000):BLOB = X'6163636f756e743d6b616c70616e61264c6f672b4f6e3d5375626d69742b5175657279'
)
) |
Elvis,
I will try to use NetTool(Till now I have not used ) and let u ppl know the progress.
"Have a great week end "
-Kalpana |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri May 26, 2006 6:15 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
alpan wrote: |
Jefflowrey,
By setting the HTTPInput to use BLOB, am getting some thing in the messgage body.
Code: |
(0x03000000):BLOB = X'6163636f756e743d6b616c70616e61264c6f672b4f6e3d5375626d69742b5175657279'
)
) |
|
I really need to dig up that perl one-liner I had that would use pack/unpack to turn Broker BLOBS back into readable text...
It's good to see that there is at least some data there. If you can do something to convert this from hex characters back into byte/character data then you can see if the data contains the values you're looking for and is hopefully properly formatted for the parser you're trying to use.
Otherwise, it's an issue where your message flow is expecting different data from what your sending application is producing. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ktg |
Posted: Mon May 29, 2006 5:36 am Post subject: |
|
|
Centurion
Joined: 09 Jan 2006 Posts: 138 Location: India
|
Hi People,
Today, I could not do much progress as some new problems with db and config mgr arised. I will be on leave for next 2 days. So, will revert back after that.....
Jefflowrey,
I wrote a C program to convert hex to text. See is it fine:
Quote: |
#include <stdio.h>
#include <string.h>
int main( int argc, char* argv[]) {
char hexInput[100]="";
char strInput[100]="";
if( argc == 1) {
printf(" Enter your string: \n");
scanf("%s", strInput);
} else {
strcpy( strInput, argv[1] );
}
sscanf(strInput, "%x", hexInput);
printf("%s", hexInput);
}
|
I am not getting required output from this program too. Don't know is it the problem with program itself!
Regards, |
|
Back to top |
|
 |
ktg |
Posted: Mon Jun 05, 2006 2:46 am Post subject: |
|
|
Centurion
Joined: 09 Jan 2006 Posts: 138 Location: India
|
Hi People,
Now I have gone through xmlns docs and have changed my message flow and esql.
Now I have 2 flows: one for request and the other for reply
Request flow:
MQInput -> HTTP request ->Compute ->MqOutput
ESQL:
Code: |
CREATE COMPUTE MODULE http_request_Compute1
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE hh NAMESPACE 'http://www.w3.org/TR/html4/' ;
DECLARE mytag NAMESPACE 'http://www.kalpana.com/' ;
CALL CopyMessageHeaders();
-- SET OutputRoot.XML.Greeting = 'Hello, World';
-- SET OutputRoot.XML.Greeting = NULL;
SET OutputRoot.HTTPResponseHeader = NULL;
SET OutputRoot.MQMD.CorrelId = '1234';
SET OutputRoot.MQMD.ReplyToQ = 'TEST';
SET OutputRoot.XMLNS.mytag:table = InputRoot.XMLNS.mytag:fruit;
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;
END MODULE; |
Reply flow:
HTTP input -> Compute ->HTTP Reply
ESQL:
Code: |
CREATE COMPUTE MODULE web_service_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE hh NAMESPACE 'http://www.w3.org/TR/html4/' ;
DECLARE mytag NAMESPACE 'http://www.kalpana.com/' ;
CALL CopyMessageHeaders();
SET OutputRoot.Properties.MessageFormat = 'xmlns';
SET OutputRoot.XMLNS.mytag:fruit = InputRoot.XMLNS.hh:table.hh:tr.hh:td;
-- SET OutputRoot.XML.Greeting = 'Hello World';
-- CALL CopyEntireMessage();
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; |
My message is
Code: |
<h:table xmlns:h="http://www.w3.org/TR/html4/">
<h:tr>
<h:td>Apples</h:td>
<h:td>contact admin</h:td>
</h:tr>
</h:table> |
And it is working as expected. I am getting in output queue
Code: |
<NS1:table xmlns:NS1="http://www.kalpana.com/">Apples</NS1:table> |
Now, what should I do to put the same message as soap request and how to generate soap reply.
Thanks in advance,
Kalpana |
|
Back to top |
|
 |
|