简体   繁体   中英

System.ServiceModel.FaultException - how to solve this

I am standing up an API that connects to a WSDL for an imaging system. I can successfully make the call I am attempting with SoapUI, so there isn't an issue with the WSDL. Before making the call that is throwing this exception I can successfully return the login session token (If I comment out this code I an release the session as well). So I can communicate with the WSDL, just not this call. I don't really understand this exception and online searches have just confused me more.

This is a .NET Core project (C#).

$exception {"Synergy Application Error"} System.ServiceModel.FaultException Action null string

  • Code {System.ServiceModel.FaultCode} System.ServiceModel.FaultCode
  •  D HelpLink null string
  •  InnerException null System.Exception Message "Synergy Application Error" string
  •  Reason {Synergy Application Error} System.ServiceModel.FaultReason Source "System.Private.ServiceModel" string StackTrace " at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)\r\n at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)\r\n at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass1_0.<CreateGenericTask>b__0(IAsyncResult asyncResult)\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at Simnet.SimnetConnector.<GetCheckBySearchInteralAsync>d__1.MoveNext() in C:\\Repositories\\SynergyApi\\SynergyApi\\SimnetServices\\Session\\Checks\\GetCheckImageAsync.cs:line 29" string
  •  TargetSite {Void HandleReply(System.ServiceModel.Dispatcher.ProxyOperationRuntime, System.ServiceModel.Dispatcher.ProxyRpc ByRef)} System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
  •  Static members
  •  Non-Public members
  •  this {Simnet.SimnetConnector} Simnet.SimnetConnector
  •  checkSearchDto {SynergyApi.Models.CheckSearchDto} SynergyApi.Models.CheckSearchDto sessionToken "I removed the sessioni token that was here" string
  •  e {"Synergy Application Error"} System.Exception {System.ServiceModel.FaultException}
  •  ex null System.Exception

Please help me understand this exception and how to fix it. I have asked the other programmers at work and got an I don't know.

Here is the code that calls the wsdl

    using System;
using System.Threading.Tasks;
using SimnetWebService;
using SynergyApi.Models;

namespace Simnet
{
    public partial class SimnetConnector :ISimnetConnector
    {
        public Task<GetItemBySearchResponse> GetCheckBySearchAsync(CheckSearchDto checkSearchDto, string sessionToken)
        {
            return GetCheckBySearchInteralAsync(checkSearchDto, sessionToken);
        }

        private async Task<GetItemBySearchResponse> GetCheckBySearchInteralAsync(CheckSearchDto checkSearchDto, string sessionToken)
        {
            try
            {
                SynOptionEnums[] synOptionEnums = new SynOptionEnums[1];
                synOptionEnums[0] = 0;
                SynItemRequest synItemRequest = new SynItemRequest()
                {
                    StartPage = CheckSearchOptions.StartPage,
                    NumberOfPages = CheckSearchOptions.NumberOfPages,
                    Extension = string.Empty,
                    Options = synOptionEnums
                };

                GetItemBySearchResponse getItemBySearchResponse =
                    await _service.GetItemBySearchAsync(sessionToken, CheckSearchOptions.CheckSearchName, CheckSearchEnum,
                    checkSearchDto.CheckSearchXML, CheckSearchOptions.SearchTimeout, synItemRequest);

                return getItemBySearchResponse;
            }
            catch (Exception e)
            {
                //TODO: handle exception, log exception
                var ex = e;
                throw;
            }
        }
    }   
}

Ok so I have solved the issue. It was an error in the XML search parameter. The exception was totally not helpful in finding that. Another coworker found where the error was...you know you can't see your own mistakes. Thank you to anyone that attempted to look at this for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM