Author |
Message
|
skol |
Posted: Fri Dec 29, 2006 1:54 pm Post subject: BLOB response from HTTPRequest node |
|
|
Apprentice
Joined: 05 Apr 2006 Posts: 38
|
After sending a successful web service request from a V6 flow, when the remote web service returns a SOAP fault and an HTTP 500 to the HTTPRequest node, the node returns a BLOB that has the SOAP fault XML in it. I've been unable to find doc that shows how to map the contents of this BLOB into the "Envelope" message definition that comes with the SOAP support and knows how to parse a fault. The broker web service example doesn't bother with error checking, so it was no help. Can anyone point me at doc or a sample of how in ESQL to get a SOAP fault from the BLOB so I can use the information in the fault fields?
Thanks in advance for any help... _________________ Steve |
|
Back to top |
|
 |
mvarghese |
Posted: Sat Dec 30, 2006 8:18 pm Post subject: |
|
|
Centurion
Joined: 27 Sep 2006 Posts: 141
|
I am using HTTP request node , the response coming in BLOB format.
U have to set the default setting of HTTP request node is BLOB.
The retrival of blob..is doing by below coding
SET OutputLocalEnvironment.Variables.MessageContent = CAST(InputRoot.BLOB.BLOB AS CHARACTER CCSID OutputRoot.MQMD.CodedCharSetId);
--Storing HTTP Reponse Code to put in Final Output Response
SET Environment.Variables.ResponseCode= OutputLocalEnvironment.Variables.MessageContent;
Hope that u r looking soem thing like this... _________________ Jain Varghese |
|
Back to top |
|
 |
skol |
Posted: Tue Jan 02, 2007 6:12 am Post subject: |
|
|
Apprentice
Joined: 05 Apr 2006 Posts: 38
|
Thanks. After casting the BLOB though, I'm trying to get the Envelope message definition to parse the XML. I tried this code snippet:
SET OutputRoot.Properties.MessageType = 'Envelope';
SET OutputRoot.Properties.MessageFormat = 'XML1';
SET OutputRoot.XMLNSC = CAST(InputRoot.BLOB.BLOB AS CHARACTER CCSID OutputRoot.MQMD.CodedCharSetId);
SET faultString = OutputRoot.XMLNSC.Envelope.Body.Fault.faultstring;
But the faultString variable gets nothing set. And the debugger shows the contents of OutputRoot.XMLNSC equal to the string value from the blob containing the SOAP envelope with the fault in it. The message set ID matches the one that defines the SOAP envelope, so at least it has the right message set defined. But my attempt at setting the MessageType and MessageFormat to get it to parse the Fault into individual XML fields defined by the SOAP Envelope message definition didn't work.
If you can point me in the right direction on this I'd appreciate it... _________________ Steve |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jan 02, 2007 6:21 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
CAST does not CREATE FIELDs, nor does it have a PARSE option. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
skol |
Posted: Tue Jan 02, 2007 6:24 am Post subject: |
|
|
Apprentice
Joined: 05 Apr 2006 Posts: 38
|
So is there a way to get it to parse the XML in the blob into the standard Envelope message definition? I've floundered around trying multiple things but obviously don't understand ESQL enough to get it to do what I'm after.... _________________ Steve |
|
Back to top |
|
 |
skol |
Posted: Tue Jan 02, 2007 6:29 am Post subject: |
|
|
Apprentice
Joined: 05 Apr 2006 Posts: 38
|
Will this sort of thing work:
CREATE LASTCHILD OF outputRoot PARSE(castBlobContent); _________________ Steve |
|
Back to top |
|
 |
skol |
Posted: Tue Jan 02, 2007 6:35 am Post subject: |
|
|
Apprentice
Joined: 05 Apr 2006 Posts: 38
|
Nope, that doesn't work either, I get this exception text, so I'm obviously not getting it to understand that my string is XML:
String is not of correct form for byte array. Must consist of only 0..9,a..f,A..Z
Thanks for the PARSE hint, I'll keep looking around and trying stuff... _________________ Steve |
|
Back to top |
|
 |
