I am developing a Xamarin video consumer application in Xamarin and I am getting the following error:
Amazon.KinesisVideoMedia.AmazonKinesisVideoMediaException: The service returned an error. See inner exception for details. ---> Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
The error code in the exception is null. I included a snapshot of my screen with the detailed error.
code:
async Task TaskeGetMedia()
{
var cancelToken = new CancellationToken();
var config = new AmazonKinesisVideoMediaConfig();
Console.WriteLine(config.ToString());
AmazonKinesisVideoMediaClient client = new AmazonKinesisVideoMediaClient("AKIAI33DOGUTJP4VOOBQ", "ZLMkUv/j6PGJCtqxIJW4/d4tI24AFA1iV0l22Wn5", "https://541221181757.signin.aws.amazon.com/console");
GetMediaRequest Myrequest = new GetMediaRequest();
Myrequest.StreamARN = "arn:aws:kinesisvideo:us-west-2:541321181757:stream/demo/1528677884275";
Myrequest.StreamName = "demo";
Myrequest.StartSelector = new StartSelector();
Myrequest.StartSelector.StartSelectorType = StartSelectorType.EARLIEST;
while (true)
{
try
{
var request = await client.GetMediaAsync(Myrequest, cancelToken);
Console.WriteLine(request);
}
catch (Exception ex)
{
Console.WriteLine("Something is thrown ! " + ex.ToString());
break;
}
}
}
Related
0
hi when executing the below code this error is thrown "Could not load type 'Amazon.Runtme.Endpoints.IEndpointProvider' from assembly 'AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604'." Code ->
"try
{
client = new AmazonSecurityTokenServiceClient();
var response = client.AssumeRoleAsync(new AssumeRoleRequest
{
RoleArn = "arn:aws:iam::712090922:role/TestRole",
RoleSessionName = "newsessionanme2"
});
Credentials credentials = response.Result.Credentials;
string access = credentials.AccessKeyId;
AWSCredentials awsCredentials = GetAWSCredentials(credentials.AccessKeyId, credentials.SecretAccessKey, credentials.SessionToken);
AmazonS3Client clientS3 = new AmazonS3Client(awsCredentials, Amazon.RegionEndpoint.USEast1);
var s3Response = clientS3.ListBuckets();
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}"
hi when executing the below code this error is thrown "Could not load type 'Amazon.Runtme.Endpoints.IEndpointProvider' from assembly 'AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604'." Code ->
"try
{
client = new AmazonSecurityTokenServiceClient();
var response = client.AssumeRoleAsync(new AssumeRoleRequest
{
RoleArn = "arn:aws:iam::712090922:role/TestRole",
RoleSessionName = "newsessionanme2"
});
Credentials credentials = response.Result.Credentials;
string access = credentials.AccessKeyId;
AWSCredentials awsCredentials = GetAWSCredentials(credentials.AccessKeyId, credentials.SecretAccessKey, credentials.SessionToken);
AmazonS3Client clientS3 = new AmazonS3Client(awsCredentials, Amazon.RegionEndpoint.USEast1);
var s3Response = clientS3.ListBuckets();
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}"
I am running this on .Net framework 4.8 with AWSSDK.Core , AWSSDK.SecurityToken ,AWSSDK.S3 nuget packages. The code throws exception during the client object creation of AmazonSecurityTokenServiceClient();
0
hi when executing the below code this error is thrown "Could not load type 'Amazon.Runtme.Endpoints.IEndpointProvider' from assembly 'AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604'." Code ->
"try
{
client = new AmazonSecurityTokenServiceClient();
var response = client.AssumeRoleAsync(new AssumeRoleRequest
{
RoleArn = "arn:aws:iam::712090922:role/TestRole",
RoleSessionName = "newsessionanme2"
});
Credentials credentials = response.Result.Credentials;
string access = credentials.AccessKeyId;
AWSCredentials awsCredentials = GetAWSCredentials(credentials.AccessKeyId, credentials.SecretAccessKey, credentials.SessionToken);
AmazonS3Client clientS3 = new AmazonS3Client(awsCredentials, Amazon.RegionEndpoint.USEast1);
var s3Response = clientS3.ListBuckets();
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}"
hi when executing the below code this error is thrown "Could not load type 'Amazon.Runtme.Endpoints.IEndpointProvider' from assembly 'AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604'." Code ->
"try
{
client = new AmazonSecurityTokenServiceClient();
var response = client.AssumeRoleAsync(new AssumeRoleRequest
{
RoleArn = "arn:aws:iam::712090922:role/TestRole",
RoleSessionName = "newsessionanme2"
});
Credentials credentials = response.Result.Credentials;
string access = credentials.AccessKeyId;
AWSCredentials awsCredentials = GetAWSCredentials(credentials.AccessKeyId, credentials.SecretAccessKey, credentials.SessionToken);
AmazonS3Client clientS3 = new AmazonS3Client(awsCredentials, Amazon.RegionEndpoint.USEast1);
var s3Response = clientS3.ListBuckets();
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.ReadLine();
}"
I am running this on .Net framework 4.8 with AWSSDK.Core , AWSSDK.SecurityToken ,AWSSDK.S3 nuget packages. The code throws exception during the client object creation of AmazonSecurityTokenServiceClient();
I had the same issue. I eventually discovered, like the comment by Ermiya Eskandry suggests, that I had an issue with the AWSSDK.Core versioning. It is required for the AWSSDK.Core and there was a version discrepancy.
I keep getting the HTTP 500 Internal Server Error in my android studio trying to call a loginQuery with apollo client for android, following this tutorial : link to apollo docs
Yet when I run the same query in graphiQL in my browser, it succeeds.
here's a picture of the error in studio :
here's my code:
String userNumber = numberInput.getText().toString();
String password = passwordInput.getText().toString();
Intent intent;
LogInQuery logInQuery = LogInQuery.builder().nationalID(userNumber).password(password).build();
apolloClient.query(logInQuery).enqueue(new ApolloCall.Callback<LogInQuery.Data>() {
#Override
public void onResponse(#NotNull Response<LogInQuery.Data> response) {
LogInQuery.Data data = response.getData();
List<Error> error = response.getErrors();
assert error != null;
String errorMessage = error.get(0).getMessage();
assert data != null;
Log.d(TAG, "onResponse: " + data.login() + "-" + data.login());
if(data.login() == null){
Log.e("Apollo", "an Error occurred : " + errorMessage);
runOnUiThread(() -> {
// Stuff that updates the UI
loading.setVisibility(View.GONE);
Toast.makeText(LogInActivity.this,
errorMessage, Toast.LENGTH_LONG).show();
});
} else {
runOnUiThread(() -> {
// Stuff that updates the UI
loading.setVisibility(View.GONE);
Toast.makeText(LogInActivity.this,
"New User Created!", Toast.LENGTH_LONG).show();
//Intent intent = new Intent(LogInActivity.this, LogInActivity.class);
//startActivity(intent);
});
}
}
#Override
public void onFailure(#NotNull ApolloException e) {
runOnUiThread(() -> {
Log.e("Apollo", "Error", e);
Toast.makeText(LogInActivity.this,
"An error occurred : " + e.getMessage(), Toast.LENGTH_LONG).show();
loading.setVisibility(View.GONE);
});
}
});
}
I can't find much on the internet to help me solve it. If it's duplicate, direct me to the correct answer.
Check your API in Postman. It's working fine or not! Please share API if possible.
I've added connected service via Microsoft WCF Web Service Reference Provider (see picture) proxy class has been successfuly created.
Then, when I try execute sample method from this web service (client.TestLanguageAsync() - which returns string) I get null reference exception - but I dont know what is null, because details of exception are very poor (look on picture). Below is code.
private async void BtnTest_Clicked(object sender, EventArgs e) {
try {
var endpoint = new EndpointAddress("https://f9512056.f95.ficosa.com/WMS/WMSWebService.asmx");
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport) {
Name = "basicHttpBinding",
MaxBufferSize = 2147483647,
MaxReceivedMessageSize = 2147483647
};
TimeSpan timeout = new TimeSpan(0, 0, 30);
binding.SendTimeout = timeout;
binding.OpenTimeout = timeout;
binding.ReceiveTimeout = timeout;
WMSWebServiceSoapClient client = new WMSWebServiceSoapClient(binding, endpoint);
string text = await client.TestLanguageAsync(); //This causes exception
label.Text = text;
} catch (Exception E) {
label.Text = E.ToString();
}
}
Look also on screen
Adding service reference and exception screen
Any ideas? Thanks in advance:)
I'm trying to post a json Object to a web api project from a windows phone app but I'm still getting 404 error. For the post method, I'm using that code:
Mail mailToCheck = new Mail();
try
{
mailToCheck.MailProfil = TxtBox_mail.Text.ToString();
string json = JsonConvert.SerializeObject(mailToCheck);
var httpClient = new System.Net.Http.HttpClient(new HttpClientHandler());
System.Net.Http.HttpResponseMessage response = await httpClient.PostAsync(new Uri("http://uri/api/Profil/CheckMail"), new StringContent(json));
var responseString = await response.Content.ReadAsStringAsync();
}
catch (Exception ex)
{
MessageBox.Show(ex.HResult.ToString());
}
The method CheckMail on my conctroller:
[HttpPost]
[Route("api/Profil/CheckMail")]
public IHttpActionResult CheckMail([FromBody]Mail MailProfil)
{
if (MailProfil.MailProfil != null)
{
try
{
bool exists = Librairie.Profils.mailExists(MailProfil.MailProfil);
return Ok(exists);
}
catch(Exception ex)
{
return InternalServerError(ex);
}
}
else
{
return BadRequest();
}
}
The Mail object is exactly the same in the app as in the web api project. Does someone can tell me what I'm doing wrong here ?
Check some samples of HttpClient.PostAsync() here: https://monkeyweekend.wordpress.com/2014/10/23/how-to-send-text-json-or-files-using-httpclient-postasync/
I'm using the free version of Xamarin Studio to do some test. In aprticular I'm trying to connect to web Service but I receive the ConnectFailure (Network unreachable) when I debug the application.
This is my code
public class MainActivity : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Set our view from the "main" layout resource
SetContentView (Resource.Layout.Main);
// Our code will go here
// Get our UI controls from the loaded layout
EditText phoneNumberText = FindViewById<EditText>(Resource.Id.editText1);
Button translateButton = FindViewById<Button>(Resource.Id.button1);
Button callButton = FindViewById<Button>(Resource.Id.button2);
// Disable the "Call" button
callButton.Enabled = false;
// Add code to translate number
string translatedNumber = string.Empty;
var rxcui = "198440";
var request = HttpWebRequest.Create(string.Format(#"http://rxnav.nlm.nih.gov/REST/RxTerms/rxcui/{0}/allinfo", rxcui));
request.ContentType = "application/json";
request.Method = "GET";
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
if (response.StatusCode != HttpStatusCode.OK)
Console.Out.WriteLine("Error fetching data. Server returned status code: {0}", response.StatusCode);
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
var content = reader.ReadToEnd();
if(string.IsNullOrWhiteSpace(content)) {
Console.Out.WriteLine("Response contained empty body...");
}
else {
Console.Out.WriteLine("Response Body: \r\n {0}", content);
}
//Assert.NotNull(content);
}
}
}
}
}
I don't understand if this is an error caused by the free version or it's me.
Please help me.
Thanks