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

Re: FW: Web services

   Hi Carlos,
   Please understand that HTTPAPI is a file transfer program.  It's job is
   to send either a string containing data, or a file containing data from
   your computer to another computer.  According to your logs, it's doing
   that, successfully.
   Your question is about what to put in the string that's sent to someone
   else's web service.  (Someone called "Paytrace", I gather.)   If this
   was a web service that I was familiar with, I'd be more than happy to
   share my knowledge.  But, unfortunately, I'm not familiar with
   Normally, a web service will provide documentation on how to use it.
   This might be in the form of a WSDL document (which is the norm with
   SOAP web services) or it might be in the form of a human-readable
   documentation, such as HTML, PDF or Word format.  Did they give you
   anything like this?  Because this is where you should start -- learn
   how to call the service.
   Once you know what the service is expecting, and your question is how
   to accomplish that with HTTPAPI, let me know, and I'll be glad to help.
   You mention URL encoding -- and I don't exactly know how you want URL
   encoding to come into play here?  Is it that you have the equivalent of
   an HTML form, and it has one variable named 'parmlist', and in that
   variable you wish to put all of the pipe-delimited data you posted?
   If that's the case (and I don't know how I could know that, again,
   remember, I'm not familiar with Paytrace) you would do it like this:


   D form            s
   D postData        s
   D postDataLen     s             10i

   D parmlist        s          40000A


      form =

      parmlist =

               +  'INVOICE~8888|';



                    : %addr(parmlist :
                    : %len(parmlist)



                      : postDataLen

      rc = http_url_post( '[1]https://paytrace.com/api/default.asp'
                        : postData
                        : postDataLen
                        : '/tmp/httptest.html' );


   I have no clue whether this is correct or not -- it's purely a guess,
   and it's based ENTIRELY on the example you posted, so if your code is
   wrong, then mine certainly will be, too.
   I'm a little confused by the way you're calling http_url_post() as
   well.  You've added a ? to the URL, which typically denotes a query
   string -- but you didn't provide any query strings.  Did you intend for
   this data to be passed as a query string rather than as post data?
   That, again, is one of those details that should be documented by the
   WS provider, and is something I wouldn't know.  You need to read their
   docs to find out.
   Also, if it is meant to be a query string, are you certain that you
   wanted to do a POST request?  a query string is typically used with a
   GET request.  Again.. to know, you need to read their docs.
   If you _are_ sending this as a post request, what Content-Type is
   desired?  You are specifying HTTPAPI's default value of text/xml -- and
   your data is clearly NOT xml.   Maybe it should be set to
   application/x-www-form-urlencoded?  Again, to know, you need to read
   their docs.

   On 10/18/2012 6:29 PM, J. Carlos Lugo wrote:

Hello Scott:

I have remove now the doble "||" character from the program, but still I get
the same error
ERROR~990. Please provide a properly formatted parameter string.|

Pay trace is expecting the entire POSTDATA as URL Encoded they are saying
that what I am sending is not URL Encoded.
Does HTTP API does the encode or I have to do something else or use a
different API from your Tool

Please advise


Carlos Lugo

Multitec Consultants Group Inc.

( 310-717-7327


-----Original Message-----
From: J. Carlos Lugo [[3]mailto:jclugo@xxxxxxxxx]
Sent: Monday, October 15, 2012 10:07 AM
To: 'HTTPAPI and FTPAPI Projects'
Subject: RE: Web services

Hello Scott:

Thank you for your answer, Yes the Postdata is a Varying field
D postData        s          40000A   varying

We are running V6R1 and this is how the Post data Look in the Program and
when is doing the Post
postData =
  'parmlist='                                                  +
  'UN~demo123|PSWD~demo123|TERMS~Y|METHOD~ProcessTranx|'       +
  'TRANXTYPE~Authorization|CC~4012881888818888|EXPMNTH~12|'    +
  'EXPYR~12|AMOUNT~1.00|CSC~999|BADDRESS~1234|BZIP~83852|'     +
  'INVOICE~8888|'                                              ;

rc = http_url_post('[4]https://paytrace.com/api/default.pay?'
                      : %addr(postData:*DATA)
                      : %len(%trimr(postData))
                      : '/tmp/httptest.html');

Now I do not see the Special character anymore but now Still Paytrace is
sending me the following error below:

ERROR~990. Please provide a properly formatted parameter string.|

See the attached Text File for the Debug Log

I really appreciate all your help that you provide to all of us in using
your excellent tool for web services.


Carlos Lugo

Multitec Consultants Group Inc.

( 310-717-7327


-----Original Message-----
From: [6]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[[7]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Friday, October 12, 2012 3:51 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Web services

Hi Carlos,

My guess would be that postData is a VARYING field.  This is just a guess,
because you did not include the definition of this field in your message,
but it would explain the behavior you're seeing.

VARYING fields are stored in memory as a 2 or 4 byte unsigned integer that
keeps track of the current length of the field, followed by the actual
characters in the field.  So if your postData variable is 65535
long or shorter, the first two bytes in memory would be the length.
When you pass %addr(postData) to HTTPAPI, the address you're supplying
points to those length bytes, so HTTPAPI dutifully sends those length bytes
to the server.

That's why in some of my examples, you'll see me do:  %addr(myVar) +
2.    The +2 provides an address that's two bytes higher -- i.e. it
skips over those two length bytes.   On V6R1 and higher, IBM gave us a
way to do that automatically with %ADDR(myVar:*DATA), which is better
because it's more self-documenting.

Anyway, try changing your code to %ADDR(postData: *DATA) or if you're still
on V5R4 or earlier, do %ADDR(postData)+2 and see if that solves the problem.

Good luck!

On 10/12/2012 1:48 PM, J. Carlos Lugo wrote:

    Hello All:

    I am submitting a HTTP Post to Pay Trace web services but when pay
    trace received my Data String shows a weird character

    Here is the Data String submitted to Pay Trace

    Hello, and thank you for contacting Pay Trace.

    We can see ' ¬- ' before the parmlist. Beyond that it is formatted
    correctly. Here is the same information without the ' ¬- ' in there
    which works correctly when submitted through a browser.





    HERE is your string





    Here is what I have in the program to test the HTTP Post

    postData =

      'parmlist='                                                  +

      'UN~demo123|PSWD~demo123|TERMS~Y|METHOD~ProcessTranx|'       +

      'TRANXTYPE~Authorization|CC~4012881888818888|EXPMNTH~12|'    +

      'EXPYR~12|AMOUNT~1.00|CSC~999|BADDRESS~1234|BZIP~83852|'     +

      'INVOICE~8888|'+ CRLF                                        ;

    rc = http_url_post('[10]https://paytrace.com/api/default.pay?'

                          : %addr(postData)

                          : %len(%trimr(postData))

                          : '/tmp/httptest.html');

    Any advise will be appreciate it if I am using the right HTTP_URL_POST
    or should I use a Different POST Process to void the character that
    they Pay trace found in my data string.



    Carlos Lugo

    Multitec Consultants Group Inc.

    ( 310-717-7327





    2. [13]https://paytrace.com/api/default.pay

- This is the FTPAPI mailing list.  To unsubscribe, please go to:

This is the FTPAPI mailing list.  To unsubscribe, please go to:


   1. https://paytrace.com/api/default.asp
   2. mailto:JCLUGO@xxxxxxxxx
   3. mailto:jclugo@xxxxxxxxx
   4. https://paytrace.com/api/default.pay
   5. mailto:JCLUGO@xxxxxxxxx
   6. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   7. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   8. https://paytrace.com/api/default.pay?parmlist=UN~demo123
   9. https://paytrace.com/api/default.pay
  10. https://paytrace.com/api/default.pay
  11. mailto:JCLUGO@xxxxxxxxx
  12. https://paytrace.com/api/default.pay?parmlist=UN~demo123
  13. https://paytrace.com/api/default.pay
  14. http://www.scottklement.com/mailman/listinfo/ftpapi
  15. http://www.scottklement.com/mailman/listinfo/ftpapi
This is the FTPAPI mailing list.  To unsubscribe, please go to: