[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with http_url_encoder_addvar or me?
I am having a problem posting and not sure why. I am passing the
following string into my pgm via a net.data table:
<?xml version="1.0" encoding="UTF-8" ?>
<PaymentBatch password="xxxxxx" accountID="999">
<Payment sequenceID="1">
<CreditCardPayment>
<Item>
<NewItem>
<Amount>87.00</Amount>
<ItemTitle>Test reg item</ItemTitle>
<ItemDescription>Sample Item for registration</ItemDescription>
<ItemCompany>742</ItemCompany>
</NewItem>
</Item>
<Payor>
<Name>
<IndividualName>
<FirstName>John</FirstName>
<LastName>Smith</LastName>
</IndividualName>
</Name>
<Email>jsmith@xxxxxxxx</Email>
<StreetAddress1>1592 Elm Street</StreetAddress1>
<StreetAddress2>Freddy Suite</StreetAddress2>
<City>New York</City>
<State>New York</State>
<Zip>33333</Zip>
<SSN>7121</SSN>
</Payor>
<CreditCardAccount>
<CardType>Mastercard</CardType>
<CardNumber>43219999999999999</CardNumber>
<ExpirationMonth>09</ExpirationMonth>
<ExpirationYear>2009</ExpirationYear>
<SecurityCode>123</SecurityCode>
<UseAVS>False</UseAVS>
</CreditCardAccount>
<StudentName>Jennifer Smith</StudentName>
</CreditCardPayment>
</Payment>
</PaymentBatch>
I need to post that string in a form-variable called "request" so I do
the following in my code:
C eval rc = dtw_table_GetV(table1:
C dest:1:1)
C eval data = %str(dest)
C eval enc = HTTP_url_encoder_new()
c callp http_url_encoder_addvar(enc:
C 'request':dest+2:%len(%trimr(data))
c callp http_url_encoder_getptr(enc: encd: size)
c eval rc=http_url_post_raw(
c 'https://www.mypaynetapps.com' +
c '/gateway.php':
c encd: size:
c 1: %paddr('INCOMING'))
c callp http_url_encoder_free(enc)
after calling http_url_encoder_addvar the content of encd is:
request=xml+version%3D%221.0%22+encoding%3D%22UTF-8%22+%3F%3E%0D%0A%3C
PaymentBatch+password%3D%22xxxxxxxxx%22+accountID%3D%22999%22%3E%0D%0A
+%3CPayment+sequenceID%3D%221%22%3E%0D%0A++%3CCreditCardPayment%3E%0D%
0A+++%3CItem%3E%0D%0A++++%3CNewItem%3E%0D%0A+++++%3CAmount%3E87.00%3C%
2FAmount%3E%0D%0A+++++%3CItemTitle%3ETest+reg+item%3C%2FItemTitle%3E%0
D%0A+++++%3CItemDescription%3ESample+Item+for+registration%3C%2FItemDe
scription%3E%0D%0A+++++%3CItemCompany%3E742%3C%2FItemCompany%3E%0D%0A+
+++%3C%2FNewItem%3E%0D%0A+++%3C%2FItem%3E%0D%0A+++%3CPayor%3E%0D%0A+++
+%3CName%3E%0D%0A+++++%3CIndividualName%3E%0D%0A++++++%3CFirstName%3EJ
ohn%3C%2FFirstName%3E%0D%0A++++++%3CLastName%3ESmith%3C%2FLastName%3E%
0D%0A+++++%3C%2FIndividualName%3E%0D%0A++++%3C%2FName%3E%0D%0A++++%3CE
mail%3Ejsmith%40mail.com%3C%2FEmail%3E%0D%0A++++%3CStreetAddress1%3E15
92+Elm+Street%3C%2FStreetAddress1%3E%0D%0A++++%3CStreetAddress2%3EFred
dy+Suite%3C%2FStreetAddress2%3E%0D%0A++++%3CCity%3ENew+York%3C%2FCity%
3E%0D%0A++++%3CState%3ENew+York%3C%2FState%3E%0D%0A++++%3CZip%3E33333%
3C%2FZip%3E%0D%0A++++%3CSSN%3E7121%3C%2FSSN%3E%0D%0A+++%3C%2FPayor%3E%
0D%0A+++%3CCreditCardAccount%3E%0D%0A++++%3CCardType%3EMastercard%3C%2
FCardType%3E%0D%0A++++%3CCardNumber%3E4321999999999999%3C%2FCardNumber
%3E%0D%0A++++%3CExpirationMonth%3E09%3C%2FExpirationMonth%3E%0D%0A++++
%3CExpirationYear%3E2009%3C%2FExpirationYear%3E%0D%0A++++%3CSecurityCo
de%3E123%3C%2FSecurityCode%3E%0D%0A++++%3CUseAVS%3EFalse%3C%2FUseAVS%3
E%0D%0A+++%3C%2FCreditCardAccount%3E%0D%0A+++%3CStudentName%3EJennifer
+Smith%3C%2FStudentName%3E%0D%0A++%3C%2FCreditCardPayment%3E%0D%0A+%3C
%2FPayment%3E%0D%0A%3C%2FPaymentBatch%3E%0D%0A%00%00
and the response I get after the post is
<ErrorList>
<Error>
<ErrorCode>1</ErrorCode>
<ErrorDescription>HTTP_POST is invalid</ErrorDescription>
</Error>
</ErrorList>
Is the HTTP_POST invalid because all the special characters have been
converted to hex or am I doing something else wrong?
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------