Also tried
STEP 1. in my WCF service code (it's in C# for those who cares)
WebOperationContext.Current.OutgoingResponse.ContentType = "text/
javascript";
STEP 2.
var myAjax = new Ajax.Request(
url,
{
method: 'get',
contentType: 'text/javascript',
parameters: oParam,
evalJSON: 'force',
onComplete: showResponse,
onFailure: function() {
alert("FindBlog call failed.");
}
}
);
No luck... not sure if IIS on my XP box has anything to do with it...
http://www.mail-archive.com/[email protected]/msg13342.html
http://groups.google.com.mx/group/rubyonrails-spinoffs/msg/1797c4678232b299
http://blog.csdn.net/orain/archive/2008/12/31/3663198.aspx
On Jun 2, 10:46 pm, devvvy <[email protected]> wrote:
> hello
>
> THE PROBLEM
> ------------------------------------------------------------
> I have an WCF operation exposed using an endpoint configured to use
> "webHttpBinding". My problem is, while response code it seems to
> suggest that operation was indeed completed successfully and returned
> array of one "Blog" object (and I ran debugger on Visual Studio
> against WCF operation code and it returned successfully and returned
> one "Blog" object), "responseJSON", "responseText" was all NULL (I am
> expecting one "Blog" object, as seen on debugger attached to WCF on
> server side).
>
> DETAIL - WCF Operation Contract
> ------------------------------------------------------------
> [WebGet(BodyStyle = WebMessageBodyStyle.WrappedRequest,
> ResponseFormat =
> WebMessageFormat.Json)]
> Blog[] GetBlogstring strLogon);
>
> DETAIL - Javascript invoke using prototype.js - Ajax.Request
> ------------------------------------------------------------
> I called it from Javascript:
>
> function FindBlog() {
> var url = '<%=FindBlogServiceOpURL%>';
> var oUserNameTxt = document.getElementById('txtUserName');
> var oParam = 'strLogon=' + oUserNameTxt.value;
>
> var myAjax = new Ajax.Request(
> url,
> {
> method: 'get',
> contentType:
> 'application/json',
> parameters: oParam,
> onComplete: showResponse,
> onFailure: function() {
> alert("FindAssociatedGroup call
> failed.");
> }
> }
> );
> }
>
> DETAIL - Javascript response handler
> ------------------------------------------------------------
> function showResponse(originalRequest) {
> var oLoading = document.getElementById('loadingimg');
> var oDivGroups = document.getElementById('divgroups');
> var oLoadingFailed = document.getElementById('loadingfailed');
>
> /*
> REF:http://www.prototypejs.org/api/ajax/response
>
> 0 corresponds to "Uninitialized"
> 1 to "Loading"
> 2 to "Loaded"
> 3 to "Interactive"
> 4 to "Complete"
> */
> if (originalRequest.readyState == 4) {
> alert('showResponse, operation completed. ' +
> originalRequest);
> alert('responseJSON: ' + originalRequest.responseJSON
> + ',
> headerJSON: ' + originalRequest.headerJSON + ', responseText: ' +
> originalRequest.responseText);
>
> ...
> oDivBlogs.innerHTML = originalRequest.responseJSON;
>
> } else {
> alert('showResponse, operation failed.' +
> originalRequest);
> ... more code ...
> }
> }
>
> Any suggestion please? Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---