服务参考生成不正确的方法签名

塞姆雷·曼格(CemreMengü)

我们有一个asmx Web服务项目。当我使用Add Service Reference选项将其添加到项目中时,一切正常。但是,当我的同事这样做时,他会为操作合同中定义的方法得到错误的签名。

错误的签名是指原始方法将实体作为参数接收,这些实体在我的同事的项目中作为DataSet参数生成(服务引用结构也不同,如图所示。我的同事还有很多东西)。我们正在使用VS 2013。

这是怎么回事 ?

在此处输入图片说明

我的服务参考

编辑:

服务合约

  [ServiceContract]
    public interface INetTransTntIntegration
    {
        [OperationContract]
        string CreateGlbTrns1LineCard(GlbTrns1LineCardEntity ent);

        [OperationContract]
        void CreateGlbTrns1LineCardTest();
    }

生成的代码(同事的错误代码)

namespace TNT.ServiceReference {
using System.Data;


[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(ConfigurationName="ServiceReference.INetTransTntIntegration")]
public interface INetTransTntIntegration {

    // CODEGEN: Parameter 'CreateGlbTrns1LineCardResult' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'System.Xml.Serialization.XmlElementAttribute'.
    [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCard", ReplyAction="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCardResponse")]
    [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
    TNT.ServiceReference.CreateGlbTrns1LineCardResponse CreateGlbTrns1LineCard(TNT.ServiceReference.CreateGlbTrns1LineCardRequest request);

    [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCard", ReplyAction="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCardResponse")]
    System.Threading.Tasks.Task<TNT.ServiceReference.CreateGlbTrns1LineCardResponse> CreateGlbTrns1LineCardAsync(TNT.ServiceReference.CreateGlbTrns1LineCardRequest request);

    [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCardTest", ReplyAction="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCardTestResponse")]
    [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
    void CreateGlbTrns1LineCardTest();

    [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCardTest", ReplyAction="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCardTestResponse")]
    System.Threading.Tasks.Task CreateGlbTrns1LineCardTestAsync();
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="CreateGlbTrns1LineCard", WrapperNamespace="http://tempuri.org/", IsWrapped=true)]
public partial class CreateGlbTrns1LineCardRequest {

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=0)]
    [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
    public System.Data.DataSet ent;

    public CreateGlbTrns1LineCardRequest() {
    }

    public CreateGlbTrns1LineCardRequest(System.Data.DataSet ent) {
        this.ent = ent;
    }
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(WrapperName="CreateGlbTrns1LineCardResponse", WrapperNamespace="http://tempuri.org/", IsWrapped=true)]
public partial class CreateGlbTrns1LineCardResponse {

    [System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://tempuri.org/", Order=0)]
    [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
    public string CreateGlbTrns1LineCardResult;

    public CreateGlbTrns1LineCardResponse() {
    }

    public CreateGlbTrns1LineCardResponse(string CreateGlbTrns1LineCardResult) {
        this.CreateGlbTrns1LineCardResult = CreateGlbTrns1LineCardResult;
    }
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface INetTransTntIntegrationChannel : TNT.ServiceReference.INetTransTntIntegration, System.ServiceModel.IClientChannel {
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class NetTransTntIntegrationClient : System.ServiceModel.ClientBase<TNT.ServiceReference.INetTransTntIntegration>, TNT.ServiceReference.INetTransTntIntegration {

    public NetTransTntIntegrationClient() {
    }

    public NetTransTntIntegrationClient(string endpointConfigurationName) : 
            base(endpointConfigurationName) {
    }

    public NetTransTntIntegrationClient(string endpointConfigurationName, string remoteAddress) : 
            base(endpointConfigurationName, remoteAddress) {
    }

    public NetTransTntIntegrationClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
            base(endpointConfigurationName, remoteAddress) {
    }

    public NetTransTntIntegrationClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
            base(binding, remoteAddress) {
    }

    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    TNT.ServiceReference.CreateGlbTrns1LineCardResponse TNT.ServiceReference.INetTransTntIntegration.CreateGlbTrns1LineCard(TNT.ServiceReference.CreateGlbTrns1LineCardRequest request) {
        return base.Channel.CreateGlbTrns1LineCard(request);
    }

    public string CreateGlbTrns1LineCard(System.Data.DataSet ent) {
        TNT.ServiceReference.CreateGlbTrns1LineCardRequest inValue = new TNT.ServiceReference.CreateGlbTrns1LineCardRequest();
        inValue.ent = ent;
        TNT.ServiceReference.CreateGlbTrns1LineCardResponse retVal = ((TNT.ServiceReference.INetTransTntIntegration)(this)).CreateGlbTrns1LineCard(inValue);
        return retVal.CreateGlbTrns1LineCardResult;
    }

    [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
    System.Threading.Tasks.Task<TNT.ServiceReference.CreateGlbTrns1LineCardResponse> TNT.ServiceReference.INetTransTntIntegration.CreateGlbTrns1LineCardAsync(TNT.ServiceReference.CreateGlbTrns1LineCardRequest request) {
        return base.Channel.CreateGlbTrns1LineCardAsync(request);
    }

    public System.Threading.Tasks.Task<TNT.ServiceReference.CreateGlbTrns1LineCardResponse> CreateGlbTrns1LineCardAsync(System.Data.DataSet ent) {
        TNT.ServiceReference.CreateGlbTrns1LineCardRequest inValue = new TNT.ServiceReference.CreateGlbTrns1LineCardRequest();
        inValue.ent = ent;
        return ((TNT.ServiceReference.INetTransTntIntegration)(this)).CreateGlbTrns1LineCardAsync(inValue);
    }

    public void CreateGlbTrns1LineCardTest() {
        base.Channel.CreateGlbTrns1LineCardTest();
    }

    public System.Threading.Tasks.Task CreateGlbTrns1LineCardTestAsync() {
        return base.Channel.CreateGlbTrns1LineCardTestAsync();
    }
}

我正确生成的代码

namespace TNT.NettransSvc {


    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(ConfigurationName="NettransSvc.INetTransTntIntegration")]
    public interface INetTransTntIntegration {

        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCard", ReplyAction="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCardResponse")]
        string CreateGlbTrns1LineCard(LLMTESTADAPTER.EntityClasses.GlbTrns1LineCardEntity ent);

        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCard", ReplyAction="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCardResponse")]
        System.Threading.Tasks.Task<string> CreateGlbTrns1LineCardAsync(LLMTESTADAPTER.EntityClasses.GlbTrns1LineCardEntity ent);

        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCardTest", ReplyAction="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCardTestResponse")]
        void CreateGlbTrns1LineCardTest();

        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCardTest", ReplyAction="http://tempuri.org/INetTransTntIntegration/CreateGlbTrns1LineCardTestResponse")]
        System.Threading.Tasks.Task CreateGlbTrns1LineCardTestAsync();
    }

    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public interface INetTransTntIntegrationChannel : TNT.NettransSvc.INetTransTntIntegration, System.ServiceModel.IClientChannel {
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    public partial class NetTransTntIntegrationClient : System.ServiceModel.ClientBase<TNT.NettransSvc.INetTransTntIntegration>, TNT.NettransSvc.INetTransTntIntegration {

        public NetTransTntIntegrationClient() {
        }

        public NetTransTntIntegrationClient(string endpointConfigurationName) : 
                base(endpointConfigurationName) {
        }

        public NetTransTntIntegrationClient(string endpointConfigurationName, string remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }

        public NetTransTntIntegrationClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(endpointConfigurationName, remoteAddress) {
        }

        public NetTransTntIntegrationClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : 
                base(binding, remoteAddress) {
        }

        public string CreateGlbTrns1LineCard(LLMTESTADAPTER.EntityClasses.GlbTrns1LineCardEntity ent) {
            return base.Channel.CreateGlbTrns1LineCard(ent);
        }

        public System.Threading.Tasks.Task<string> CreateGlbTrns1LineCardAsync(LLMTESTADAPTER.EntityClasses.GlbTrns1LineCardEntity ent) {
            return base.Channel.CreateGlbTrns1LineCardAsync(ent);
        }

        public void CreateGlbTrns1LineCardTest() {
            base.Channel.CreateGlbTrns1LineCardTest();
        }

        public System.Threading.Tasks.Task CreateGlbTrns1LineCardTestAsync() {
            return base.Channel.CreateGlbTrns1LineCardTestAsync();
        }
    }
}
塞姆雷·曼格(CemreMengü)

我的同事的视觉工作室由于某种原因没有自动转换实体,因此我必须为那些dll(包含实体定义/操作)显式设置重用选项,以便识别实体。

就我而言,我不必检查任何这些,但是一切正常。

我要感谢@HenkHolterman的时间。

在此处输入图片说明

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

泛型接口方法签名“不正确”

来自分类Dev

findObjectsInBackgroundWithBlock块签名不正确

来自分类Dev

ScriptManager服务参考生成忘记服务主机名的JS代码

来自分类Dev

SpecFlow Step Generation for Scenario Outline 生成不正确的方法

来自分类Dev

不正确的WCF服务参考/空的Reference.cs文件

来自分类Dev

Hibernate生成不正确的MySQL脚本

来自分类Dev

Yesod的TH生成不正确的代码?

来自分类Dev

Hibernate生成不正确的MySQL脚本

来自分类Dev

SQLAlchemy 生成的 SQL 不正确

来自分类Dev

我的Windows服务安装不正确?

来自分类Dev

Jboss EAP 7 Web 服务问题“无法解包操作”,生成了不正确的 SOAP 请求

来自分类Dev

前向参考不正确的有趣问题

来自分类Dev

Firebase Cloud Function更新参考值不正确

来自分类Dev

MPFR:未定义参考| 安装不正确?

来自分类Dev

前向参考不正确的有趣问题

来自分类Dev

HMAC SHA256 JWT签名不正确

来自分类Dev

Android Studio构建失败,字段“签名”的值不正确

来自分类Dev

为什么我的 OpenSSL/libcrypto 签名不正确?

来自分类Dev

jQuery的index方法不正确吗?

来自分类Dev

插入方法比较不正确

来自分类Dev

Excel VBA方法ROUND不正确

来自分类Dev

方法执行不正确

来自分类Dev

.joins方法返回不正确的ID

来自分类Dev

Java方法传回不正确的值

来自分类Dev

方法显示不正确的结果

来自分类Dev

指向对象的指针的方法不正确

来自分类Dev

Rails方法工作不正确

来自分类Dev

'this'在js类方法中不正确

来自分类Dev

Xcode 的方法建议不正确