I am calling a webservice in java using basic auth. My code is deployed in an environment and in logs I can see this error as Axis Fault "Error in deserializing body of request message for operation 'GetUser'."
I am not able to debug it right now due to some environment issues so can anyone please give me some hint on when we get such type of errors?
Related
How to disable Verbose Error Messages of soap web services?
I have one web method with some para.
Example Req:
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<GenerateTestRequest xmlns="http://tempuri.org/">
<sId>1#!aB</sId>
<mobileNum>12345678</mobileNum>
<srcType>1</srcType>
</GenerateTestRequest>
</Body>
</Envelope>
When an unexpected input was supplied into sId para instead of Int32, Then the web service returned an exception within the response content.
Example Res:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:DeserializationFailed</faultcode>
<faultstring xml:lang="en-SG">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:sId. The InnerException message was 'There was an error deserializing the object of type System.Int32. The value '1#!aB' cannot be parsed as the type 'Int32'.'. Please see InnerException for more details.</faultstring>
</s:Fault>
</s:Body>
</s:Envelope>
I don't want to display response content of exception message. Is there any way to turn off stack trace or exception details?
Is there any way to turn off stack trace or exception details?
Yes, by doing proper error handling for the SOAP web service.
A SOAP request can receive back a successful SOAP response or can receive back an unsuccessful response in the form of a SOAP Fault. People unfortunately focus on the successful cases only and let the framework they are using handle other problems.
Because SOAP is a protocol any exception on the server needs to be converted to a proper Fault response. This needs to be done by the developer by catching any exception and building appropriate Fault responses out of them, with only the needed data inside. For security reasons of course that data can't contain stacktraces or others sensitive information. But like I said, people often neglect to handle the error cases, and the framework can't build custom Faults, it can only build a SOAP fault with details from the exception that occurred, exposing it to the client.
You didn't tag this WCF but the schema namespace on the error code says windowscommunicationfoundation so I'll assume that's the web service framework. You can replace all exception messages with a generic error message by setting IncludeExceptionDetailInFaults to false (I think for your service it is set to true right now). See here for details: either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server
Or, you can do proper error handling and define and document the possible Faults a client can receive and convert any exception to one of those Faults. You can start reading here: Specifying and Handling Faults in Contracts and Services
If you are using any other web service framework or library, the idea is the same, the documentation to read will be different.
How do I send the fault code and fault string in such a way, that after my flow throws an exception, I get the desired error code and message in the SOAP error response (in FaultCode and FaultString fields).
I have a SOAP service that is being called in Mule. I am using a custom-exception-strategy for catching exceptions, and then setting spring-bean properties for code and message fields. The spring properties are being set, but my SOAP response is still the generic SOAP fault.
Also, I read that only MessagingExceptions can be handled in mule. So, how do I reproduce a messagingExcetion to test my code during development?
PT 8.50.15
We have a new integration with a third party system. They have provided the wsdl and I have used the consume web service wizard to consume it into PeopleSoft. All this does is give you the stub messages with a schema attached to each. I have written some peoplecode to send a test message out to the webservice. When the webservice returns a valid result, I have no problems. However, when the webservice returns a fault message, I get the following error:
Integration Gateway - HttpTargetConnector:ExternalApplicationException. Http status code HttpStatusCode returned : 500. (158,10623)
HttpTargetConnector:ExternalApplicationException. External System responded with an Error status. For Http Status Code explanation please check Http protocol Specifications.
I know the webservice is returning the fault message b/c I have tried the same thing in SOAPUI. Does anyone know why PeopleSoft throws up this error ONLY on the fault message?
In addition to the prior response, the 500 error you are seeing should be followed by any soap fault coming back with the response in the errorLog.html file on your gateway (or msgLog depending on the ig.log.level setting in your integrationgateway.properties file. Check the 'response' section, as well as the stack trace for additional information.
On the routing that you are using, click the 'User Exception' check box. Then you will not get the HTTP 500 error. Evaluate the response from the response message. If it's not zero, you will then be able to parse the SOAP fault and see what the returned faultstring is.
Get your Service operation corrected. I Had same issue, After i changed the SO in this code it started working
&msgRequest = CreateMessage(Operation.Operation_name, %IntBroker_Request);
I am having an issue with the SOAP , when I call my services I get this error:
<faultstring>Fault occurred while processing.</faultstring>
The following response is returned which doesn't give a clue where and why the error happens. How can I customize and show a proper detailed message to user so he/she know what they did wrong
I have gone through the CXF customization with outFaultInterceptors and inFaultInterceptors but I am not clear how I am gonna customize cxf.
This means that the web service framework is returning an unchecked exception. Try running the web service on a debugger to see where the exception is happening or wrapping the web service body inside an try/catch to print the stack trace.
I'm developing a web service (in asp.net) and I would like to have each web method report to whoever called it when an internal error occurs - for example when input validation has failed.
When I expose my web service with SOAP such errors can be reported by raising a SoapException. But what if I expose my web service with plain POST (aka Http-Post)? Other than returning a 500 Error HTTP status code, is there a standard for reporting errors or raising exceptions in this case?
Change the response object to contain a status filed, and error message (or only error message, and check at the receiver if empty), and set it properly instead of throwing an exception.
I've always just returned the 500 status code, along with a textual description of the error. Just make sure it's documented so the client can handle it correctly.