Donald,
if you do not want to use powerEXT but do it on your one, you
basically do it like this:
D tmpXmlData S 65535A varying
D xmlBuffer S 65535A based(pXmlData)
D pXmlBuffer S * inz
D maxBuffSize S 10I 0 inz(0)
D curBuffSize S 10I 0 inz(0)
// prepare XML data that is going to be added
// to the xmlBuffer
tmpXmlData = '<someXmlData><anElement>foo baa</anElement>';
// create/resize xmlBuffer
if (curBuffSize + %len(tmpXmlData) > maxBuffSize);
maxBuffSize = maxBuffSize + (1024 * 1024);
if (pXmlBuffer = *NULL);
pXmlBuffer = %alloc(maxBuffSize);
else;
pXmlBuffer = %realloc(pXmlBuffer: maxBuffSize);
endif;
endif;
// Shift xmlBuffer to the next free space of the XML buffer
pXmlBuffer = pXmlBuffer + curBuffSize;
// add data to the buffer
xmlBuffer = tmpXmlData;
// keep track of buffer size
curBuffSize = curBuffSize + %len(tmpXmlData);
// Prepare XML data that is going to be added
// to the xmlBuffer ...
// Finally post data to server
rc = http_url_post_xml(
'http://www.webservice.net/SomeReceiver.asmx'
: pXmlBuffer
: curBuffSize
// Free buffer
dealloc(N) pXmlBuffer;
Feel free to look at the attached (quick and dirty) sample service
program to get a better understanding of dynamic memory allocation.
Based on the attached sample you would call http_url_post_xml() as
shown below:
hBuffer = Buffer_new(1024*1024); // 1MB buffer auto-extend.
// Append data
Buffer_append(hBuffer: 'someData');
Buffer_append(hBuffer: 'someMoreData');
rc = http_url_post_xml(
'http://www.webservice.net/SomeReceiver.asmx'
: Buffer_getPtr(hBuffer)
: Buffer_size(hBuffer)
Buffer_delete(hBuffer);
Thomas.
ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx schrieb am 23.06.2010 21:22:30:
> Von:
>
> hr@xxxxxxxxxxxx
>
> An:
>
> ftpapi@xxxxxxxxxxxxxxxxxxxxxx
>
> Datum:
>
> 23.06.2010 21:28
>
> Betreff:
>
> RE: I need to be able to send a very large XML string and not sure
> how to go about it ( Using http_url_post_xml current)
>
> Gesendet von:
>
> ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
>
> Hi Donald,
>
> you can combine powerEXT Core and HTTPAPI and create up to 16 MB xml
as
> simple as this:
>
>
> // Clear powerEXT Service Program & Responce Object
> clearSrvPgm();
> setContent('*none');
>
> // Writing XML with powerEXT xmlNode and xmlEndNode methods
> for i = 1 to 10000;
> xmlNode('orderHead':'orderNo="123456"');
> xmlNode('customerNumber':'':'999888');
> xmlNode('orderDate':'':%char(%date(timeStamp())));
> xmlNode('orderText':'':'Text with spec char <>''"&');
> xmlEndNode();
> endfor;
>
> The address of the generation will be in storeAddr(0) and the size
will be
> in storeSize(0)
> so the HTTPAPI call would look like this:
>
> rc = http_url_post_xml(
> 'http://www.webservice.net/SomeReceiver.asmx'
> : storeAddr(0)
> : storeSize(0)
> .....
>
> If you already has done a lot of work putting your xml into RPGLE
> variables you can just use
> append it to store 0 step by step with the powerEXT method
> storeAppendText(0:myxml);
>
>
> Med venlig hilsen/Kind regards
> Henrik Rützou
> HR Software Development
> Ved Stampedammen 39
> DK 2970 Hørsholm
> Denmark
> E-mail: hr@xxxxxxxxxxxx
> Phone: +45 2714 8449
>
> Homepage: powerEXT.com
>
>
>
>
> "Zimmerman, Donald W." <donald.zimmerman@xxxxxxxxxxxxxx>
> Sent by: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
> 23-06-2010 18:38
> Please respond to
> HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
>
>
> To
> HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
> cc
>
> Subject
> RE: I need to be able to send a very large XML string and not sure
how to
> go about it ( Using http_url_post_xml current)
>
>
>
>
>
>
> Well this is where my ignorance comes in since I do not work with
pointers
> much. Is there anywhere you can direct me to get a good
understanding on
> how to accomplish this. I know you are a busy man but any help is
> appreciated.
>
> Donald W Zimmerman
> PMSI
> Application Development Lead
> (813) 318 6828 (Office)
> (918) 527 3999 (Cell)
> WFH (Thu and Fri)
>
> -----Original Message-----
> From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
> [[1]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott
Klement
> Sent: Wednesday, June 23, 2010 11:59 AM
> To: HTTPAPI and FTPAPI Projects
> Subject: Re: I need to be able to send a very large XML string and
not
> sure how to go about it ( Using http_url_post_xml current)
>
> There is no such limit. HTTP_url_post_xml() will handle any length
> string up to 16 MB.
>
> RPG eliminated the 64k limit in v6r1. However, if you are still on
v5r4,
> you can still send more than 64k using pointers and/or user spaces.
>
> If you want to send data from a file instead of a string, you can do
> that too... just call HTTP_url_post_stmf_xml() instead.
>
>
> On 6/23/2010 9:40 AM, Zimmerman, Donald W. wrote:
> >
> > I am currently using http_url_post_xml but it appears to be
limited
> to
> > a soap message of 65535. Of course this could be my ignorance
of
> being
> > able to define a string larger than that in RPG.
> >
> >
> > Is there a way to specify a larger string or should I possible
be
> > using a different procedure. (maybe passing a stream file
somehow)
> >
> >
> > This is quite critical so any information would be greatly
> > appreciated.
> >
> >
> >
> >
> > Donald W Zimmerman
> >
> > PMSI
> >
> > Application Development Lead
> >
> > (813) 318 6828 (Office)
> >
> > (918) 527 3999 (Cell)
> >
> > WFH (Thu and Fri)
> >
> >
> >
> > Notice: THIS DOCUMENT MAY CONTAIN CONFIDENTIAL OR PROPRIETARY
> > INFORMATION, INCLUDING PATIENT HEALTH INFORMATION THAT IS
PROTECTED
> > UNDER HIPAA AND OTHER STATE AND FEDERAL CONFIDENTIALITY LAWS.
PLEASE
> > DELIVER IMMEDIATELY ONLY TO THE INTENDED RECIPIENT. IF THIS
> > TRANSMISSION WAS RECEIVED IN ERROR, PLEASE CONTACT THE SENDER
> > IMMEDIATELY AND DO NOT DISTRIBUTE THE INFORMATION TO ANY OTHER
> PERSON.
> >
> >
> >
> >
> >
----------------------------------------------------------------------
-
> > This is the FTPAPI mailing list. To unsubscribe, please go to:
> > [2]http://www.scottklement.com/mailman/listinfo/ftpapi
> >
----------------------------------------------------------------------
-
>
>
----------------------------------------------------------------------
-
> This is the FTPAPI mailing list. To unsubscribe, please go to:
> [3]http://www.scottklement.com/mailman/listinfo/ftpapi
>
----------------------------------------------------------------------
-
>
> Notice: THIS DOCUMENT MAY CONTAIN CONFIDENTIAL OR PROPRIETARY
INFORMATION,
> INCLUDING PATIENT HEALTH INFORMATION THAT IS PROTECTED UNDER HIPAA
AND
> OTHER STATE AND FEDERAL CONFIDENTIALITY LAWS. PLEASE DELIVER
IMMEDIATELY
> ONLY TO THE INTENDED RECIPIENT. IF THIS TRANSMISSION WAS RECEIVED IN
> ERROR, PLEASE CONTACT THE SENDER IMMEDIATELY AND DO NOT DISTRIBUTE
THE
> INFORMATION TO ANY OTHER PERSON.
>
----------------------------------------------------------------------
-
> This is the FTPAPI mailing list. To unsubscribe, please go to:
> [4]http://www.scottklement.com/mailman/listinfo/ftpapi
>
----------------------------------------------------------------------
-
>
>
----------------------------------------------------------------------
-
> This is the FTPAPI mailing list. To unsubscribe, please go to:
> [5]http://www.scottklement.com/mailman/listinfo/ftpapi
>
----------------------------------------------------------------------
-
--
IMPORTANT NOTICE:
This email is confidential, may be legally privileged, and is for the
intended recipient only. Access, disclosure, copying, distribution, or
reliance on any of it by anyone else is prohibited and may be a
criminal
offence. Please delete if obtained in error and email confirmation to
the sender.
References
1. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
2. http://www.scottklement.com/mailman/listinfo/ftpapi
3. http://www.scottklement.com/mailman/listinfo/ftpapi
4. http://www.scottklement.com/mailman/listinfo/ftpapi
5. http://www.scottklement.com/mailman/listinfo/ftpapi
Attachment:
BUFFER_Sample.zip
Description: Zip archive
----------------------------------------------------------------------- This is the FTPAPI mailing list. To unsubscribe, please go to: http://www.scottklement.com/mailman/listinfo/ftpapi -----------------------------------------------------------------------