简体   繁体   English

为什么我从 ASP.net Core 2.2 调用的 SOAP 调用返回 null 结果?

[英]Why is my SOAP call from ASP.net Core 2.2 returning a null result?

I'm having an issue where some SOAP calls are returning null objects in ASP.netCore 2.2.我遇到了一些 SOAP 调用在 ASP.netCore 2.2 中返回 null 对象的问题。 I appreciate any help that anyone can give, I'm not getting much support from the vendor and I know this may be a lot to ask.我感谢任何人可以提供的任何帮助,我没有从供应商那里得到太多支持,我知道这可能需要很多。

I'm able to make some calls successfully and get expected results.我能够成功拨打一些电话并获得预期的结果。 Other calls are received by the API successfully (for example I can post data to the API), and return results in SOAP UI, but in my ASP.net application the return objects are null. Other calls are received by the API successfully (for example I can post data to the API), and return results in SOAP UI, but in my ASP.net application the return objects are null. I've confirmed that the data I'm sending works.我已经确认我发送的数据有效。 The result does contain the expected model types, but the contents of the models are null.结果确实包含预期的 model 类型,但模型的内容是 null。

The call that works returns a simple model, the call that doesn't work has a more complicated return type.有效的调用返回一个简单的 model,无效的调用具有更复杂的返回类型。 I suspect that is the important difference, but I can't see anywhere to debug how things go wrong.我怀疑这是重要的区别,但我看不到任何地方可以调试 go 的错误。 The result process does hit the constructor for the return object, but it hits the empty constructor, not the one that I'd expect to return the value.结果过程确实命中了返回 object 的构造函数,但它命中了空构造函数,而不是我期望返回值的构造函数。 I don't know if that's an issue or not, or how to troubleshoot it.我不知道这是否是一个问题,或者如何解决它。 I also have my doubts about the namespace in use on the WSDL code.我也对 WSDL 代码上使用的命名空间有疑问。 I can't resolve that address, so it it's used for deserialization it seems like that would be an issue.我无法解析该地址,因此它用于反序列化,这似乎是个问题。 Do I need to add that to my project somehow?我是否需要以某种方式将其添加到我的项目中?

The code for the API calls is generated by a WSDL. API 调用的代码由 WSDL 生成。 I'm new to SOAP APIs and WSDLs, so this has been tough so far.我是 SOAP API 和 WSDL 的新手,所以到目前为止这很难。 There's unfortunately a lot happening here that I don't understand but I hope i'm close since I can get some calls to work.不幸的是,这里发生了很多我不明白的事情,但我希望我已经接近了,因为我可以接到一些工作电话。 Much of appears to be 'black-box' as far as I'm concerned.就我而言,大部分似乎都是“黑匣子”。 I'm not sure where else to turn.我不知道还能去哪里。

Here is the call that works successfully:这是成功运行的调用:

My call that works:我的电话有效:

var task = await cardManagementEPClient.getCardAsync(EFSConnection.ClientID, testCardNumber);

My call that returns a null result:我的调用返回 null 结果:

var task = await cardManagementEPClient.getPayrollCashHistoryAsync(EFSConnection.ClientID, cardNumber, beginDate, DateTime.Now);

The WSDL interface for the calls:用于调用的 WSDL 接口:

namespace Project.EFS.Interfaces
{    
    [System.ServiceModel.ServiceContractAttribute(Namespace = "http://com.tch.cards.service", ConfigurationName = "CardManagementEP")]
    public interface ICardManagementEP
    {
        [System.ServiceModel.OperationContractAttribute(Action = "", ReplyAction = "*")]
        [System.ServiceModel.XmlSerializerFormatAttribute(Style = System.ServiceModel.OperationFormatStyle.Rpc, SupportFaults = true)]
        [return: System.ServiceModel.MessageParameterAttribute(Name = "result")]
        System.Threading.Tasks.Task<WSCard> getCardAsync(string clientId, string cardNumber);

        [System.ServiceModel.OperationContractAttribute(Action = "", ReplyAction = "*")]
        [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)]
        System.Threading.Tasks.Task<getPayrollCashHistoryResponse> getPayrollCashHistoryAsync(getPayrollCashHistoryRequest request);
//Additional methods omitted for brevity
}

The WSDL interface implementation: WSDL接口实现:


