Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I return a user defined object from ASMX Webservice
    text
    copied!<pre><code> [WebMethod] public engineer getItem() { DataClasses1DataContext db = new DataClasses1DataContext(); List&lt;string&gt; list = new List&lt;string&gt;(); string tcNo="13609224456"; var bilgiler = db.bilgilers.First(c =&gt; c.tc_kimlik_no ==tcNo); string adi = bilgiler.adi; string soyadi = bilgiler.soyadi; string universite = bilgiler.universite; engineer e = new engineer(tcNo, adi, soyadi, universite); return e; } </code></pre> <p>I have more than one method and I can run the webservice without error but when I call the <code>getItem()</code> method I get the following exception. How can I fix the problem?</p> <pre><code>[InvalidOperationException: Parametresiz oluşturucusu olmadığından MUHENDIS.Service1.engineer seri hale getirilemez.] System.Xml.Serialization.TypeDesc.CheckSupported() +3938411 System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference, Boolean throwOnError) +170 System.Xml.Serialization.XmlReflectionImporter.ImportMemberMapping(XmlReflectionMember xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +65 System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +236 [InvalidOperationException: 'getItemResult' yansıtmada bir hata oluştu.] System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter) +843 System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, XmlMappingAccess access) +130 System.Web.Services.Protocols.SoapReflector.ImportMembersMapping(XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, Boolean serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use, SoapParameterStyle paramStyle, String elementName, String elementNamespace, Boolean nsIsDefault, XmlReflectionMember[] members, Boolean validate, Boolean openModel, String key, Boolean writeAccess) +223 System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +2989 </code></pre> <p><em>Edit:</em> Google translates the message on the exceptions as the following:</p> <ol> <li>MUHENDIS.Service1.engineer not a parameterless constructor be serialized.</li> <li>'getItemResult' to reflect the error occurred.</li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload