This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

VBS Script Help

Well, here is the thing:

Currently we want to monitor some webservices from our intranet with a custom script on APM, everything works fine for status. But we want to go further consulting a method inside the webservice that returns the Response of that method, due some ws seem to be up but are not operative.

When I test with a ws on internet, it works fine, the problem is when I test the script with an internal web service, I get this Soap error:

I´ve tried a lot of changes but I get the same result, so, I´ve tested with another scripts where the RequestHeader indicated on "SOAPAction" and the structure is different, for example:

Changing these scripts with our data, there are no errors for SOAP, but there is not Response, only a blank screen without output.
The web services that we want to monitor work fine with "soapUI", and return the spected results.
This is a model of the script that I mentioned before to be impoted to APM:

 

' VBScript source code

class WebService

  public Url

  public Method

  public Response

  public Parameters

  public function execute()

    dim xmlhttp

    Set xmlhttp = CreateObject("Microsoft.XMLHTTP")

    xmlhttp.open "POST", Url & "/" & Method, false

    xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

    xmlhttp.send Parameters.toString

    response = xmlhttp.responseText

    set xmlhttp = nothing

  end function

  Private Sub Class_Initialize()

    Set Parameters = new wsParameters

  End Sub

  Private Sub Class_Terminate()

    Set Parameters = Nothing

  End Sub

End class

class wsParameters

  public mCol

  public function toString()

    dim nItem

    dim buffer

    buffer = ""

    for nItem = 1 to Count

      buffer = buffer & Item(nItem).toString & "&"

    next

    if right(buffer,1)="&" then

      buffer = left(buffer,len(buffer)-1)

    end if

    toString = buffer 

  end function

  public sub Clear

    set mcol = nothing 

    Set mCol = CreateObject("Scripting.Dictionary") 

  end sub

  public sub Add(pKey,pValue)

    dim newParameter

 

    set newParameter = new wsParameter

    newParameter.Key = pKey

    newParameter.Value = pValue

    mCol.Add mCol.count+1, newParameter

 

    set newParameter = nothing

  end sub

  public function Item(nKey)

    set Item=mCol.Item(nKey)

  end function

  public function ExistsXKey(pKey)

    dim nItem

 

    for nItem = 1 to mcol.count

      if mCol.Item(nItem).key = pKey then

        ExistsXKeyword = true

        exit for

      end if

    next

  end function

  public sub Remove(nKey)

    mCol.Remove(nKey)

  end sub

  public function Count()

    Count=mCol.count

  end function

  Private Sub Class_Initialize()

    Set mCol = CreateObject("Scripting.Dictionary")

  End Sub

  Private Sub Class_Terminate()

    Set mCol = Nothing

  End Sub

end class

 

class wsParameter

   public Key

   public Value

   public function toString()

     toString = Key & "=" & Value

   end function

end class

dim ws

'create web service object 

set ws = new webservice

'pointing to the ws

ws.Url = "">xxxxxxxxxxxxxxxxxxxxxxxxx.asmx"

'here goes the method

ws.Method = "method name"

'fill parameters

ws.Parameters.Add "xxxxxxxxxx", id

ws.Parameters.Add "text to show","xxxxxxxxx"

ws.execute

wScript.Echo "Message: Result is:" & ws.Response

set ws = nothing

 

Thanks in advance for any help