namespace Project.EFS
{
    [System.ServiceModel.ServiceContractAttribute(Namespace = "http://com.tch.cards.service", ConfigurationName = "CardManagementEP")]
    public partial class CardManagementEPClient : System.ServiceModel.ClientBase<ICardManagementEP>, ICardManagementEP
    {
        public System.Threading.Tasks.Task<WSCard> getCardAsync(string clientId, string cardNumber)
        {
            return base.Channel.getCardAsync(clientId, cardNumber);
        }



[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
        System.Threading.Tasks.Task<getPayrollCashHistoryResponse> ICardManagementEP.getPayrollCashHistoryAsync(getPayrollCashHistoryRequest request)
        {
            return base.Channel.getPayrollCashHistoryAsync(request);
        }

        public System.Threading.Tasks.Task<getPayrollCashHistoryResponse> getPayrollCashHistoryAsync(string clientId, string cardNumber, System.DateTime begDate, System.DateTime endDate)
        {
            getPayrollCashHistoryRequest inValue = new getPayrollCashHistoryRequest();
            inValue.clientId = clientId;
            inValue.cardNumber = cardNumber;
            inValue.begDate = begDate;
            inValue.endDate = endDate;
            return ((ICardManagementEP)(this)).getPayrollCashHistoryAsync(inValue);
        }

    //Additional methods omitted for brevity
    }
}

The WSDL models: WSDL 型号:

namespace Project.EFS.Models
{
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://com.tch.cards.service/types")]
    public partial class WSCard
    {

        private string cardNumberField;


        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable = true, Order = 0)]
        public string cardNumber
        {
            get
            {
                return this.cardNumberField;
            }
            set
            {
                this.cardNumberField = value;
            }
        }
        //Additional fields, getters, and setters omitted
    }

[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://com.tch.cards.service/types")]
    public partial class WSCashRecord
    {

        private double amountField;

        [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = 0)]
        public double amount
        {
            get
            {
                return this.amountField;
            }
            set
            {
                this.amountField = value;
            }
        }
        //Additional fields, getters, and setters omitted
    }
}

namespace Project.EFS.Methods
{
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    [System.ServiceModel.MessageContractAttribute(WrapperName = "getPayrollCashHistoryResponse", WrapperNamespace = "http://com.tch.cards.service", IsWrapped = true)]
    public partial class getPayrollCashHistoryResponse
    {

        [System.ServiceModel.MessageBodyMemberAttribute(Namespace = "", Order = 0)]
        [System.Xml.Serialization.XmlArrayAttribute()]
        [System.Xml.Serialization.XmlArrayItemAttribute("value", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
        public WSCashRecord[] resultWSCashRecord;

        public getPayrollCashHistoryResponse()
        {
        }

        public getPayrollCashHistoryResponse(WSCashRecord[] result)
        {
            this.resultWSCashRecord = result;
        }
    }
}

I could be blind but I dont see anything in your WSDL etc for getCurrentCashAllAmountsAsync我可能是盲人,但我在您的 WSDL 等中看不到 getCurrentCashAllAmountsAsync 的任何内容

I see it for getCardAsync and getCashHistoryAsync我看到它用于 getCardAsync 和 getCashHistoryAsync

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP.NET Core 2 - GetUserIdAsync 返回带有 Guid Id 的空结果 - ASP.NET Core 2 - GetUserIdAsync returning null Result with Guid Ids 从 ASP.NET Core 2.2 迁移后,ASP.NET Core 3.1.1 Jwt 重定向而不是返回 http 状态 401 - ASP.NET Core 3.1.1 Jwt redirects instead of returning http status 401 after migration from ASP.NET Core 2.2 返回 ASP.NET Core 2.2 中新创建的资源的 URI - Returning the URI of a newly created resource in ASP.NET Core 2.2 在ASP.Net Core 2.2中,复杂对象以NULL的形式出现在HttpPut中 - Complex object is coming as NULL for HttpPut in ASP.Net Core 2.2 ASP.NET Core 2.2:从 VSCode 本地调用 GET 成功,但从 IIS 调用失败 - ASP.NET Core 2.2: GET call succeeds locally from VSCode, but fails from IIS Call MySql stored procedure which take 2 parameters from asp.net core 2.2 web API controller - Call MySql stored procedure which take 2 parameters from asp.net core 2.2 web API controller 从我的 React 应用程序调用我的 asp.net 核心 controller 并在尝试获取它时返回 null 时不会生成 Cookie - Cookie does not generate when calling my asp.net core controller from my react app and returning null when try to get it 为什么在ASP.NET Core 2.2中没有解析TagHelper HtmlAttributeName - Why is the TagHelper HtmlAttributeName not resolved in ASP.NET Core 2.2 为什么此MVC路由不起作用(ASP.Net Core 2.2) - Why is this MVC route not working (ASP.Net Core 2.2) Asp.Net Core 连接服务 SOAP 方法始终 Null - Asp.Net Core Connected Service SOAP Method Always Null
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM