Other Languages - webserver - json - vba - Asked By tina silca on 10-Feb-12 09:03 AM

Hi,

I don't have so much experience on this and I'm facing an issue.
I've a webserver that contains a function getProject.
This function receives 3 parameters and retrieves a text as result.

how can I call the webserver and pass the 3 parameters?

thanks in advance

Private Function auth(url As String, ByRef usernme As String, ByRef passord As String, ByRef projctid As String)
   ' Dim objSClient As MSSOAPLib30.SoapClient30    ' Remove the 30 if using an earlier version of SOAP
    Dim fResult As Single
Dim objClient As SoapClient30
Dim objConn As SoapConnector30
Set objConn = New HttpConnector30
    ' Point the SOAP API to the web service that we want to call...
    Set objClient = New SoapClient30
    Set ws = CreateObject("MSOSOAP.SoapClient30")
    objConn.Property("EndPointURL") = url
   objConn.Property("SoapAction") = "getProject"
    objConn.BeginMessage
    Set objSerial = New SoapSerializer30
     objSerial.Init objConn.InputStream
    'Call objClient.MSSoapInit(par_WSDLFile:=url,
ws.MSSoapInit url
    ' Call the web service
    fResult = ws.getProject
    
    Set objSClient = Nothing

    ss = fResult
    
End Function

kalpana aparnathi replied to tina silca on 10-Feb-12 01:21 PM
hi,

Try this  example code for JSON:

$.ajax({  
    type
: "POST",  
    url
: url,  
    data
:

"{'Id1':'2','Id2':'2'}",

 
    contentType
: "application/json; charset=utf-8",
    dataType
: "json",
    success
: callback
});

tina silca replied to kalpana aparnathi on 13-Feb-12 05:31 AM
Hi,
Thanks but I need to call the webserver from VBA code.
I'm using MS Project 2007

best regards