Sending information to outsystems through vba

Sending information to outsystems through vba


For a project where we need a macro inside word to register data's inside outsystem.
I try to make a sample with a service registering a data to outsytem and some logic in vba to post the data.

Here's my vba code

Sub SendFirstLine()
Dim MyRequest As Object
Dim mystring As String
    Set MyRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
    MyRequest.Open "POST", "http://localhost/TestWebServices/WebService.asmx/WebMethod", False
   MyRequest.SetRequestHeader "Host", "localhost"
    MyRequest.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded"
     MyRequest.SetRequestHeader "Content-Length", "15"
      MyRequest.SetRequestHeader "inWSsometext", "abcde"
    ' Send Request.
End Sub

and there the information i receive to connect with the service


The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.

POST /TestWebServices/WebService.asmx/WebMethod1 HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: length

HTTP/1.1 200 OK
If anybody may help me it will be great.
Hello L.Eric,

Did you try to implement this using webServices?
I think that it's a good and simple way to wrap this problem.

Kind Regards,
Hello Goncalo
 In fact people at our company is using macro in word to put data's from document to an access database.
we want to sen this data's to outsystem trough service.
But it looks i miss something to perform this.
Hi Lecat,

Currently the platform webservices are Soap 1.1 webservices. So It's not that simple to call them from VBA.
If you search a bit on the net you probably can find some ways to do it, but it will give some work.

As an easy alternative you can use Web Screens instead and do it pretty similar like you are doing now.
The url will be something like http://localhost/TestWebServices/WebScreenName.aspx or even better if you use an Entry point http://localhost/TestWebServices/EntryPointName.aspx .
Then to fill the inputs, If you do a POST you need to pass them as a Form field (and urlencoded if necessary), not as an header like you were trying.

João Rosado