Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
344 views
in Technique[技术] by (71.8m points)

c# - 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)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass1_0.<CreateGenericTask>b__0(IAsyncResult asyncResult)
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
       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;
            }
        }
    }   
}
question from:https://stackoverflow.com/questions/65846548/system-servicemodel-faultexception-how-to-solve-this

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...