c# - Asmx file is not returning XML -


i practising asmx web services, encounter problem. have class file employee.cs consists of 3 fields id, name, salary.

my service code :

[scriptmethod(responseformat = responseformat.xml)] public string getemlpoyees() {    employee emps = new employee[]{       new employee ()       {          // data...       }    };    return emps; } 

here returns error red marking instance emps cannot implicitly convert type projectname.employee[] string

i think might minor issue new web service.....it's getting on nerves......how rid of issue....thanks in advance

the signature of public function getemlpoyees says going return string, instead returning emps array of employee[]

the compiler expecting return type declare in functions signature, both types should match.

you need change return type employee[] this:

[scriptmethod(responseformat = responseformat.xml)] public employee[] getemlpoyees() {    employee emps = new employee[]{       new employee ()       {          // data...       }    };    return emps; } 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -