System.ServiceModel.FaultException: Server was unable to process request. ---> ... with key 0 was not found - web-services

I have a simple service (C# web service) that accepts an integer and returns an integer, i have tested it using Storm it is working properly.
Now i am calling this service in a for loop in a file with around 2000 records approx, this service is failing giving the above error with some records. If i run the error file it goes through as if nothing was wrong, what might be the problem please help.

The error doesn't seem related to it being a web service call: it seems to indicate you either tried to GetEntity and passed in a zero/NullIdentifier() (not a valid Id), or maybe you tried an CreateEntity and that entity has a foreign key that is not filled in (i.e. zero/NullIdentifier() again).
I would start by checking the logic inside the WS method for those action calls and the inputs you are using there.

Related

Zend framework ACL fails for the first time to switch the server

Hi guys!
I'm not native to English, so I'll appreciate if you correct my sentence!
To explain my issue, here is our development environment.
language : PHP7.3.11
framework : Zend framework v3.3.11
server : aws ec2×4
server OS : Amazonlinux 2
redis was enabled, there are two project like a-project/ec2×2(a-ec2) b-project/ec2×2(b-ec2)
the only differences between a-ec2 and b-ec2 are source code, the other setting like nginx, php-fpm, redis also DB setting are same.
if I lack some info, please let me know
When we joint these project, the problems happen.
After logged in our service, the zend works oddly.
the loginAction is on the a-ec2, we can successfully login with that.
And we save that session information on redis, and it works normally.
But only for the first time that we switch the server from a-ec2 to b-ec2, zend acl error has occur.
We use isAllowed function for checking the privilege for whether the user has enough privilege to access certain service.
The isAllowd function which located at line 827, /library/ZendAcl.php return false for the first time.
Then, we reload the page, the isAllowed function return true so that we can access to the service.
In detail, something went wrong around &_getRules function which is at line 1161, which is used _getRuleType function.
In those process, somehow one of the array contain "TYPE_DENY".
But when try to reload(ctrl + f5), that value turn into "TYPE_ALLOW".
How can this happen?
And how to fix this?
We are trying to figure this out like 2 weeks or more...
Thanks in advance!!
[update]
we found that this method which is written in under doesn't work well, so that we can't get $auth properly.
The $auth return "".
self::$_auth = $auth = Zend_Auth::getInstance()->getStorage()->read();
[update 2]
we might solve this issue, so I'll leave our solution.
we use
Zend_Auth::getInstance()->getStorage()->read()
to get $auth from session.
But for the first time, the session information which has saved at a-ec2 can't read at b-ec2.
So, we decided to use session information at redis, so we changed method to get $auth like
require_once 'Zend/Session.php';
Zend_Session::start();
self::$_auth = $auth = Common_Model_Redis::get();
start the session before connect to the redis server and just get session information form it!
I hope this will work you too!

Erlang SNS amazon erlcloud publish fails with timeout error

I am trying to use erlcloud to send push notification to mobile based on endpointArn which received from client. I am able to successfully push notification with Java application. But same stuff if I try with erlang, it is giving timeout error. Below are code samples.
Config = erlcloud_sns:new(<<"Access Key">>,<<"secret Key">>,<<"sns.us-west-2.amazonaws.com">>).
erlcloud_sns:publish(target,<<"arn:aws:sns:us-west-2:2315XXXXXX:endpoint/GCM/testapp/XXXXXXX-fe9a-304e-aa52-XXXXXXXX">>,<<"ok">>,undefined,[],Config).
Last statement is showing below error.
** exception error: {sns_error,{socket_error,timeout}}
in function erlcloud_sns:sns_xml_request/3 (src/erlcloud_sns.erl, line 670)
in call from erlcloud_sns:publish/6 (src/erlcloud_sns.erl, line 471)
Same value of access_key, secret_key, Host and endpointArn works from Java program.
Short answer
Change your parameters to strings and it will work. i.e:
Config = erlcloud_sns:new("Access Key","secret Key","sns.us-west-2.amazonaws.com").
erlcloud_sns:publish(target,"arn:aws:sns:us-west-2:2315XXXXXX:endpoint/GCM/testapp/XXXXXXX-fe9a-304e-aa52-XXXXXXXX","ok",undefined,[],Config).
Long answer
erlcloud expects strings for all parameters. Unfortunately, instead of validating config values before storing them, it stores whatever you provide then fails on trying to use it. In this case, it can't recognise the credentials here (because the guard function is_list returns false). In the end, it falls back to getting credentials from ECS (here), hitting a timeout there and resulting in the error you see.

catching Talend error in web Application

I have created a Talend job and deployed it as a Axis Web Service.
I am calling this Web Service from my Web Application.
My application and web service are deployed over Tomcat server.
For Valid Inputs:
Runs Perfectly.
For Invalid Inputs:
It throws Error/exceptions in Tomcat Server.
I want this Errors into my application. I didn't get any error related information in the Response sent by web service.
Error message on Tomcat Server
XML response of Web service
If I understand your question you are not so much asking how to fix this error, but how to get feedback about your error. There are several ways but here is a simple method.
Add a tLogCatcher to your job, and point its output to a tSendMail component. You can run the output thru a tMap do things like adding HTML formatting. You can also create a joblet with these two components and use the joblet in every job so you do not have to recreate it every time.
The diagram below shows a real simple case where I add tLogCatcher and tSendMail directly to the job. When there is an error it will send me an email with the details. You can use any of the columns in row11, I am only using job and message in my example.
This error : For input string "fabrik"
is generated by the tFileInputExcel component when encountering a non valid field (expected : integer ; given : string). You can't directly catch this error with the tFileInputExcel component (it's just printed out on the console).
However, you can use a tSchemaComplianceCheck component after your tFileInputExcelComponent : it will throw an error if a data is not valid for your schema. This component has a reject link to catch the error.
tFileInputExcel->tSchemaComplianceCheck->tMap->tMSOutput
If you use tLogCatcher component to catch the error then, at the end of the flow, you can add a tBufferOutput component. Keep the fields with the information you want for.
component configuration
The result will be like this (note that they are shown in the same order):
result

