Author |
Message
|
grammer |
Posted: Wed Mar 05, 2008 7:50 am Post subject: Quick Question |
|
|
 Novice
Joined: 08 Feb 2008 Posts: 16 Location: Canada
|
Flow:
HTTP Input -> ESQL Node -> (trace) -> Java Compute Node
ESQL Code:
Code: |
DECLARE ns NAMESPACE 'http://RPlus.org/VCompUpdate.xsd';
CREATE COMPUTE MODULE R_V_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
-- Output is MQ, so remove HTTP headers
SET OutputRoot.HTTPInputHeader = null;
-- Output is legacy, so set wire format and message name
--SET OutputRoot.Properties.MessageType = 'VCompUpdate';
--SET OutputRoot.Properties.MessageFormat = 'XML1';
-- Add an MQMD, and restore from the original MQInput
CREATE NEXTSIBLING OF OutputRoot.Properties DOMAIN 'XMLNSC';
--SET OutputRoot.XMLNSC = InputRoot.XMLNSC;
SET OutputRoot.XMLNSC = InputRoot.XMLNSC;
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;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
|
Part of the Java Code:
Code: |
// optionally copy message headers
copyMessageHeaders(inMessage, outMessage);
// ----------------------------------------------------------
// Add user code below
MbElement outRoot = outAssembly.getMessage().getRootElement();
MbElement outBody = outRoot.getLastChild().getFirstChild();
String xmlDoc = (String)outBody.getValue();
|
Now I am sending a XML Doc to the HTTP Input
Now i see the data deep in the trace but I just can't fins a way that will allow me to access it.
Trace:
Code: |
==========================================
=========FTest =========
Time is: 9:47
==========================================
+++++++++ROOT
(
(0x01000000):Properties = (
(0x03000000):MessageSet = 'R_To_V_MsgSet'
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2008-03-05 14:46:54.639'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-HTTP'
(0x03000000):Topic = NULL
(0x03000000):ContentType = 'text/xml'
(0x03000000):IdentitySourceType = ''
(0x03000000):IdentitySourceToken = ''
(0x03000000):IdentitySourcePassword = ''
(0x03000000):IdentitySourceIssuedBy = ''
(0x03000000):IdentityMappedType = ''
(0x03000000):IdentityMappedToken = ''
(0x03000000):IdentityMappedPassword = ''
(0x03000000):IdentityMappedIssuedBy = ''
)
(0x01000000):XMLNSC = (
(0x01000400):XmlDeclaration = (
(0x03000100):Version = '1.0'
(0x03000100):Encoding = 'utf-8'
)
(0x01000000):VCompUpdate = (
(0x01000000):company = (
(0x03000000):company_deptID = '1007'
(0x03000000):departmentName = 'FooBar'
(0x03000000):companyAddress = '123 FooBar Lane.'
(0x03000000):totalLiabilityAmount = '10000000'
(0x03000000):validityState = '1'
(0x01000000):insurancePolicy = (
(0x03000000):policyNumber = 'AEH17282'
(0x03000000):expiryDate = '31/12/2007 12:00 AM'
(0x03000000):liabilityAmount = '1000'
(0x03000000):liabilityType = 'Yarr'
)
(0x03000000):companyStatus = 'Good'
(0x03000000):profileActive = '1'
(0x03000000):companyID = '8'
)
)
)
)
+++++++++Local Environment
(
(0x01000000):Destination = (
(0x01000000):HTTP = (
(0x03000000):RequestIdentifier = X'414d5120514d455342503031202020209463cc4720036706'
)
)
)
+++++++++Exceptions
|
|
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 05, 2008 8:06 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You're really confused about what
Code: |
String xmlDoc = (String)outBody.getValue(); |
means.
This isn't even a confusion about ESQL versus Java, it's a confusion about parsers and logical message trees.
Please re-visit your Broker training material.  _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
grammer |
Posted: Wed Mar 05, 2008 8:23 am Post subject: |
|
|
 Novice
Joined: 08 Feb 2008 Posts: 16 Location: Canada
|
jefflowrey wrote: |
You're really confused about what
Code: |
String xmlDoc = (String)outBody.getValue(); |
means.
This isn't even a confusion about ESQL versus Java, it's a confusion about parsers and logical message trees.
|
I have passed message between nodes before using the save java code and it has never given me a problem, but this time it is.
Any specific place i should look for this infomation? |
|
Back to top |
|
 |
grammer |
Posted: Wed Mar 05, 2008 11:07 am Post subject: |
|
|
 Novice
Joined: 08 Feb 2008 Posts: 16 Location: Canada
|
I also tried XPath and to get all elments of the and it just return properties of the msg
Code: |
MbMessage msg = outAssembly.getMessage();
List chapters = (List)msg.evaluateXPath("//*");
|
|
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 05, 2008 11:22 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You certainly did not CopyEntireMessage by using .getValue() on the XMLNSC element followed by setValue().
Again, you appear to be very confused about what a logical message tree is, and what it consists of.
This is fundamental to using Broker, and fundamental to even using ESQL. It's the difference between
Code: |
Set OutputRoot.XMLNSC = InputRoot.XMLNSC |
and
Code: |
Set OutputRoot.XMLNSC Value= FIELDVALUE(InputRoot.XMLNSC) |
Please review your Broker training material. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|