Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

XML and POST

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    XML and POST

    I created this script to create an xml file:

    dim ndx as p
    dim tbl as p
    tbl=table.open("[pathalias.adb_path]\patients")
    query.filter="idnumber='"+session.idnumber+"'"+".and. pracid='"+session.pracid+"'"
    query.order=""
    query.options=""
    ndx=tbl.query_create()

    dim fname as c
    fname="c:\patient_add.xml"

    dim tmerchantid as c
    tmerchantid="3128382"

    dim tmerchantkey as c
    tmerchantkey="0000382832"

    dim fp as p
    fp=file.create(fname,FILE_RW_EXCLUSIVE)

    fp.write_line("<api-request>")
    fp.write_line(" <verification>")
    fp.write_line(" <merchantId>"+alltrim(tmerchantkey)+"</merchantId>")
    fp.write_line(" <merchantKey>"+alltrim(tmerchantkey)+"</merchantKey>")
    fp.write_line(" </verification>")
    fp.write_line(" <command>add-patient</command>")
    fp.write_line("")
    fp.write_line("")
    fp.write_line(" <request>")
    fp.write_line(" <patientAccountNumber>"+alltrim(tbl.idnumber)+"</patientAccountNumber>")
    fp.write_line(" <firstName>"+alltrim(tbl.Firstname)+"</firstName>")
    fp.write_line(" <middleName>"+alltrim(tbl.Middle)+"</middleName>")
    fp.write_line(" <lastName>"+alltrim(tbl.lastname)+"</lastName>")
    fp.write_line(" <address1>"+alltrim(tbl.address1)+"</address1>")
    fp.write_line(" <address2>"+alltrim(tbl.address2)+"</address2>")
    fp.write_line(" <city>"+alltrim(tbl.city)+"</city>")
    fp.write_line(" <state>"+alltrim(tbl.state)+"</state>")
    fp.write_line(" <zip>"+alltrim(tbl.zip)+"</zip>")
    fp.write_line(" <phone>"+alltrim(tbl.Homephone)+"</phone>")
    fp.write_line(" <email>"+alltrim(tbl.E_mail)+"</email>")
    fp.write_line(" <dob>"+dtoc(tbl.dob)+"</dob>")
    fp.write_line(" <ssn>"+alltrim(tbl.Socsec)+"</ssn>")
    fp.write_line(" <sex>"+left(alltrim(tbl.sex),1)+"</sex>")
    fp.write_line(" <medicalRecordNumber>"+"</<medicalRecordNumber>>")
    fp.write_line(" <familyAccountNumber>"+"</familyAccountNumber>")
    dim ndx1 as p
    dim tbl1 as p
    tbl1=table.open("[pathalias.adb_path]\primaryinsur")
    query.filter="idnumber='"+session.idnumber+"'"+".and. pracid='"+session.pracid+"'"+".and. i1insconame='"+tbl.I1insconame+"'"
    query.order=""
    query.options=""
    ndx1=tbl1.query_create()
    dim tpolicynumber as c
    tpolicynumber=tbl1.i1insdid
    dim tgroupnumber as c
    tgroupnumber=tbl1.I1insdgrp
    dim ti1ptrel as c
    ti1ptrel=tbl1.I1ptrel
    ndx1.drop()
    tbl1.close()
    fp.write_line(" <policyNumber>"+alltrim(tpolicynumber)+"</policyNumber>")
    fp.write_line(" <groupNumber>"+alltrim(tgroupnumber)+"</groupNumber>")
    fp.write_line(" <relationshipType>"+alltrim(ti1ptrel)+"</relationshipType>")
    fp.write_line(" <alternateMemberIdType>"+"</alternateMemberIdType>")
    fp.write_line(" <alternateMemberId>"+"</alternateMemberId>")
    fp.write_line(" <payerProgramName>"+alltrim(tbl.Firstname)+"</payerProgramName>")
    fp.write_line(" </request>")
    fp.write_line("</api-request>")

    fp.flush()
    fp.close()

    ndx.drop()
    tbl.close()



    I have the url I need to post this to, but how in the heck do I do that, i.e. how do I post this xml file to the url???

    Lost ....
    Gary S. Traub, Ph.D.


    #2
    Re: XML HELP Please!!!

    Hi Gary,

    You are writing the xml to a file, but you need it in a memory buffer in order to use the POST functions. See my example below where I stuff "req" with the xml string. Or you can write to file, then use file.to_string() to get it from the file back to a variable.

    Then you use HTTP_POST to send the request.

    dim cc as c
    dim errors as as c
    dim resp as p
    req = 'the xml string
    url = ' the url where you want to send the xml
    resp = HTTP_POST(url,req)
    cc = resp.body
    save_to_file(cc,"c:\response.txt")
    errors = resp.error_text
    ''''''''''''''''''''''''
    cc will contain the entire response from the target server.
    I save it to a file to review and determine how I will parse the results using extract_string(). I've never taken the time to figure out how to use Alpha xml parser or even know where to look.
    Steve Wood
    See my profile on IADN

    Comment


      #3
      Re: XML HELP Please!!!

      Gary -

      I think you probably want HTTP_POST_PAGE2(). The body part is the contents of your XML file.
      -Steve
      sigpic

      Comment


        #4
        Re: XML HELP Please!!!

        Thank you guys!!

        I think I understand. I will let you know.
        Gary S. Traub, Ph.D.

        Comment


          #5
          Re: XML HELP Please!!!

          Originally posted by Steve Workings View Post
          Gary -

          I think you probably want HTTP_POST_PAGE2(). The body part is the contents of your XML file.
          http_post_page2() is not server-safe. Prior to V10, it is disabled in the A5W environment. In V10, it is mapped to http_post() to approximate the functionality.

          Lenny Forziati
          Vice President, Internet Products and Technical Services
          Alpha Software Corporation

          Comment


            #6
            Re: XML HELP Please!!!

            Lenny,

            Thanks for the clarification.

            I think I am close to getting it to work with http_post
            Gary S. Traub, Ph.D.

            Comment


              #7
              Re: XML HELP Please!!!

              What about if I need to post to https?

              I get this error:

              Secure Sockets Layer was not able to verify certificate.
              Gary S. Traub, Ph.D.

              Comment


                #8
                Re: XML HELP Please!!!

                I have now modified the script slightly, truing .f. and then .t. for ssl:

                dim ndx as p
                dim tbl as p
                tbl=table.open("[pathalias.adb_path]\patients")
                query.filter="idnumber='"+session.idnumber+"'"+".and. pracid='"+session.pracid+"'"
                query.order=""
                query.options=""
                ndx=tbl.query_create()

                dim ndxt as p
                dim tblt as p
                tblt=table.open("[pathalias.adb_path]\transengen")
                query.filter="pracid='"+session.pracid+"'"
                query.order=""
                query.options=""
                ndxt=tblt.query_create()
                dim tmerchantid as c
                dim tmerchantkey as c
                tmerchantid=tblt.Merchantid
                tmerchantkey=tblt.Merchantkey
                ndxt.drop()
                tblt.close()

                dim fname as c
                fname="c:\patient_add.xml"

                dim fp as p
                fp=file.create(fname,FILE_RW_EXCLUSIVE)

                fp.write_line("<api-request>")
                fp.write_line(" <verification>")
                fp.write_line(" <merchantId>"+alltrim(tmerchantid)+"</merchantId>")
                fp.write_line(" <merchantKey>"+alltrim(tmerchantkey)+"</merchantKey>")
                fp.write_line(" </verification>")
                fp.write_line(" <command>add-patient</command>")
                fp.write_line("")
                fp.write_line("")
                fp.write_line(" <request>")
                fp.write_line(" <patientAccountNumber>"+alltrim(tbl.idnumber)+"</patientAccountNumber>")
                fp.write_line(" <firstName>"+alltrim(tbl.Firstname)+"</firstName>")
                fp.write_line(" <middleName>"+alltrim(tbl.Middle)+"</middleName>")
                fp.write_line(" <lastName>"+alltrim(tbl.lastname)+"</lastName>")
                fp.write_line(" <address1>"+alltrim(tbl.address1)+"</address1>")
                fp.write_line(" <address2>"+alltrim(tbl.address2)+"</address2>")
                fp.write_line(" <city>"+alltrim(tbl.city)+"</city>")
                fp.write_line(" <state>"+alltrim(tbl.state)+"</state>")
                fp.write_line(" <zip>"+alltrim(tbl.zip)+"</zip>")
                fp.write_line(" <phone>"+alltrim(tbl.Homephone)+"</phone>")
                fp.write_line(" <email>"+alltrim(tbl.E_mail)+"</email>")
                fp.write_line(" <dob>"+dtoc(tbl.dob)+"</dob>")
                fp.write_line(" <ssn>"+alltrim(tbl.Socsec)+"</ssn>")
                fp.write_line(" <sex>"+left(alltrim(tbl.sex),1)+"</sex>")
                fp.write_line(" <medicalRecordNumber>"+"</medicalRecordNumber>")
                fp.write_line(" <familyAccountNumber>"+"</familyAccountNumber>")
                dim ndx1 as p
                dim tbl1 as p
                tbl1=table.open("[pathalias.adb_path]\primaryinsur")
                query.filter="idnumber='"+session.idnumber+"'"+".and. pracid='"+session.pracid+"'"+".and. i1insconame='"+tbl.I1insconame+"'"
                query.order=""
                query.options=""
                ndx1=tbl1.query_create()
                dim tpolicynumber as c
                tpolicynumber=tbl1.i1insdid
                dim tgroupnumber as c
                tgroupnumber=tbl1.I1insdgrp
                dim ti1ptrel as c
                ti1ptrel=tbl1.I1ptrel
                ndx1.drop()
                tbl1.close()
                fp.write_line(" <policyNumber>"+alltrim(tpolicynumber)+"</policyNumber>")
                fp.write_line(" <groupNumber>"+alltrim(tgroupnumber)+"</groupNumber>")
                fp.write_line(" <relationshipType>"+alltrim(ti1ptrel)+"</relationshipType>")
                fp.write_line(" <alternateMemberIdType>"+"</alternateMemberIdType>")
                fp.write_line(" <alternateMemberId>"+"</alternateMemberId>")
                fp.write_line(" <payerProgramName>"+alltrim(tbl.Firstname)+"</payerProgramName>")
                fp.write_line(" </request>")
                fp.write_line("</api-request>")

                fp.flush()
                fp.close()

                ndx.drop()
                tbl.close()

                dim xmldata as c
                xmldata = FILE.TO_STRING( fname )

                dim cc as c
                dim errors as c
                dim resp as p
                req = xmldata 'the xml string
                url = "https://api.intellivative.net/UniversalAPI/postAPI" ' "http://apiint.intellivative.net:8080/UniversalAPI/postAPI" ' the url where you want to send the xml
                'resp = HTTP_POST(url,req)
                resp = HTTP_POST(url,req,"",80,8000,.f.,.f.)
                cc = resp.body
                save_to_file(cc,"c:\response.txt")
                errors = resp.error_text
                ?"cc:"+"<br>"+cc+"<br><br>"
                ?"errors:"+"<br>"+errors


                In either case, the variable "errors" returns the following:

                Secure Sockets Layer OpenSSL Error OpenSSL Description: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol Error occurred in INET::SSLSocket::Connect
                Gary S. Traub, Ph.D.

                Comment


                  #9
                  Re: XML HELP Please!!!

                  Any help on this would be greatly appreciated ....
                  Gary S. Traub, Ph.D.

                  Comment


                    #10
                    Re: XML HELP Please!!!

                    I am really at a loss here. Calls to the payment processor have not been helpful because they are not familiar with alpha functions.

                    Please, can anyone advise as to what I need to do to get this to work ...
                    Gary S. Traub, Ph.D.

                    Comment


                      #11
                      Re: XML HELP Please!!!

                      Gary,

                      I did a search on the internet looking at the SSL error, problem maybe there is no hand-shake perhaps the request is only active on one site. check that first before bumping your head again.

                      "As it says, it is a SSL error. You should only use SSL if it is needed and it needs to be supported on both ends.Without more details on your actual connection and configuration, it is difficult to give a better answer.

                      Which is not SSL-enabled? Could be the SMTP server?"

                      In your case I think is port 21 Protocol support IFTPS there is the error
                      chance are that it isn't SSL enabled or your server is not responding with valid SSL.
                      .


                      hope this helps


                      Eric
                      Last edited by bea2701; 06-22-2010, 10:34 AM.

                      Comment


                        #12
                        Re: XML HELP Please!!!

                        Hi Eric,

                        Thanks for you reply.

                        The command I am using is:

                        resp = HTTP_POST(url,req,",443,8000,.f.,.f.)

                        and the url I am posting to is:

                        url = "https://api.intellivative.net/UniversalAPI/postAPI"

                        Given the url, I think I must use SSL (not sure about this), and I have tried the http_post with .t. and with .f. for the last argument (which turns ssl verirfication on or off). Still does not work.

                        Any other ideas?
                        Gary S. Traub, Ph.D.

                        Comment


                          #13
                          Re: XML HELP Please!!!

                          Silly question but are you trying this FROM a web address that uses SSL (HTTPS)?
                          Steve Wood
                          See my profile on IADN

                          Comment


                            #14
                            Re: XML HELP Please!!!

                            Hi Steve,

                            I WILL be running it from an SSL url, but right now, I am testing it from my localhost.

                            Does that make the difference?
                            Gary S. Traub, Ph.D.

                            Comment


                              #15
                              Re: XML HELP Please!!!

                              Steve is asking correct.
                              You say WILL be using that on production so the question = are you running a valid SSL on your localhost right now.

                              Eric

                              Comment

                              Working...
                              X