Ajax Enabled Wcf Service cant find specific method

Attareewibrar

New Member
I have strange behavior of Webservice. Right now webservice looks like : \[code\][ServiceContract(Namespace = "")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class Service1 { // To use HTTP GET, add [WebGet] attribute. (Default ResponseFormat is WebMessageFormat.Json) // To create an operation that returns XML, // add [WebGet(ResponseFormat=WebMessageFormat.Xml)], // and include the following line in the operation body: // WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml"; [OperationContract] public string DoWork() { // Add your operation implementation here return "Hello there"; } // Add more operations here and mark them with [OperationContract] }\[/code\]And i can get Read from it in JS without problems: \[code\] <script> function doWork() { Service1.DoWork(onSuccess, onFailure); } function onSuccess(result) { document.getElementById('txtValueContainer').value = http://stackoverflow.com/questions/12493487/result; } function onFailure(result) { window.alert(result); }</script>\[/code\]But, as soon as i am trying to send over something else then strings for example : \[code\] [OperationContract] public Question[] OurServerOutput(string userid) { return Question.getQuestionsForUser(new Guid(userid)).ToArray(); }where public static IEnumerable<Question> getQuestionsForUser( Guid userGuid) { LinqConnectionDataContext context = new LinqConnectionDataContext(); var query = from c in context.Questions where c.UidUser == userGuid select c; return query; }\[/code\]Javascript cant find my Service anylonger and i am getting an error: \[code\]Unhandled exception at line 132, column 13 in http://localhost/0x800a1391 - Microsoft JScript runtime error: 'Service1' is undefined\[/code\]How do i send Array over Ajax Enabled WebService?
 
Back
Top