Forum Discussion
kacole2
12 years agoNew Contributor
I don't believe that will work. From the documentation:
Connecting to an SRM Server
Programs connect to an SRM server using the SrmLoginLocale API, or to SRM servers at both the protected site and the recovery site using the SrmLoginSites API.
Managed Object Reference
SRM methods take a managed object reference _this, which references the SessionManager used for making method calls. Programs obtain _this by retrieving content of the ServiceInstance, which is accomplished by creating a new managed object reference of type SrmServiceInstance.
Example 3-1. C# code to create SrmServiceInstance
public SvcConnection(string svcRefVal)
{
...
_svcRef = new ManagedObjectReference();
_svcRef.type = "SrmServiceInstance";
_svcRef.Value = svcRefVal;
}
...
SrmLoginLocale
This method logs in to the SRM server. The Connect public method requires the URL of an SRM server and authentication credentials. The SrmLoginLocale method takes the _srcRef managed object reference from SrmServiceInstance, and fails if the user name and password combination is invalid, or if the user is already logged in. In these examples, a locale string could be provided instead of the null parameter.
Example 3-3. C# code for SRM login
protected SrmService _service;
protected SrmServiceInstanceContent _sic;
protected ManagedObjectReference _svcRef;
...
public void Connect(string url, string username, string password)
{
_service = new SrmService();
_service.Url = url;
_service.Timeout = 600000;
_service.CookieContainer = new System.Net.CookieContainer();
_sic = _service.RetrieveContent(_svcRef);
_service.SrmLoginLocale(_svcRef, username, password, null);
...
}
Connecting to an SRM Server
Programs connect to an SRM server using the SrmLoginLocale API, or to SRM servers at both the protected site and the recovery site using the SrmLoginSites API.
Managed Object Reference
SRM methods take a managed object reference _this, which references the SessionManager used for making method calls. Programs obtain _this by retrieving content of the ServiceInstance, which is accomplished by creating a new managed object reference of type SrmServiceInstance.
Example 3-1. C# code to create SrmServiceInstance
public SvcConnection(string svcRefVal)
{
...
_svcRef = new ManagedObjectReference();
_svcRef.type = "SrmServiceInstance";
_svcRef.Value = svcRefVal;
}
...
SrmLoginLocale
This method logs in to the SRM server. The Connect public method requires the URL of an SRM server and authentication credentials. The SrmLoginLocale method takes the _srcRef managed object reference from SrmServiceInstance, and fails if the user name and password combination is invalid, or if the user is already logged in. In these examples, a locale string could be provided instead of the null parameter.
Example 3-3. C# code for SRM login
protected SrmService _service;
protected SrmServiceInstanceContent _sic;
protected ManagedObjectReference _svcRef;
...
public void Connect(string url, string username, string password)
{
_service = new SrmService();
_service.Url = url;
_service.Timeout = 600000;
_service.CookieContainer = new System.Net.CookieContainer();
_sic = _service.RetrieveContent(_svcRef);
_service.SrmLoginLocale(_svcRef, username, password, null);
...
}
Related Content
- 2 years ago
- 4 years ago
- 8 years ago
- 4 years ago
Recent Discussions
- 15 years ago