Author |
Message
|
tosaurav |
Posted: Wed Jul 18, 2007 7:56 am Post subject: |
|
|
Acolyte
Joined: 16 Jan 2007 Posts: 62
|
Now I am using following ESQL
CALL CopyMessageHeaders();
DECLARE boundary CHARACTER 'abcd';
SET Environment.MyMQMD = InputRoot.MQMD;
SET OutputRoot.HTTPRequestHeader.POST = 'http://localhost:9365/EaiHubSoftScanWeb/EaiDispatcherServlet';
SET OutputRoot.HTTPRequestHeader."Content-Type" = 'multipart/form-data; boundary=' || boundary;
SET OutputRoot.Properties.ContentType = 'multipart/form-data; boundary=' || boundary;
CREATE FIELD OutputRoot.MIME.Parts;
CREATE LASTCHILD OF OutputRoot.MIME.Parts TYPE Name NAME 'Part';
-- SET OutputRoot.MIME."Parts"."Part"[1]."Content-Disposition" = 'form-data';
DECLARE P1 REFERENCE TO OutputRoot.MIME.Parts.Part[1];
SET P1."Content-Disposition" = 'form-data';
SET P1."name" = 'MH_SYS_NAME';
CREATE LASTCHILD OF P1 TYPE Name NAME 'Data';
CREATE LASTCHILD OF P1.Data DOMAIN('BLOB') VALUE 'POWR';
DECLARE part1Data BLOB ASBITSTREAM(InputRoot.XML, InputProperties.Encoding, InputProperties.CodedCharSetId);
CREATE LASTCHILD OF OutputRoot.MIME.Parts TYPE Name NAME 'Part';
DECLARE P2 REFERENCE TO OutputRoot.MIME.Parts.Part[2];
-- SET P2."Content-Type" = 'text/xml';
SET P2."Content-Disposition" = 'form-data';
SET P2."name" = 'uploadMe';
CREATE LASTCHILD OF P2 TYPE Name NAME 'Data';
CREATE LASTCHILD OF P2.Data DOMAIN('BLOB') PARSE(part1Data);
and TCP-IP passing shows
--abcd
Content-Disposition: form-data
name: MH_SYS_NAME
--abcd
Content-Disposition: form-data
name: uploadMe
<?xml version="1.0" encoding="UTF-8" ?>
<INVOICE>
<NO/>
<DATE/>
</INVOICE>
--abcd--
It doesnt display data for first parameter also on servlet side nothing.Am I still doing wrong? |
|
Back to top |
|
 |
tosaurav |
Posted: Wed Jul 18, 2007 4:49 pm Post subject: |
|
|
Acolyte
Joined: 16 Jan 2007 Posts: 62
|
Finally managed to pass required parameter to Servlet.
Thanks to all participants.
Lasts hurdle :: Response is BLOB data which needs to move to mqoutput.Doing following processing but getting exception :Message doesnot contain data.
BEGIN
CALL CopyMessageHeaders();
SET OutputRoot.MQMD = Environment.MYMQMD;
SET OutputRoot.HTTPResponseHeader = null;
SET OutputRoot.HTTPRequestHeader = null;
-- DECLARE MSG CHAR '';
-- SET MSG = CAST (InputRoot.BLOB.BLOB AS CHAR CCSID InputRoot.MQMD.CodedCharSetId);
-- SET OutputRoot.BLOB = CAST (MSG AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);
SET OutputRoot.BLOB.BLOB = CAST (InputRoot.BLOB.BLOB AS BLOB CCSID InputRoot.MQMD.CodedCharSetId);
RETURN TRUE; |
|
Back to top |
|
 |
dilse |
Posted: Thu Jul 19, 2007 9:55 am Post subject: |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
Quote: |
SET OutputRoot.BLOB.BLOB = CAST (InputRoot.BLOB.BLOB AS BLOB CCSID InputRoot.MQMD.CodedCharSetId); |
You do not have to CAST it for copying from Input tree to output tree?
Also try using the Domain 'MQMD' when you are trying to store input root 'MQMD' in the Environment tree. |
|
Back to top |
|
 |
