[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SV: New to XML - Dequeue2 Request Issue
Ahh... Don't know. But a few thoughts:
Is the length of the outbuf variable too short (24576 bytes) to hold all the decoded data? That would truncate the data, but the decoding routine would still return the full length of the decoded data.
If base64_decode() returns a length that is longer than the provided outbuffer, then the write to the file will include "garbage", i.e. random bytes from beyound the limit of the provided outbuffer is written to the file.
Why do you open your embfile with codepage 817, yet you state in your comments that it should be "tagged" as codepage 1208 (UTF-8)?
-----Oprindelig meddelelse-----
Fra: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] På vegne af corby.weaver@xxxxxxxxxxxxxxxxx
Sendt: 26. januar 2016 16:55
Til: HTTPAPI and FTPAPI Projects
Emne: RE: New to XML - Dequeue2 Request Issue
I resolved part of my decoding issue. It was a case of too many
versions of my own code. However, I'm still running into an issue. My
file contains vehicle position information for our trucks. The file is
rather large. The full file comes in fine. When I go to decode, It
gives me the first 180 or so lines fine. After that, jumbled garbage.
I'm bringing my encoded xml file into an ifs file. I need to decode
what is inside of the "transactions" tags. My code is as follows:
D Element_Val_t ds qualified
D based(template)
D buf *
D len 10i 0
// ----------------------------------------------
// Parse the SOAP document (the one in soapfile)
// Inside it will be another XML document that's
// embedded within -- save that to a separate
// file in the IFS.
// ----------------------------------------------
embfile = '/tmp/OmniTracsFuelFin.soap';
if (http_parse_xml_stmf( soapfile
: HTTP_XML_CALC
: *null
: %paddr(SaveEmbed)
: %addr(embfile) ) < 0);
http_crash();
endif;
*inlr = *on;
// ----------------------------------------------
P SaveEmbed B
D SaveEmbed PI
D embfile 50a varying
D depth 10I 0 value
D name 1024A varying const
D path 24576A varying const
D value likeds(Element_Val_t)
D attrs * dim(32767)
D const options(*varsize)
D writeConst PR 10I 0 ExtProc('write')
D fildes 10i 0 value
D buf 65535A const options(*varsize)
D bytes 10U 0 value
D xmlhdr s 80a varying
D fd s 10i 0
D outbuf S 24576A
D outlen S 10I 0
// ------------------------------------------
// create new stream file in IFS
// tag it with CCSID 1208 (UTF-8)
// ------------------------------------------
http_XmlReturnPtr(*On);
if name = 'transactions';
unlink(embfile);
fd = open(embfile: O_CREAT + O_CCSID + O_WRONLY
: S_IRUSR + S_IWUSR
: 819);
outlen = base64_decode( value.buf
: value.len
: %addr(outbuf)
: %size(outbuf) );
callp write(fd: %addr(outbuf): outlen);
callp close(fd);
endif;
/end-free
P E
Corby Weaver
From: Paul Reid <PReid@xxxxxxxxxxxx>
To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>,
Date: 01/21/2016 10:12 AM
Subject: RE: New to XML - Dequeue2 Request Issue
Sent by: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
__________________________________________________________________
Hello again Corby.
If you look in the example program that I posted previously, called
DSRPERFMON, you should see a data area named ##PERFMON. This data area
contains the Last Transaction that was received and saved from the
previous run. If you include this Last Transaction in your next request
you only receive data that is greater than this Last Transaction. At
the end of each run I store the Last Transaction in the data area
##PERFMON and so on...This way I only get "new" data that I haven't yet
received that I can append to my database file on our backend system. I
believe this is doing what you are asking.
As far as I know, with this service, there is no way to select data
via a date/time stamp range. I believe you have to use this Transaction
number.
I hope this helps.
-----------------------------------------------------------------------
-------------------------------
Paul Reid
Application Developer III
Erb Group of Companies | 290 Hamilton Road | New Hamburg, Ontario | N3A
1A2
Phone: 519.662.6133 ext. 2363
Web: [1]http://www.erbgroup.com/
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[[2]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
corby.weaver@xxxxxxxxxxxxxxxxx
Sent: Thursday, January 21, 2016 10:20 AM
To: HTTPAPI and FTPAPI Projects
Subject: Re: New to XML - Dequeue2 Request Issue
I've gotten some good data with my Dequeue2 requests. Thanks for
everyone's help.
Can I select by date/time stamp which records I pull prior to the
decoding process? I only want to pull information since the previous
request.
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[3]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[4]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
References
1. http://www.erbgroup.com/
2. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
3. http://www.scottklement.com/mailman/listinfo/ftpapi
4. http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com ______________________________________________________________________
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------