[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Question Re WEBFORM_SetVar



He did say to use WEBFORM_setPtr(). If you look into the header file, you will find the prototype for this is an "alias" for HTTP_URL_ENCODER_ADDVAR. So the whole thing looks like this:

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
 * http_url_encoder_addvar():  Add a variable to what's stored    
 *          a URL encoder.                                        
 *                                                                
 *    peEncoder = pointer to encoder created by the               
 *                  http_url_encoder_new() routine                
 *   peVariable = variable name to add                            
 *       peData = pointer to data to store in variable            
 *   peDataSize = size of data to store in variable               
 *                                                                
 * Returns *ON if successful, *OFF otherwise.                     
 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
D http_url_encoder_addvar...                                      
D                 PR             1N                               
D    peEncoder                        like(HTTP_URL_ENCODER) value
D    peVariable                 50A   varying value               
D    peData                       *   value                       
D    peDataSize                 10I 0 value                       
/if defined(WEBFORMS)                                                  
D WEBFORM_setPtr...                                                     
D                 PR             1N   extproc('HTTP_URL_ENCODER_ADDVAR')
D    peEncoder                        like(WEBFORM) value               
D    peVariable                 50A   varying value                     
D    peData                       *   value                             
D    peDataSize                 10I 0 value                             
 /endif                                                                 

So, make your XMLData as big as you need and then this:
callp     WEBFORM_SetPtr(Form: 'xmldata': %addr(xmldata):%len(%trimr(xmldata)))

If your XMLData is variable length, the address would be %addr(xmldata:*data) and you could skip the trimr on the length.

 


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Anthony, Bruce
Sent: Monday, February 9, 2015 4:56 PM
To: 'HTTPAPI and FTPAPI Projects'
Subject: RE: Question Re WEBFORM_SetVar

Scott,

How would I do that exactly?  Would I call WEBFORM_SetVar multiple times with xmldata cut up into chunks of data less than 256 characters? In the following callp, my xmldata field exceeds 256 characters.  

callp     WEBFORM_SetVar(Form: 'xmldata': xmldata)

I put in a debug statement and it shows xmldata being truncated after 256 characters:

HTTPAPI Ver 1.24 released 2012-01-23
OS/400 Ver V6R1M0

New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
http_url_post(): entered
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry  : 2
DNS resolver options: x'00000136'
DNS default domain: CALSB.XXX
DNS server found: XXX.16.1.124
DNS server found: XXX.15.1.124
https_init(): entered
-------------------------------------------------------------------------------------
Dump of local-side certificate information:

... more stuff

senddoc(): entered
xmldata=%3Ctxn%3E%3Cssl_merchant_id%3E999999%3C%2Fssl_merchant_id%3E%3Cssl_user_id%3Ewebpage%3C%2Fssl_user_id%3E%3Cssl_pin%3XXXXXXX%3C%2Fssl_pin%3E%3Cssl_test_mode%3Efalse%3C%2Fssl_test_mode%3E%3Cssl_transaction_type%3Eccsale%3C%2Fssl_transaction_type%3E%3Cssl_card_number%3E4111111111111111%3C%2Fssl_card_number%3E%3Cssl_exp_date&dummy=x
recvresp(): entered
HTTP/1.1 200 OK

I put in a second parm called &dummy.  You can see that xmldata ended before it even closed the ssl_exp_date tag above.

Xmldata contained more data...

<ssl_amount>1.00</ssl_amount><ssl_cvv2cvc2_indicator>1</ssl_cvv2cvc2_indicator><ssl_cvv2cvc2>123</ssl_cvv2cvc2><ssl_first_name>Tim</ssl_first_name></txn>'                                   

Thank you,

Bruce

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Monday, February 09, 2015 11:42 AM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Question Re WEBFORM_SetVar

Hi Bruce,

WEBFORM_setPtr() will allow you to set much longer values without needing to make any changes to HTTPAPI.

-SK

On 2/9/2015 12:43 PM, Anthony, Bruce wrote:
>     Scott,
>
>
>
>     Not sure if this is the correct place to ask a question but here goes.
>
>
>
>     We are a current customer of ProfoundUI Logic Software and we are
>     attempting to authorize credit cards via the use of U.S. Bank's Elavon
>     product.
>
>
>
>     Elavon requires that I pass my credit card XML request in an html
>     form.  In that regard, I have used EXAMPLE4 as a template located in
>     LIBHTTP library and it works just fine.
>
>
>
>     C                   eval      Form = WEBFORM_open
>
>
>
>     c                   callp     WEBFORM_SetVar(Form: 'xmldata': xmldata)
>
>
>
>     c                   callp     WEBFORM_postData( Form : myPointer
>
>     c                                                    : dataSize )
>
>
>
>     c                   eval      rc = http_url_post(
>
>     c                               url
>
>     c                             : myPointer
>
>     c                             : dataSize
>
>     c                             : '/tmp/testpost.html'
>
>     c                             : HTTP_TIMEOUT
>
>     c                             : HTTP_USERAGENT
>
>     c                             : 'application/x-www-form-urlencoded' )
>
>
>
>     Unfortunately, my request in the xmnldata will exceed 256 characters
>     and this is causing problems for me.
>
>
>
>     Can you confirm that I need to change the length of peVaLUE from 256 to
>     something like 4096 within the HTTPAPI_h module, code below:
>
>
>
>     D WEBFORM_setVar...
>
>     D                 PR             1N   ExtProc('HTTP_URL_ENCODER_AD
>
>     D    peEncoder                        like(HTTP_URL_ENCODER) value
>
>     D    peVariable                 50A   varying value
>
>     D    peValue                   256A   varying value
>
>
>
>     Do I also need to change the length in any other code?
>
>
>
>     I apologize if this is the wrong place to post a question.
>
>
>
>     Thank you,
>
>
>
>     Bruce
>
>
>
>
>
>
>
>
>
>     --
>
>     Bruce Anthony | Computer Analyst/Programmer
>
>     Information Technology
>
>     [1]The State Bar of California | 180 Howard Street | San Francisco, CA
>     94105
>
>     415.538.2423 | [2]Bruce.Anthony@xxxxxxxxxxxxx
>
>
>
>     This message may contain confidential information that may also be
>     privileged. Unless you are the intended recipient or are authorized to
>     receive information for the intended recipient, you may not use, copy,
>     or disclose the message in whole or in part. If you have received this
>     message in error, please advise the sender by reply e-mail and delete
>     all copies of the message. Thank you.
>
> References
>
>     1. file://localhost/tmp/www.calbar.ca.gov
>     2. mailto:Bruce.Anthony@xxxxxxxxxxxxx
>
>
>
> ----------------------------------------------------------------------
> - This is the FTPAPI mailing list.  To unsubscribe, please go to:
> 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 is the FTPAPI mailing list.  To unsubscribe, please go to:
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
-----------------------------------------------------------------------