Time out when calling a Web service - web-services

I have a problem when I am using the webservice from a mobile App Im developing in Flex Builder.
I have the following code for a Web service
<s:CallResponder id="readAllPedidosErpResult" result="readAllPedidosErpResult_resultHandler(event)" fault="sincFailResult_faultHandler(event)"/>
protected function readAllPedidosErp():void
{
readAllPedidosErpResult.token = xEasyERPMobileAppWS.readAllPedidosErp
(readFechaSincronizacionPedidoErp(),sC.readComercialUsuario());
}
protected function readAllPedidosErpResult_resultHandler(event:ResultEvent):void
{
var result:ArrayCollection;
var c:PedidoWSMobile;
if(event.token.result is ArrayCollection)
{
result = event.token.result as ArrayCollection;
if(result!=null)
{
//DO SOMETHING
}
}
continueToNext(15);
}
The problem I get is that xEasyERPMobileAppWS.readAllPedidosErp(readFechaSincronizacionPedidoErp(),sC.readComercialUsuario()); takes almost 2 minutes to get the answer but after 30 seconds (more or less) does not wait more and I got a fault (sincFailResult_faultHandler(event)).
How can I give more time to the CallResponder to wait the answer from the Web Service I am calling?
Thanks in advance.

I´ve just found the solution in another thread.
FYI: Adobe Flex 4.6 WebService request timeout
Thanks anyways!

Related

Vimeo API - setVolume has stopped working

Until earlier today, the following block of code was running fine to toggle the volume on a Vimeo video.
const updateVideoMute = (vimeoPlayer, muteIcon) => {
vimeoPlayer.getVolume().then(data => {
data === 0 ? vimeoPlayer.setVolume(1) : vimeoPlayer.setVolume(0);
data === 0 ? muteIcon.classList.add("active") : muteIcon.classList.remove("active");
});
};
The checks I have made include:
Testing other videos from same library (volume has stopped toggling);
Clearing cache;
Testing other browsers;
Double checked the player and methods are behaving as expected.
Has something changed with the API? Any suggestions on how to further investigate the problem?
Appreciate your help.
I had this same issue, and changing player.setVolume(1) to use player.setMuted(false) instead has made it work for me.

“The page has expired due to inactivity” appears when using a services methods - Laravel 5.5

According to other asked questions like this one, I did many doings to prevent this request expired message but there is no solution for my issue.
In the long run I recognized that the message appears when I call a service method inside a controller which run on form action!
Here is my codes samples with some descriptions:
My route:
Route::post('Material/{id}', 'MaterialController#updateMaterial')->name('updateMaterial');
Material Controller Constructor:
public function __construct(CustomService $srv)
{
$this->middleware('admin')->only(['updateMaterial']);
$this->srv= $srv;
}
srv is a protected attribute in MaterialController class.
updateMaterial Method:
public function updateMaterial($id,Request $request)
{
$this->validate($request, [...]);
$material = $this->srv->updateMaterial($request, $id);
if ($material)
return view('panel._materials.edit-material')
->with('material', $material)
->with('success', 1);
}
I also have a provider for CustomService with name CustomServiceProvider and here is the register method of the provider:
public function register()
{
$this->app->bind(CustomService::class,function($app){
return new CustomService();
});
}
and I registered it as a provider in config/app.php.
So when I return something before calling service updateMaterial method, it's OK. but when the method runs, the issue appears!
I don'n have any idea about!
Update:
And here is updateMaterial of CustomService:
public function updateMaterial($request, $id)
{
$material = Material::find($id);
if (!$material)
return false;
if ($request->has('unit'))
$material->unit = $request['unit'];
if ($request->has('price'))
$material->price = $request['price'];
if ($request->has('type'))
$material->type = $request['type'];
if ($request->has('is_active'))
$material->is_active = $request['is_active'];
$material->updated_at = Carbon::now();
$material->save();
return $material;
}
I also create a new project with Laravel 5.5.0 and without adding any complexity I just added a post route and call it in form action, but nothing changed!
This is just an issue for Windows users on Local Environment. I suffered a lot with this also when on Windows. Once you deploy to your production server, you won't have any issue at all.
It's important to note that this is not an issue with Laravel 5.5 version only. I first saw this issue in version 5.2.
I think a good fix for this would maybe be using something like Homestead or Vessel from Fideloper. Honestly I only suffered this problem when using Windows.

