首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >标头属性/字段必须为SoapHeader类型或派生类型,或SoapHeader或SoapUnknownHeader数组。

标头属性/字段必须为SoapHeader类型或派生类型,或SoapHeader或SoapUnknownHeader数组。
EN

Stack Overflow用户
提问于 2016-02-05 16:11:43
回答 1查看 2.3K关注 0票数 2
代码语言:javascript
复制
using System.Data;
using System.Web.Services;
using System.Web.Services.Protocols;


namespace MyServices
{
    /// <summary>
    /// Summary description for Enroll
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Enroll : WebService
    {
        public Credentials Credentials = new Credentials();

        [WebMethod(Description = "This method call will insert a public note with the given comments", EnableSession = false)]
        [SoapHeader("Credentials")]
        public bool ActivityInsert(int docId, string activityType, string comments, string userNameOn247, string userNameEt)
        {
            return EnrollBl.ActivityInsertBl(docId, activityType, ref comments, userNameOn247, userNameEt, this.Credentials);
        }

        [WebMethod(Description = "This method call will insert the enrollment document into the database and return the relevant document id.", EnableSession = false)]
        [SoapHeader("Credentials")]
        public EnrollResponse EnrollmentInsert(Enrollment enrollmentRequest)
        {
            return EnrollBl.EnrollmentInsertBl(enrollmentRequest, this.Credentials);
        }

        [WebMethod(Description = "This method call will retrieve the pdf file based on document id", EnableSession = false)]
        [SoapHeader("Credentials")]
        public object EnrollmentFile(int documentId)
        {
            return EnrollBl.EnrollmentFileBl(documentId, this.Credentials);
        }

        [WebMethod(Description = "This method call will update the enrollment document status from Ready to Approved and also insert a public note with the given comments", EnableSession = false)]
        [SoapHeader("Credentials")]
        public bool EnrollmentUpdate(int docId, string activityType, string comments, string userNameEt, string userNameOn247)
        {
            return EnrollBl.EnrollmentUpdateBl(docId, activityType, ref comments, userNameOn247, userNameEt, this.Credentials);
        }

        [WebMethod(Description = "This method call will retrieve the history details for the given document id", EnableSession = false)]
        [SoapHeader("Credentials")]
        public DataTable EnrollmentHistory(int documentId)
        {
            return EnrollBl.EnrollmentHistoryBl(documentId, this.Credentials);
        }

        [WebMethod(Description = "This method call will retrieve all the documents that match the search criteria", EnableSession = false)]
        [SoapHeader("Credentials")]
        public DataTable EnrollmentSearch(SearchEnrollment searchParams)
        {
            return EnrollBl.EnrollmentSearchBl(searchParams, this.Credentials);
        }

        [WebMethod(Description = "This method call retrieves all the active form types as dataset", EnableSession = false)]
        [SoapHeader("Credentials")]
        public DataSet FormList()
        {
            return EnrollBl.FormListBl(this.Credentials);
        }

        [WebMethod(Description = "This method call retrieves all document statuses as dataset", EnableSession = false)]
        [SoapHeader("Credentials")]
        public DataSet StatusList()
        {
            return EnrollBl.StatusListBl(this.Credentials);
        }
    }
}

我创建了上面的Webservice,并将soap头属性添加到我正在获得以下错误的服务中

标头属性/字段Enroll.Credentials必须是SoapHeader类型或派生类型,或者是SoapHeader或SoapUnknownHeader数组。

描述:在执行当前web请求时发生了未处理的异常。请查看堆栈跟踪以获得有关错误的更多信息,以及它起源于代码的位置。

异常详细信息: System.Exception: header属性/字段Enroll.Credentials必须是SoapHeader类型或派生类型,或者是SoapHeader或SoapUnknownHeader数组。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-02-05 18:26:58

我将SOAP头类属性继承到凭据类,然后web服务正常工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35228626

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档