Author |
Message
|
djfox |
Posted: Sat Apr 26, 2008 12:27 pm Post subject: Using localenvironment to save and reuse a message |
|
|
Novice
Joined: 24 Feb 2007 Posts: 12 Location: Maryland
|
I have the following flow:
HTTPInput->Compute1->HTTPRequest->Compute2->HTTPRequest->HTTPReply
The goal is to take the incoming message, save it, and then reuse it for the second HTTPRequest. I've tried:
Compute1:
Set OutputLocalEnvironment.Variables.InMessage = InputRoot;
Compute2:
Set OutputRoot = InputLocalEnvironment.Variables.InMessage;
I've made sure that Compute1 is passing Message and LocalEnvironment, but the flow is not working. The 2nd web service is getting an empty body. Can anyone point me in the right direction?
Foxman |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Apr 26, 2008 4:35 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You need to use the DOMAIN clause of the Create Field to get LocalEnvironment or Environment to hold domain specific information. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
smdavies99 |
Posted: Sat Apr 26, 2008 9:35 pm Post subject: You also need to set the Compute node Properties |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
So that the node passes the right "Folders".
I normally set this to "All".
The default is for the Compute Node to pass JUST the Message Body. So anything saved in other folders such as LocalEnvironment & Environment does not get passed.
In times like this, the trace node is your friend.
Trace for
${Root}
${Environment}
${LocalEnvironment}
as appropriate.
If this is the first time you have used the HTTP set of nodes I recommend using the trace node right after the HHTPInput Node. You will see that the flow starts with a very different set of folders you may have been used to when using MQInput nodes. _________________ 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 |
|
 |
djfox |
Posted: Sun Apr 27, 2008 5:27 am Post subject: Using localenvironment to save and reuse a message |
|
|
Novice
Joined: 24 Feb 2007 Posts: 12 Location: Maryland
|
As suggested, I added trace nodes, set the compute node to pass "all", and attempted to create a new field with a domain of XMLNSC.
CREATE FIELD OutputLocalEnvironment.Variables.InputMessage DOMAIN('XMLNSC');
Unfortunately, this caused a syntax error. So, I change the command to:
CREATE FIRSTCHILD OF OutputLocalEnvironment.Variables.InputMessage DOMAIN('XMLNSC');
and then added the following statement:
SET OutputLocalEnvironment.Variables.InputMessage = InputRoot;
In the compute node prior to the HTTPRequest I used the following statements to reconstuct my original message:
CREATE FIRSTCHILD OF OutputRoot DOMAIN('XMLNSC');
SET OutputRoot = InputLocalEnvironment.Variables.InputMessage;
Looking at the trace file, it appears that the message that is getting sent to the HTTPRequest node is correct. However, when I look at the trace of the message arriving at my Web Service the SOAP message is missing. |
|
Back to top |
|
 |
