Author |
Message
|
ashritha |
Posted: Thu Aug 27, 2009 6:57 am Post subject: Issue with Attachments in SOAP message |
|
|
Voyager
Joined: 25 Jul 2005 Posts: 85
|
Hi,
As part of developing a message flow, I need to attach some data along with the SOAP request.
My esql statement looks like this
SET OutputRoot.SOAP.Attachment.xmldata.BLOB = CAST(InputRoot.XML.Alldata AS BLOB CCSID 819);
I get a blank value in the output for the above statement. I have tried assigning the InputRoot.XML.Alldata to an Environment Variable and am able to see all the data. But when i try to cast it and assign to as an attachment in the SOAP message, it doesnt work.
I tried the below sample statement and it works perfectly fine
SET OutputRoot.SOAP.Attachment.xmldata.BLOB = CAST('<MessageBrokerXMLData>Test Message</MessageBrokerXMLData>' AS BLOB CCSID 819);
Could someone please help me with the correct esql statement??
I am working on ToolKit 6.1.03 and all my brokers are running on z/os
Thanks in advance. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Aug 27, 2009 7:10 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Do not use the XML Domain at all. For anything.
Use XMLNSC.
What is the Alldata field? is it a single element, like <Alldata>abcd</Alldata>?
If it is not, if it is more like <Alldata><Field>abcde</Field></Alldata> then your code is giving you the correct thing, which is not what you think it is. |
|
Back to top |
|
 |
ashritha |
Posted: Fri Aug 28, 2009 7:37 am Post subject: |
|
|
Voyager
Joined: 25 Jul 2005 Posts: 85
|
Hi,
I tried using the XMLNSC too but had no luck. The below statement atleast gives me some output(ofcourse its garbage) but atleast the CAST statement seems to work.
SET OutputRoot.SOAP.Attachment.xmldata.BLOB = CAST(ASBITSTREAM(InputRoot.XML.Alldata) AS BLOB CCSID 819);
With the above statement, this is what my output looks like
<NS1:Envelope xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/"><NS1:Body><NS2:getValue xmlns:NS2="http://sample.ws.lowrytech.com/"><inputStr1>test1</inputStr1></NS2:getValue></NS1:Body></NS1:Envelope>
--WMBMIME2Boundaryurn_uuid_8AAF874DC4B1BDC0B81251407834925
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <xmldata>
L™…—–¢‰£–™¨m„?£?nLãÙ÷mÆÖÙÔnLãÓÙ÷mÁƒƒ•£anLãÓÙ÷mÁƒƒ•£anLãÓÙ÷mÁƒƒ•£anLãÓÙ÷m䢣Õ?”…anLãÓÙ÷m䢣Õ?”…anLãÓÙ÷m䢣Õ?”…anLãÓÙ÷m䢣ãÉÕanLãÓÙ÷m䢣ãÉÕanLãÓÙ÷m䢣ãÉÕanLãÓÙ÷mÆ–™”Ö„…nÃãÙLaãÓÙ÷mÆ–™”Ö„…nLãÓÙ÷mÆ–™”â£?£¤¢nÕ…¦LaãÓÙ÷mÆ–™”â£?£¤¢nLaãÙ÷mÆÖÙÔnLa™…—–¢‰£–™¨m„?£?n--WMBMIME2Boundaryurn_uuid_8AAF874DC4B1BDC0B81251407834925
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-ID: <resource>
<MessageBrokerPayload></MessageBrokerPayload>
--WMBMIME2Boundaryurn_uuid_8AAF874DC4B1BDC0B81251407834925--
Is there anything else that you could suggest to have this working?
Thanks. |
|
Back to top |
|
 |
ashritha |
Posted: Fri Aug 28, 2009 7:47 am Post subject: |
|
|
Voyager
Joined: 25 Jul 2005 Posts: 85
|
A simple CAST statement also doesnt seem to work
Declare datainfo blob;
Set Environment.Variables.IncomingMessage = InputRoot.XML.AllData;
Set datainfo = CAST(InputRoot.XML.AllData as blob CCSID 1208);
While the first "SET" statement shows me the data being populated in the Environment Variable, I dont see any data being assigned to the variable "datainfo" in the second "SET" statement.
I wonder if there is a different way to execute the CAST statement on z/os brokers.
Can anyone please help? |
|
Back to top |
|
 |
