Hi,
i am looking for any help regarding retrieving data using API. The code successfully opens the client, but fails to retrieve data (incidentList call). The error:
"System.ServiceModel.ProtocolException was unhandled... response message does not match the content type of the binding (text/xml; charset=utf-8)"
The fault code in the return SOAP envelop:
<faultstring>Authentication failed</faultstring>
<detail>
<AuthenticationFault:AuthenticationFault xmlns:AuthenticationFault="http://www.vontu.com/enforce/webservice/incident/schema" xmlns="" xmlns:ns7="http://www.vontu.com/enforce/webservice/incident/schema" reason="Authentication failed"/>
</detail>
I am using correct crudentials to connect, userID/password combination works fine while logging from the console.
Here is the code fragment I am running, C#:
string client_username = "userID";
string client_password = "pass123";
string url = "https://enforce_host/ProtectManager/services/reporting";
EndpointAddress epAddress = new EndpointAddress(url);
BasicHttpBinding httpBinding = new BasicHttpBinding();
httpBinding.Security.Mode = BasicHttpSecurityMode.Transport;
httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
ReportingServicePortTypeClient client = new ReportingServicePortTypeClient(httpBinding, epAddress);
client.ClientCredentials.UserName.UserName = client_username;
client.ClientCredentials.UserName.Password = client_password;
IEndpointBehavior behavior = new HttpBasicAuthenticationEndpointBehavior();
client.Endpoint.Behaviors.Add(behavior);
client.Open();
IncidentListRequest request = new IncidentListRequest();
int reportID = 999;
request.savedReportId = reportID;
List<int> ids = new List<int>();
ids.AddRange(client.incidentList(request)); // --->> Execption is here
Any suggestions are welcome!
Thanks!
Alex