c# - The header property/field must be of type SoapHeader or a derived type, or an array of SoapHeader or SoapUnknownHeader -
using system.data; using system.web.services; using system.web.services.protocols; namespace myservices { /// <summary> /// summary description enroll /// </summary> [webservice(namespace = "http://tempuri.org/")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] [system.componentmodel.toolboxitem(false)] // allow web service called script, using asp.net ajax, uncomment following line. // [system.web.script.services.scriptservice] public class enroll : webservice { public credentials credentials = new credentials(); [webmethod(description = "this method call insert public note 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 insert enrollment document database , return relevant document id.", enablesession = false)] [soapheader("credentials")] public enrollresponse enrollmentinsert(enrollment enrollmentrequest) { return enrollbl.enrollmentinsertbl(enrollmentrequest, this.credentials); } [webmethod(description = "this method call retrieve 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 update enrollment document status ready approved , insert public note 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 retrieve history details given document id", enablesession = false)] [soapheader("credentials")] public datatable enrollmenthistory(int documentid) { return enrollbl.enrollmenthistorybl(documentid, this.credentials); } [webmethod(description = "this method call retrieve documents match search criteria", enablesession = false)] [soapheader("credentials")] public datatable enrollmentsearch(searchenrollment searchparams) { return enrollbl.enrollmentsearchbl(searchparams, this.credentials); } [webmethod(description = "this method call retrieves active form types dataset", enablesession = false)] [soapheader("credentials")] public dataset formlist() { return enrollbl.formlistbl(this.credentials); } [webmethod(description = "this method call retrieves document statuses dataset", enablesession = false)] [soapheader("credentials")] public dataset statuslist() { return enrollbl.statuslistbl(this.credentials); } } }
i created above webservice , added soap header attribute service getting below error
the header property/field enroll.credentials must of type soapheader or derived type, or array of soapheader or soapunknownheader.
description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code.
exception details: system.exception: header property/field enroll.credentials must of type soapheader or derived type, or array of soapheader or soapunknownheader.
i inherit soap header class properties credentials class web service working properly.
Comments
Post a Comment