Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all articles
Browse latest Browse all 1860

Error connecting to SRM Server with API

$
0
0

OK, I have created the required stub file from the WSDL definition on the SRM server and can see all the classes within. But when I try to connect to the server using the code below, I keep getting an error. I have searched the forums and googled, but there doesn't seem to be too much information out there.

 

FYI, SRMAPI is the name space in the stub file.

FYI, A.B.C.D is specified as the IP address of the SRM server.

 

Imports srmapi
Imports System.Web.services
Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim sc As New srmAPI.SrmServiceInstanceContent
        Dim _service As New srmAPI.SrmBinding()
        _service.Url = "http://A.B.C.D:9007"
        _service.CookieContainer = New System.Net.CookieContainer
        _service.Timeout = 20000
        Dim MO As New ManagedObjectReference()
        MO.type = "SrmServiceInstance"
        MO.Value = "SrmServiceInstance"
        Try
            SC = _service.RetrieveContent(MO)
            _service.SrmLogin(MO, "administrator", "Xtrav1rt")
            MsgBox("done")
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class

 

 

The error I currently recieve is generated when trying to execute the following line:

SC = _service.RetrieveContent(MO)

 

The error is as follows:

 

"The underlying connection was closed: The connection was closed unexpectedly."

 

 

Can anyone help at all (and save some more of my hair)?

 

Thanks in advance.


Viewing all articles
Browse latest Browse all 1860

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>