tip.1020 |
Posted: Fri Oct 26, 2012 3:10 am Post subject: |
|
|
Novice
Joined: 25 Oct 2012 Posts: 10
|
Try following piece of code(I am sending XML in first part and then rest data/attachments in remaining parts):-
SET OutputRoot.Properties.Domain = 'MIME';
SET OutputRoot.Properties.ContentType = 'multipart/form-data; boundary=' || '"'|| Environment.MIMEBoundary||'"';
SET OutputRoot.HTTPRequestHeader."X-Original-HTTP-URL" =Environment.URL;
SET OutputRoot.HTTPRequestHeader.Accept = 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/pdf, */*';
SET OutputRoot.HTTPRequestHeader."Content-Type" = 'multipart/form-data; boundary=' || '"'|| Environment.MIMEBoundary||'"';
DECLARE part1Data BLOB ASBITSTREAM(Environment.OriginalXML, InputProperties.Encoding, InputProperties.CodedCharSetId);
DECLARE part2Data BLOB CAST(Environment.TMSTMP AS BLOB CCSID InputRoot.Properties.CodedCharSetId);
CREATE FIELD OutputRoot.MIME TYPE Name;
DECLARE M REFERENCE TO OutputRoot.MIME;
CREATE LASTCHILD OF M TYPE Name NAME 'Parts';
CREATE LASTCHILD OF M.Parts TYPE Name NAME 'Part';
--XML in part1
DECLARE P1 REFERENCE TO M.Parts.Part[1];
CREATE FIELD P1."Content-Disposition" TYPE NameValue VALUE 'form-data; name="abc"; filename='||'"'||Environment.File||'"';
CREATE FIELD P1."Content-Type" TYPE NameValue VALUE 'application/xml';
CREATE LASTCHILD OF P1 TYPE Name NAME 'Data';
CREATE LASTCHILD OF P1.Data DOMAIN('BLOB') PARSE(part1Data);
--the attached files are added starting in part2
DECLARE x Int;
DECLARE imgCnt Int;
DECLARE z Int;
SET imgCnt = 6 ; --number of images
SET x = 1;
SET z = 2;
DECLARE refPart REFERENCE TO M.Parts;
DECLARE P2 REFERENCE TO refPart;
WHILE (x <= imgCnt ) DO
CREATE LASTCHILD OF refPart TYPE Name NAME 'Part';
MOVE P2 TO refPart.Part[<];
CREATE FIELD P2."Content-Disposition" TYPE NameValue VALUE 'form-data; name='||'"file' || CAST ((x + 1) AS CHAR) || '"; filename='||'"'||Environment.FileName||'"';
CREATE FIELD P2."Content-Type" TYPE NameValue VALUE 'application/octet-stream';
CREATE LASTCHILD OF P2 TYPE Name NAME 'Data';
SET partData = Environment.ImgFile[x];
CREATE LASTCHILD OF P2.Data DOMAIN('BLOB') PARSE(partData);
SET x = x + 1;
SET z = z + 1;
END WHILE;
-- To add some informative data after the last part from above
CREATE LASTCHILD OF M.Parts TYPE Name NAME 'Part';
DECLARE P3 REFERENCE TO M.Parts.Part[PartCtr];
CREATE FIELD P3."Content-Disposition" TYPE NameValue VALUE 'form-data; name="TimeStamp" ';
CREATE LASTCHILD OF P3 TYPE Name NAME 'Data';
CREATE LASTCHILD OF P3.Data DOMAIN('BLOB') PARSE(part2Data);
Hope this helps....
 |
|
Back to top |
|
 |
nathanw |
Posted: Fri Oct 26, 2012 3:13 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
I think in the 5 years or so since the last post that they have solved this _________________ Who is General Failure and why is he reading my hard drive?
Artificial Intelligence stands no chance against Natural Stupidity.
Only the User Trace Speaks The Truth  |
|
Back to top |
|
 |
tip.1020 |
Posted: Mon Oct 29, 2012 2:37 am Post subject: |
|
|
Novice
Joined: 25 Oct 2012 Posts: 10
|
nathanw wrote: |
I think in the 5 years or so since the last post that they have solved this |
If so can anyone share us the method/code regarding how they resolved this issue.Thanks in advance..  |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Oct 29, 2012 3:31 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Start a new post. Explain *your* issue, clearly and in detail.
Unless you've already started three or four posts on it... |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Oct 29, 2012 3:32 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
tip.1020 wrote: |
nathanw wrote: |
I think in the 5 years or so since the last post that they have solved this |
If so can anyone share us the method/code regarding how they resolved this issue.Thanks in advance..  |
I thought you had solved it? your post start with
Quote: |
Try following piece of code |
so are you saying that the code you posted does not solve the problem? If not then why did you post an incorrect solution?
Also, please use 'code' tags around any code you post.
for example
Code: |
some code goes here
|
_________________ 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 |
|
 |
tip.1020 |
Posted: Mon Oct 29, 2012 10:42 pm Post subject: |
|
|
Novice
Joined: 25 Oct 2012 Posts: 10
|
smdavies99 wrote: |
tip.1020 wrote: |
nathanw wrote: |
I think in the 5 years or so since the last post that they have solved this |
If so can anyone share us the method/code regarding how they resolved this issue.Thanks in advance..  |
I thought you had solved it? your post start with
Quote: |
Try following piece of code |
so are you saying that the code you posted does not solve the problem? If not then why did you post an incorrect solution?
Also, please use 'code' tags around any code you post.
for example
Code: |
some code goes here
|
|
Dont interpret this wrongly..The code that I posted works fine. I was searching for any other existing methods to code it... |
|
Back to top |
|
 |
|