jefflowrey |
Posted: Sun Apr 27, 2008 6:20 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
SET OutputLocalEnvironment.Variables.InputMessage.XMLNSC = InputRoot.XMLNSC
.....
SET OutputRoot.XMLNSC = InputLocalEnvironment.Variables.InputMessage.XMLNSC; _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
djfox |
Posted: Sun Apr 27, 2008 6:49 am Post subject: Using localenvironment to save and reuse a message |
|
|
Novice
Joined: 24 Feb 2007 Posts: 12 Location: Maryland
|
I changed the esql as suggested and ran the flow. However, now all i see in the trace file before the HTTPReqest is only the XMLNSC. Nothing else wsa there. I changed the flow to add during the save process the following statement:
SET OutputLocalEnvironment.Variables.Properties = InputRoot.Properties;
and in the compute node prior to the HTTPRequest I add the following statement:
SET OutputRoot.Properties = InputLocalEnvironment.Variables.Properties;
What I see in the trace is the following:
===Before HTTPRequest====
(
(0x01000000):XMLNSC = (
(0x01000400):XmlDeclaration = (
(0x03000100):Version = '1.0'
(0x03000100):Encoding = 'UTF-8'
)
(0x01000000)http://schemas.xmlsoap.org/soap/envelope/:CalcDistance = (
(0x03000102)http://www.w3.org/2000/xmlns/:SOAP-ENV = 'http://schemas.xmlsoap.org/soap/envelope/'
(0x03000102)http://www.w3.org/2000/xmlns/:xsi = 'http://www.w3.org/2001/XMLSchema-instance'
(0x03000102)http://www.w3.org/2000/xmlns/:xsd = 'http://www.w3.org/2001/XMLSchema'
(0x03000102)http://www.w3.org/2000/xmlns/:ns2 = 'http://www/mrmnames.net'
(0x01000000)http://schemas.xmlsoap.org/soap/envelope/:Body = (
(0x01000000)tns:SimplePayload1_in:http = (
(0x03000102)http://www.w3.org/2000/xmlns/:ns1 = 'tns:SimplePayload1_in'
(0x03000100)http://schemas.xmlsoap.org/soap/envelope/:encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'
(0x01000000):CalcDistance = (
(0x03000100)http://www.w3.org/2001/XMLSchema-instance:type = 'ns2:CalcDistance'
(0x03000000):Location = 'Testing'
)
)
)
)
)
(0x01000000):Properties = (
(0x03000000):MessageSet = |
|
Back to top |
|
 |
djfox |
Posted: Sun Apr 27, 2008 7:49 am Post subject: Using localenvironment to save and reuse a message |
|
|
Novice
Joined: 24 Feb 2007 Posts: 12 Location: Maryland
|
I made some adjustments to the esql and now the trace shows the message and the properties section correctly. However now the
httprequest node is throwing the following failure:
<?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</faultcode>
<faultstring>BIP3113E: Exception detected in message flow HTTP Input (broker WBRK_BROKER) </faultstring>
<faultactor>HTTP:/Calc_test</faultactor>
<detail>
<text>
Exception. BIP2230E: Error detected whilst processing a message in node 'CalcTestFlow.HTTP Reply'.
: F:\build\S610_P\src\WebServices\WSLibrary\ImbWSReplyNode.cpp: 744:
ImbWSReplyNode::evaluate: ComIbmWSReplyNode: CalcTestFlow#FCMComposite_1_3
BIP5010E: XML Writing Errors have occurred.
: F:\build\S610_P\src\MTI\MTIforBroker\GenXmlParser4\ImbXMLNSCParser.cpp: 673:
ImbXMLNSCParser::refreshBitStreamFromElementsCommon: ComIbmWSInputNode: CalcTestFlow#FCMComposite_1_1
BIP5016E: The item ''CalcDistance'' of type ''folderType'' is not one of the expected types
for a top level element at this point in the XML document.
: F:\build\S610_P\src\MTI\MTIforBroker\GenXmlParser4\ImbXMLNSCWriter.cpp: 877:
ImbXMLNSCWriter::writeMisc: :
</text>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I've validated the XML Message using the toolkit, and I tried sending the message directly to the Web Service. Both show the message as being
valid. The input message is:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:CalcDistance
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>
<ns1:http xmlns:ns1="tns:SimplePayload1_in" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<CalcDistance xmlns:ns2="http://www/mrmnames.net" xsi:type="ns2:HelloWorld">
<Location xsi:type="ns2:DataType">Testing</Location>
</CalcDistance>
</ns1:http>
</SOAP-ENV:Body>
</SOAP-ENV:CalcDistance>
I'm not sure what to do next. Does anyone have any ideas? |
|
Back to top |
|
 |
smdavies99 |
Posted: Sun Apr 27, 2008 10:30 pm Post subject: Is there any reason why you use *LocalEnvironment? |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Rather than just the Environment tree?
The Environment tree stays with the passage of the message through your flow (provided that Compute type nodes have the right properties set).
I always use the Environment tree to save stuff that I need at later points in the flow.
I leave trees like OutputLocalEnvironment for passing things to nodes that need them. For example, dynamically setting a destination queue name just before an MQOutput Node. _________________ 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 |
|
 |
djfox |
Posted: Mon Apr 28, 2008 7:54 am Post subject: Using localenvironment to save and reuse a message |
|
|
Novice
Joined: 24 Feb 2007 Posts: 12 Location: Maryland
|
I finally got it to work (with some help from Hursley). Here's the syntax:
To save the message use:
CREATE FIRSTCHILD OF OutputLocalEnvironment.Variables.InputMessage DOMAIN('XMLNSC') NAME 'XMLNSC';
SET OutputLocalEnvironment.Variables.InputMessage.XMLNSC = InputRoot.XMLNSC;
SET OutputLocalEnvironment.Variables.Properties = InputRoot.Properties;
To restore the message use:
SET OutputRoot.Properties.MessageDomain = 'XMLNSC';
CREATE LASTCHILD OF OutputRoot.XMLNSC DOMAIN('XMLNSC');
SET OutputRoot.XMLNSC = InputLocalEnvironment.Variables.InputMessage.XMLNSC;
CREATE FIELD OutputRoot.Properties;
SET OutputRoot.Properties = InputLocalEnvironment.Variables.Properties;
Enjoy |
|
Back to top |
|
 |
mgk |
Posted: Mon Apr 28, 2008 8:21 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Actually this can be made simpler, as OutputRoot has a special behaviour that means "immediate children" of OutputRoot will automatically create parsers (domains) but only if you use the SET statement. This means you can do:
To restore the message use:
Code: |
SET OutputRoot.Properties = InputLocalEnvironment.Variables.Properties;
SET OutputRoot.Properties.MessageDomain = 'XMLNSC';
SET OutputRoot.XMLNSC = InputLocalEnvironment.Variables.InputMessage.XMLNSC; |
These lines are not needed.
CREATE LASTCHILD OF OutputRoot.XMLNSC DOMAIN('XMLNSC');
CREATE FIELD OutputRoot.Properties; _________________ 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 |
|
 |
djfox |
Posted: Mon Apr 28, 2008 8:54 am Post subject: Using localenvironment to save and reuse a message |
|
|
Novice
Joined: 24 Feb 2007 Posts: 12 Location: Maryland
|
I tried it and it works too.. Thanks for the insight.. |
|
Back to top |
|
 |
|