skol |
Posted: Tue Jan 02, 2007 6:58 am Post subject: |
|
|
Apprentice
Joined: 05 Apr 2006 Posts: 38
|
Finally got this to work - deleted the CAST and intermediate CHARACTER variable, and used this instead:
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC')
PARSE(InputRoot.BLOB.BLOB
ENCODING InputRoot.Properties.Encoding
CCSID InputRoot.Properties.CodedCharSetId
FORMAT 'XMLNSC_OPAQUE'
TYPE '{http://schemas.xmlsoap.org/soap/envelope/}Envelope'); _________________ Steve |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jan 02, 2007 12:32 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
That code is incorrect. This is what the docs say ( and they are correct )
Quote: |
Opaque parsing of XML elements is only available in the XMLNS domain; and the control over how this is specified is subject to change in later releases. |
If you really need the opaque parsing, you should change your code to
Code: |
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNS')
PARSE(InputRoot.BLOB.BLOB
ENCODING InputRoot.Properties.Encoding
CCSID InputRoot.Properties.CodedCharSetId
FORMAT 'XMLNS_OPAQUE'
TYPE '{http://schemas.xmlsoap.org/soap/envelope/}Envelope'); |
otherwise change it to
Code: |
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC')
PARSE(InputRoot.BLOB.BLOB
ENCODING InputRoot.Properties.Encoding
CCSID InputRoot.Properties.CodedCharSetId; |
|
|
Back to top |
|
 |
skol |
Posted: Tue Jan 02, 2007 1:32 pm Post subject: |
|
|
Apprentice
Joined: 05 Apr 2006 Posts: 38
|
Interesting, it sounds incorrect according to the doc you posted, but it works fine for me. I've sent 50 or so messages through this since this morning with no problems. Without the TYPE argument, what's going to force it to use the right namespace and message definition stuff for Envelope? I override the parser and message definition in ESQL before doing the create, but as near as I can tell the create wasn't using those, it's relying on the create clauses.
This is the working code snippet:
SET OutputRoot.Properties.MessageType = 'Envelope';
SET OutputRoot.Properties.MessageFormat = 'XML1';
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC')
PARSE(InputRoot.BLOB.BLOB
ENCODING InputRoot.Properties.Encoding
CCSID InputRoot.Properties.CodedCharSetId
FORMAT 'XMLNSC_OPAQUE'
TYPE '{http://schemas.xmlsoap.org/soap/envelope/}Envelope');
SET OutputRoot.BLOB = NULL;
Are you suggesting this instead?
SET OutputRoot.Properties.MessageType = 'Envelope';
SET OutputRoot.Properties.MessageFormat = 'XML1';
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC')
PARSE(InputRoot.BLOB.BLOB
ENCODING InputRoot.Properties.Encoding
CCSID InputRoot.Properties.CodedCharSetId
TYPE '{http://schemas.xmlsoap.org/soap/envelope/}Envelope');
SET OutputRoot.BLOB = NULL;
or do you think the two SET statements are sufficient to get it to use the correct SOAP Envelope message definition?
I'd also be interested whether you have more detail on what is incorrect since it works - what does the CREATE do when it sees 'XMLNSC_OPAQUE'?
I know the above is using the soap namespace in the TYPE clause, because I have to do this to access the content:
DECLARE soap NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
..
SET xx = OutputRoot.XMLNSC.soap:Envelope.soap:Body.soap:Fault.detail;
This SET works with the namespace qualifiers, fails without them.
Thanks for the help... _________________ Steve |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jan 03, 2007 12:20 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Hi Steve,
One or two issues to clear up here. I presume you are new to message broker.
- The MRM domain is the only domain which uses messageSet, messageType and messageFormat. ( I know that XMLNS finds a use for messageFormat when it is doing opaque parsing. That is unique ).
- Domains XMLNSC, XMLNS and XML never consult a message set at runtime. They parse the input XML document and create a message tree using only the information in the input bitstream. It is still good practice to create and use a message set in the tooling - it allows use of the mapping node and allows the ESQL editor to flag up incorrect field references.
- When you execute a CREATE...PARSE statement, all of the parser's settings are taken from the CREATE statement. So setting MessageType and Message Format before a CREATE...PARSE statement is pointless ( and potentially harmful, because it might affect serialization of the message tree later on in the flow ).
Just for completeness, here are answers to all of your questions:
Quote: |
Are you suggesting this instead? |
No, my suggestions remains exactly as stated in my previous post.
Quote: |
or do you think the two SET statements are sufficient to get it to use the correct SOAP Envelope message definition? |
The two SET statements are redundant, as explained above. The XMLNSC domain ( and any other non-validating XML parser for that matter ) can easily parse an XML message without reference to a schema.
Quote: |
I'd also be interested whether you have more detail on what is incorrect since it works - what does the CREATE do when it sees 'XMLNSC_OPAQUE'? |
Nothing. I'm a little disappointed that you did not get a warning in the task list actually. The XMLNSC parser simply does not contain any code to do opaque parsing.
Quote: |
I know the above is using the soap namespace in the TYPE clause, because I have to do this to access the content: |
False deduction - if you attempt to prove that statement you will realise that it is very shaky indeed. Please read the docs about XMLNS_OPAQUE. You cannot solve programming problems by randonmly applying settings. |
|
Back to top |
|
 |
|