Enterprise service object from WSDL returns null

I created a service consumer through the wizard, based on a WSDL. Proxy object is generated, all structures and methods are found. Then, I add a logical port through SOAMANAGER - all fine, it pings and the connection works.
I populate the input structure, call my method and get an error: Error during proxy processing (PART UNKNOWN (NULL)). This is a very useless error message to me.
So, I activate all manners of tracing, so I can see what's going on calling and retrieving data. I can see that
My proxy is called correctly
The payload sent TO the service looks correct
The payload received FROM the service is correct. I know this because it's identical to the XML I get back calling the service through other means.
The transformation is empty
Here a screen of (the start of) the returned XML. getRecordsResult set is what I need:
This is the second response, after "conversion":
Nothing about this service has been customized: it's generated straight up through the wizard. I have already deleted and recreated it but no results.
Anyone got any advice on what to do next?

How to solve error in windows phone 8 application when retrieving app from background with web services?

I am developing application and facing a problem when I use web services.
At any page which request web service, if app goes to background (by search or menu press for example) before request complete it causes an error when I retrieve the application from background again:
An error (Exception of type 'System.Net.WebException' was thrown.) occurred while transmitting data over the HTTP channel.
Any solution for this problem ?
When your application is sent to background, it is suspended, and all connections are therefore cut off. There's nothing you can do about that. Just catch the error and retry the call to the webservice.
You need to call the webservice again when the application is reactivated. One way of doing it is to maintain a bool variable flag.
set it to true when the webservice is started.
set it back to false when the response is received
in the Application_Activated event handler(App.xaml.cs) check the status of flag and call the webservice again if the flag is true.
Otherwise if you just wish to keep your webservice running under lock screen then set
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
If your app goes to background your webrequest wont complete, You cant do anything about that. But you can prevent crash.
When you know the app is going background ( may be in onNavigatedFrom()) you detach the handler you previously attached to xxCompleted event or handle the thrown exception in handler for xxCompleted in the same way. The first solution implies you service client object must be a class member (private maybe), otherwise it wont be in scope in onNavigatedFrom(). To complete the request later you may use a marker ( bool successful, required) and in OnNavigatedTo() you can do like:
if(required && !successful)
{
// make the request again
}
still exception will be caught in the generated reference file, but the app wont crash and you'd know when you need to make the webrequest again.
I found the same problem, when I tried to fetch a sas uri and calling the PhotoChooserTask.show() simultaniously. So I had to ensure that webrequest is complete before the calling PhotoChooserTask.show().