Vitor |
Posted: Fri Aug 28, 2009 7:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
ashritha wrote: |
Is there anything else that you could suggest to have this working? |
You could anwer the question about the structure of the XML document that was asked.
ashritha wrote: |
I tried the below sample statement and it works perfectly fine
SET OutputRoot.SOAP.Attachment.xmldata.BLOB = CAST('<MessageBrokerXMLData>Test Message</MessageBrokerXMLData>' AS BLOB CCSID 819); |
You could also try:
Code: |
SET OutputRoot.SOAP.Attachment.xmldata.BLOB = CAST('<MessageBrokerXMLData><Field1>Test Message</Field1><Field2><Field3>More Test</Field3></Field2></MessageBrokerXMLData>' AS BLOB CCSID 819); |
and see what happens. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
ashritha |
Posted: Fri Aug 28, 2009 8:15 am Post subject: |
|
|
Voyager
Joined: 25 Jul 2005 Posts: 85
|
Hi
I tried executing
Code:
Code: |
SET OutputRoot.SOAP.Attachment.xmldata.BLOB = CAST('<MessageBrokerXMLData><Field1>Test Message</Field1><Field2><Field3>More Test</Field3></Field2></MessageBrokerXMLData>' AS BLOB CCSID 819); |
and works absolutely fine. My incoming XML message is similar to the above one with multiple child elements.
I also tried the below series of statements
SET Environment.Variable.Incomig_Message = InputRoot.XML.Alldata;
Set str = CAST(InputRoot.XML.Alldata as char CCSID 1208);
Set Environment.Variable.stringvalue = str;
Set Environment.Variable.blobvalue = CAST(str as blob);
The outcome of the above statements was
(0x01000000:Name):Variable = (
(0x01000000:Name):Incomig_Message = (
(0x01000000:Name):repository_data = (
(0x01000000:Name):TR7_FORM = (
(0x01000000:Name ):TLR7_Accnt =
(0x01000000:Name ):TLR7_Accnt =
(0x01000000:Name ):TLR7_Accnt =
(0x01000000:Name ):TLR7_CustName =
(0x01000000:Name ):TLR7_CustName =
(0x01000000:Name ):TLR7_CustName =
(0x01000000:Name ):TLR7_CustTIN =
(0x01000000:Name ):TLR7_CustTIN =
(0x01000000:Name ):TLR7_CustTIN =
(0x03000000:NameValue):TLR7_FormCode = 'CTR' (CHARACTER)
(0x03000000:NameValue):TLR7_FormStatus = 'New' (CHARACTER)
)
)
The first statement where the incoming message is set to the environment variable gave the above result, while the rest of the environment variables are not set indicating they are blank. So, the CAST statement isnt really working. Any help in this regard?
Thanks. |
|
Back to top |
|
 |
Luke |
Posted: Fri Aug 28, 2009 8:23 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
Quote: |
and works absolutely fine |
So your CAST to BLOB works fine ... and the conclusion you draw from that is ...
Quote: |
the CAST statement isnt really working |
Perhaps, the kind of conclusion you should be coming to from that test is that the result of your ASBITSTREAM isn't the same as the string you hard-coded in the successful CAST?
Suggest you read the ASBITSTREAM documentation again ... |
|
Back to top |
|
 |
ashritha |
Posted: Fri Aug 28, 2009 8:31 am Post subject: |
|
|
Voyager
Joined: 25 Jul 2005 Posts: 85
|
OK.. i think i have confused all with too much information.
The CAST statement works fine when the source is hardcoded string value
like the statement
Code: |
CAST('<MessageBrokerXMLData><Field1>Test Message</Field1><Field2><Field3>More Test</Field3></Field2></MessageBrokerXMLData>' AS BLOB CCSID 819) |
But it doesnt work when the source is a variable(could be a local variable or environment variable or even the InputRoot). None of the below statements work
Code: |
CAST(InputRoot.XML.Alldata AS BLOB CCSID 819);
CAST(str AS BLOB CCSID 819);
CAST(Environment.Variable.Incoming_Message AS BLOB CCSID 819); |
|
|
Back to top |
|
 |
Luke |
Posted: Fri Aug 28, 2009 8:40 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
I'd assumed when you started using ASBITSTREAM that you'd understood mqjeff's comment:
Quote: |
if it is more like <Alldata><Field>abcde</Field></Alldata> then your code is giving you the correct thing, which is not what you think it is. |
It's crucial that you understand this ... you need to think about what is getting assigned in your SET statements. |
|
Back to top |
|
 |
Luke |
Posted: Fri Aug 28, 2009 9:03 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
To put it another way, consider the difference between this:
<Alldata><Field>abcde</Field></Alldata>
and this:
<Alldata>12345<Field>abcde</Field></Alldata>
If I take the second one and do something like this:
SET intNumber = CAST(InputBody.Alldata AS INTEGER);
What would happen? What would it try and CAST? |
|
Back to top |
|
 |
|