1. David Peace (Powersoft "The PowerBuilder & C# Experts")
  2. PowerBuilder
  3. Friday, 19 January 2018

Hi Guys

I'm trying to post to a webservice and I'm struggling to get the right concepts for PowerBuilder.

The URL is https://pms.verticalbooking.com/mainstay/OTA_PMS.php

the Message format is:


  
      uuid:bc12ff01-2329-f0dc-84e9-12ae9b579f32
     

3r799d6yq6
y3ppi58t20

     

  

  
     
         My Test Data
     

  

 

What is the best way to approach this?

 

 have tried using the following code and Rolands winhttp

// example HTTP POST in the style of the PostURL function

n_winhttp ln_http
String ls_URL, ls_title, ls_pathname, ls_filename
String ls_filter, ls_data, ls_mimetype, ls_response, ls_time
Blob lblob_data, lblob_response
Integer li_rc, li_fnum
ULong lul_length

lblob_data = blob('' + &
'   ' + &
'      uuid:bc12ff01-2329-f0dc-84e9-12ae9b579f32' + &
'      ' + &
'' + &
'3r799d6yq6' + &
'y3ppi58t20' + &
'
' + &
'     
' + &
'  
' + &
'   ' + &
'      ' + &
'         My Test Data' + &
'     
' + &
'  
' + &
'
')

ls_mimetype = ln_http.GetMIMEType(ls_pathname, lblob_data)

ls_URL  = "https://pms.verticalbooking.com/mainstay/OTA_PMS.php"
lul_length = ln_http.Postsoap(ls_URL, &
            lblob_data, ls_mimetype, lblob_response,'OTA_PMS')
If lul_length > 0 Then
    ls_response = String(lblob_response, EncodingAnsi!)
    ls_time = "Post Complete in " + &
        String(ln_http.Elapsed, "#,##0.####") + " seconds."
    messagebox('Response',ls_response)
Else
    MessageBox("PostURL Error #" + &
                    String(ln_http.LastErrorNum), &
                    ln_http.LastErrorText, StopSign!)
End If

 

Cheers David

0
Votes
Undo

I woke up this morning with a brainwave. Blob encoding EncodingANSI!

I will still gladly try PB2017R2 when it comes out :)

Thanks to everyone for their input :)

Cheers

David

Comment
There are no comments made yet.
  1. Tuesday, 23 January 2018
  2. PowerBuilder
  3. # 1
Chris Pollach Accepted Answer Pending Moderation
0
Votes
Undo

Suggestion: Another alternative David might be to try & use the new HTTP Client object & its related methods in PB 2017 R2 coming out by the end of January, 2018.

Comment
I think this is the only way to go since older versions of PowerBuilder don't support TLS 1.2!

  1. Armeen Mazda
  2. Sunday, 21 January 2018
I would love to, but I need to get this project up and running.

There are no comments made yet.
  1. Friday, 19 January 2018
  2. PowerBuilder
  3. # 2
Roland Smith Accepted Answer Pending Moderation
0
Votes
Undo

I have another example called XmlHttp which you might want to try. 

http://www.topwizprogramming.com/freecode_xmlhttp.html

WinHTTP makes calls to the API functions directly. XmlHttp is a wrapper around the Msxml2.XMLHTTP COM object. Msxml2.XMLHTTP is a standard part of Windows and is how websites implement AJAX background processing.

 

Comment
Hi Roland,



 



I tried out your xmlhttp and got a problem. The website I try to connect to is protected with login and password. So I tried to modify the open event of the ole object



    oleHTTP.open(Upper(as_Method), as_Url, False)



to



    oleHTTP.open(Upper(as_Method), as_Url, False, "login_xxx", "password_xxx")



Now I get the response, that the user is unknown.



Do you have any ideas, where my fault is?



Thanks in advance



Martin



 

  1. Martin Mueller
  2. Sunday, 21 January 2018
Hi Roland



I'm trying to make a SOAP call using HTTP post, the server gives be an error 500 with is not a lot of help. I have managed to use a SOAP test client to send and receive a correct message so is I can get the right structure to the message it should work.



Sadly my knowledge of low level HTTP messages is nil so I'm just guessing. The other annoying thing is that it only supports HTTPS so I cannot sniff the packets either. If I could compare the one that works and mine from PB I could see what I was doing wrong...

There are no comments made yet.
  1. Friday, 19 January 2018
  2. PowerBuilder
  3. # 3
Chris Pollach Accepted Answer Pending Moderation
0
Votes
Undo

Hi David;

   It could be pretty hard to help you are the "n_winhttp" object and "Postsoap" Command are not within the PB2017 realm.

Could you provide some more details around what you are using for this process?

Regards .. Chris

Comment
n_winhttp is one of my code examples.

  1. Roland Smith
  2. Friday, 19 January 2018
Super ... Thanks for jumping in here on this Roland. Hopefully, you can straighten out David's issue(s)! 

  1. Chris Pollach
  2. Friday, 19 January 2018
There are no comments made yet.
  1. Friday, 19 January 2018
  2. PowerBuilder
  3. # 4
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.