How to handle a error return by Web Service

2
Hi All, I am getting an error form a web service that does currency conversions and I would like to know how to handle the error while processing the response. Currently I am using a XMLtoDomainMapping to process the response and when the response is an error, Mendix just throws up an error box. I would like to handle this more gracefully. Edit I see a good response in the a previous question here. Thanks Al Here is the stack trace: An error has occurred while handling the request. [User 'Anonymous_c1436a16-851c-4a0e-b2ce-402a8e596ad6' with roles 'Administrator'] com.mendix.core.CoreException: Exception occurred in action 'Microflow [CurrencyConverter.GetAllExchangeRates]', all database changes executed by this action were rolled back at com.mendix.core.actionmanagement.CoreAction.d(SourceFile:553) Caused by: com.mendix.core.CoreException: Exception occurred in microflow 'CurrencyConverter.GetAllExchangeRates' for activity 'NestedLoopedMicroflow', all database changes executed by this microflow were rolled back at kP.b(SourceFile:251) Caused by: com.mendix.core.CoreException: Exception occurred in microflow 'CurrencyConverter.GetAllExchangeRates.nested.14421' for activity 'NestedLoopedMicroflow', all database changes executed by this microflow were rolled back at kP.b(SourceFile:251) Caused by: com.mendix.core.CoreException: Exception occurred in microflow 'CurrencyConverter.GetAllExchangeRates.nested.14421.nested.14423' for activity 'Call web service 'GetConversionRate'', all database changes executed by this microflow were rolled back at kP.b(SourceFile:251) Caused by: com.mendix.modules.webservices.WebserviceException: Invalid webservice call, received SOAP fault response: <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-US">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://www.restfulwebservices.net/ServiceContracts/2008/01:FromCurrency. The InnerException message was 'Invalid enum value 'TJS' cannot be deserialized into type 'CurrencyCode'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.'. Please see InnerException for more details.</faultstring><detail><exceptiondetail xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><helplink i:nil="true"/><innerexception><helplink i:nil="true"/><innerexception i:nil="true"/><message>Invalid enum value 'TJS' cannot be deserialized into type 'CurrencyCode'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.</message><stacktrace> at System.Runtime.Serialization.EnumDataContract.ReadEnumValue(String value, Int32 index, Int32 count) at System.Runtime.Serialization.EnumDataContract.ReadEnumValue(XmlReaderDelegator reader) at System.Runtime.Serialization.EnumDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, DataContract& dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns) at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName) at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlDictionaryReader reader, Boolean verifyObjectName) at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest)</stacktrace><type>System.Runtime.Serialization.SerializationException</type></innerexception><message>The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://www.restfulwebservices.net/ServiceContracts/2008/01:FromCurrency. The InnerException message was 'Invalid enum value 'TJS' cannot be deserialized into type 'CurrencyCode'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.'. Please see InnerException for more details.</message><stacktrace> at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameterPart(XmlDictionaryReader reader, PartInfo part, Boolean isRequest) at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameter(XmlDictionaryReader reader, PartInfo part, Boolean isRequest) at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeParameters(XmlDictionaryReader reader, PartInfo[] parts, Object[] parameters, Boolean isRequest) at System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest) at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest) at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</stacktrace><type>System.ServiceModel.Dispatcher.NetDispatcherFaultException</type></exceptiondetail></detail></s:fault></s:body></s:envelope> at lJ.a(SourceFile:153) at lJ.a(SourceFile:77) at com.mendix.modules.webservices.WebserviceModule.callWebservice(SourceFile:114) at bI.a(SourceFile:93) at kP.a(SourceFile:66) at eO.executeAction(SourceFile:96) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:49) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:473) at it.b(SourceFile:155) at com.mendix.core.Core.executeSync(SourceFile:167) at dF.a(SourceFile:68) at kP.a(SourceFile:66) at eO.executeAction(SourceFile:96) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:49) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:473) at it.b(SourceFile:155) at com.mendix.core.Core.executeSync(SourceFile:167) at dF.a(SourceFile:68) at kP.a(SourceFile:66) at eO.executeAction(SourceFile:96) at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:49) at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:473) at it.b(SourceFile:155) at com.mendix.core.Core.execute(SourceFile:191) at dw.execute(SourceFile:183) at ju.a(SourceFile:299) at ju.a(SourceFile:230) at ju.processRequest(SourceFile:174) at fC.a(SourceFile:71) at com.mendix.core.MxRuntime.processRequest(SourceFile:916) at com.mendix.m2ee.server.handler.RuntimeHandler.handle(RuntimeHandler.java:42) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113) at org.eclipse.jetty.server.Server.handle(Server.java:334) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:559) at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1007) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:747) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:209) at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:406) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:462) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436) at java.lang.Thread.run(Thread.java:662)
asked
0 answers