Pass custom HTTP header from Windows Phone to ASMX service

Problem: Want to send a custom HTTP header from Windows Phone 7.1 app to ASMX service. The ASMX service is developed by different team.
Solutions tried: There are number of questions & answers on net for this, but nothing seem to work in our case.
Refered HttpRequestMessageProperty,
and this.
Client Side Code:
HttpRequestMessageProperty httpProps = new HttpRequestMessageProperty();
httpProps.SuppressEntityBody = false;
httpProps.Headers["HeaderKey"] = "HeaderValue";
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpProps;
Service Side Code:
public string GetHeaderValue()
{
var properties = OperationContext.Current.IncomingMessageProperties;
var property = properties[HttpRequestMessageProperty.Name] as HttpRequestMessageProperty;
string headerValue = property.Headers["HeaderKey"];
return headerValue;
}
The "HeaderKey" value is not available on service side. Can any one point us in right direction ? Any help will be appreciated.
Thank you.
Ok, So after some hits and misses, the below code worked:
HttpContext.Current.Request.Headers.GetValues("HeaderKey")[0];
The issue with using OperationContext was for ASMX the OperationContext.Current was null. In WCF service, the OperationContext.Current is available.
Thanks #user623396 for your time and efforts. Hope this helps someone out.

Cancelling async webservice call in windows phone

I'm developing a windows phone app that consumes a .Net Web Service (develop also by me). When I call the a Web Service method a do it asynchronously and don't block the UI. For example, here's a code sample for asking the server for a list o flights Arrivals.
service.MobileWSSoapClient Proxy { get; set; }
Proxy = new service.MobileWSSoapClient();
Proxy.GetArrivalsCompleted += proxy_GetArrivalsCompleted;
Proxy.GetArrivalsAsync(searchFilter);
This way I give the freedom to the user to call again the same method or another one (ex: refreshing the arrival list or searching for a particular arrival). In case the user generates a new call to the services, the app should "cancel" the first call and only show the result of the last call. I think that is technically impossible to Cancel a web service call that already went to the server, we should wait for the server response and then ignore it. Knowing that, it would be helpful to mark somehow that call as obsolete. It would be enough to receive an error as a response of that obsolete call. I'll write a pseudo code of what I imagine/need.
void proxy_GetArrivalsCompleted(object sender, service.GetArrivalsCompletedEventArgs e){
if (e.Error == null){
// DO WORK
}
else
{
if(e.Error == Server Exception || e.Error == Connection Exception){
MessageBox.Show("error");
}
else if (e.Error == obsolete call){
// DO NOTHING
}
}
Thanks in advance.
You can use BackgroundWorker for your scenario. So, when the user calls again to the web service you can cancel your backgroundworker process that will end the service call.
How to use BackgroundWorker here.

c# app connectivity issue

I am new to C# and would be really grateful if someone could provide some insight on the following problem: I have written a c# app that gets the html content of a website, quite simply using a webclient. The problem is that if I run it for multiple websites I see that sometimes I get no results for some of them, like it was never connected to that website at that instance. I initially thought it was my internet connection but the same happened when I tried on a different wifi. It is worth mentioning that I have the same prob on another of my appcs when trying to connect to a webservice. My question is: does anybody know how can this be fixed? Does it have to do with the timeout time of something like that?
Thank you very much in advance
This is the code but it's not really an issue of coding:
var client = new WebClient();
try
{
var htmlcode = client.DownloadString(site);
int NumberOfTrues = Regex.Matches(htmlcode.ToLower(), key).Count;
}
catch (Exception)
{
messagebox.show("could not be loaded");
}
This was solved by defining the default proxy server in app config.