An exception of type 'System.ServiceModel.FaultException`1' occurred in mscorlib.dll but was not handled in user code - trace

I am trying to consume WCF web service and get following error. Its a third party service so dont have much control over it.
I have tried making tracing work but nothing seems to work. Cant get tracing work
Error i get is
An exception of type 'System.ServiceModel.FaultException`1' occurred in mscorlib.dll but was not handled in user code
Additional information: Shared key was empty
Inner exception comes as Null and Reason is Shared Key is empty.
Has anyone came across this problem while consuming WCF web service.
Thanks

As it a third party webservice, they didn't provide me with the code which adds 'Shared Key' variable as its individual for each client.
Asked the client and they provided the code with my shared key and that fixed the problem.

Related

Restful API debugging

I want to debug the Rest API service project with visual studio 2017.I use breakpoints , the breakpoints becomes yellow at catch exception when I hover my mouse over the e.message but I can not see the error message, also I can not see the error with Debug.Writeline in output window .
When you want to debug an API, it is not the IDE that matters. You need to think of the full flow of the API invocation. If someone is complaining that an API is not working, then you need to divide and conquer the problem. The article on debugging API driven applications detail the layers you need to be aware of. You need to consider
Client application
Client to API connection
API logic
API to database connection
Speed of API and client applications
In simple terms, if you want to see if only the API implementation works, see if there is a response for the request being sent to the API. Then check the logic. Then check the connection to database, and so on ...

RPC not working on addclose handler

I'm facing a weird problem in GWT. I generate an excel file on server side for users to download. But after the download the file should get deleted.
I have put logic to delete it on server-Side on 2 occasions. One when user logs out and another when browser is closed.
When the user logs out, it works perfectly as it has enough time to make a call to the server whereas in case of addclosehandler, it loses connection and file remains as it is.
i.e. the method on server side does not get executed.
I tried to find another way to call the method directly by importing the package and inheriting in gwt.xml. But an error was thrown at the compile time and rightly so that server side cant be inherited.
Please get me out of this.
Thanks in advance.
But after the download the file should get deleted. I have put logic
to delete it on server-Side on 2 occasions.
This does not have to do anything with the client. I don't know excactly how your progam works but generally it should work like this:
Client makes a request
Servlet generates the bytes (Is there really a need to store the bytes in a file?)
sends them to client
And that's it.

How to tell between a nonexistent service or a lack of a record?

I'm making some REST services, and as I'm implementing a GET request, I was debating about what I should do if there is no record there, for example /profile/1234. Now, if you tried to use /profiles/1234 (note the s on profiles) it would definitely be a 404 code because that URL definitely isn't found. But when it comes to there just being no 1234 profile, I'm not sure what I should return. I don't want to return {} because that might give the impression there is a record with no data. But if I return a 404 error code, how is the consumer of the API supposed to tell the difference between the two 404s?
How can I be a responsible API designer by communicating programmatically what the difference between a service that doesn't exist and a record that doesn't exist?
You can send a custom status message which will help you differentiate between the "different" 404s.
On the other hand, I wouldn't worry about that distinction. People are used to having to type api endpoints carefully. As long as they manually test their app a tiny bit the issue becomes a non-issue.

Using (Re)Captcha without any server code?

Is it posible to use the recaptcha API without any server side code? I keep getting a CORS error. Then I found this saying Recaptcha doesn't allow requests directly from browsers.
I also tried creating a php proxy on my server (although defeating the purpose of this question) but keep getting an error that the challenge field is not valid even though I'm sending the correct value.
I know that client-only captchas are inherently unsafe, but this is a low-consequences app and I need to put something in there.

Why am I getting this WSDL SOAP error with authorize.net?

I have my script email me when there is a problem creating a recurring transaction with authorize.net. I received the following at 5:23AM Pacific time:
SOAP-ERROR: Parsing
WSDL: Couldn't load from 'https://api.authorize.net/soap/v1/service.asmx?wsdl' :
failed to load external entity "https://api.authorize.net/soap/v1/service.asmx?wsdl"
And of course, when I did exactly the same thing that the user did, it worked fine for me.
Does this mean authorize.net's API is down? Their knowledge base simply sucks and provides no information whatsoever about this problem. I've contacted the company, but I'm not holding my breath for a response. Google reveals nothing. Looking through their code, nothing stands out. Maybe an authentication error?
Has anyone seen an error like this before? What causes this?
Maybe as a back up you can cache the WSDL file locally and in case of network issues use the local copy. I doubt it changes often so if you refresh it weekly that should be satisfactory as the file will probably not be stale by then.