It was just a discussion of the various options for distinguishing result format. Your web server may be using a method other than an Accept header. And btw, I was wrong about the header being only a suggestion.
BTW, that server code you showed didn't look right to my eyes. It isn't doing a "case" on the requested type and sending back different type depending on the request, i.e. I expect to see code that looks like this: http://stackoverflow.com/questions/2566759/how-can-i-generate-json-from-respond-to-method-in-rails On Wed, May 20, 2015 at 12:38 PM, mark goldin <[email protected]> wrote: > Dont understand your last message. Are you saying I need to send a > parameter to tell my code to return json? It's doing it already, it's > somewhere on way back to the client it's changed into xml. I think. > > On Wed, May 20, 2015 at 1:19 PM, Thomas Fee <[email protected]> wrote: > >> See this - >> http://stackoverflow.com/questions/1250060/rest-and-multiple-data-formats >> >> On Wed, May 20, 2015 at 12:14 PM, mark goldin <[email protected]> >> wrote: >> >>> I think that would be based on content-type? >>> >>> <Does the server respond differently? >>> Dont have a tinniest idea. >>> >>> On Wed, May 20, 2015 at 1:10 PM, Thomas Fee <[email protected]> wrote: >>> >>>> Tell me this: Suppose you make one request, in which you ask for JSON. >>>> Then a second request, in which you ask for XML. How do the two requests >>>> differ? Does the server respond differently? >>>> >>>> On Wed, May 20, 2015 at 12:07 PM, mark goldin <[email protected]> >>>> wrote: >>>> >>>>> I checked my server. Under MIME type I do see .json. Is that what you >>>>> meant? >>>>> >>>>> On Wed, May 20, 2015 at 12:40 PM, Thomas Fee <[email protected]> >>>>> wrote: >>>>> >>>>>> See this Rails example - >>>>>> http://edgeapi.rubyonrails.org/classes/ActionController/Responder.html >>>>>> >>>>>> The web server needs to know about request formats and have separate >>>>>> responders for these formats. >>>>>> >>>>>> >>>>>> On Wed, May 20, 2015 at 11:33 AM, mark goldin <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> Here is what the server returns: >>>>>>> >>>>>>> <string xmlns="something here/">{"assets":44,"projects":382}</string> >>>>>>> >>>>>>> My server code is this: >>>>>>> [WebMethod(EnableSession = true)] >>>>>>> virtual public string getCurrentSummaryWeb() >>>>>>> { >>>>>>> string json = >>>>>>> JsonConvert.SerializeObject(getCurrentSummary()); >>>>>>> return json; >>>>>>> } >>>>>>> >>>>>>> On Wed, May 20, 2015 at 8:20 AM, Brian <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>>>> Maybe you need to convert your response payload into a json object >>>>>>>> instead of a string? >>>>>>>> JSON.parse(serverResponsePayload) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Wednesday, May 20, 2015 at 9:18:06 AM UTC-4, Brian wrote: >>>>>>>>> >>>>>>>>> Sorry, I still don't understand the issue. You are trying to get >>>>>>>>> JSON, and your server is returning JSON? >>>>>>>>> Maybe I'm dumb but can you explain in another way, or provide a >>>>>>>>> plnker perhaps? http://plnkr.co/edit/rQvx8CXtmkCKR89jWn8T >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Tuesday, May 19, 2015 at 4:47:12 PM UTC-4, mark goldin wrote: >>>>>>>>>> >>>>>>>>>> It is an Angular question. My server returns json. >>>>>>>>>> >>>>>>>>>> On Tue, May 19, 2015 at 3:43 PM, Brian <[email protected]> >>>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>>> Is there an angular JS question in here somewhere? >>>>>>>>>>> >>>>>>>>>>> Open dev tools in your browser and check the payload you are >>>>>>>>>>> receiving from the server. If you're expecting JSON, and receiving >>>>>>>>>>> XML, >>>>>>>>>>> then you server is broken, or your expectations are wrong ;) >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On Tuesday, May 19, 2015 at 4:25:51 PM UTC-4, mark goldin wrote: >>>>>>>>>>>> >>>>>>>>>>>> Here is my request: >>>>>>>>>>>> >>>>>>>>>>>> Key Value >>>>>>>>>>>> Request POST /services/reports_ws.asmx/getData HTTP/1.1 >>>>>>>>>>>> Accept application/json, text/plain, */* >>>>>>>>>>>> Content-Type plain/text >>>>>>>>>>>> >>>>>>>>>>>> I am getting the result as an xml while the server returns json >>>>>>>>>>>> string. I would specify Content-Type json but then my call simply >>>>>>>>>>>> fails. >>>>>>>>>>>> >>>>>>>>>>>> Please help. >>>>>>>>>>>> >>>>>>>>>>>> Thanks >>>>>>>>>>>> >>>>>>>>>>> -- >>>>>>>>>>> You received this message because you are subscribed to a topic >>>>>>>>>>> in the Google Groups "AngularJS" group. >>>>>>>>>>> To unsubscribe from this topic, visit >>>>>>>>>>> https://groups.google.com/d/topic/angular/WSXJLjdKBVQ/unsubscribe >>>>>>>>>>> . >>>>>>>>>>> To unsubscribe from this group and all its topics, send an email >>>>>>>>>>> to [email protected]. >>>>>>>>>>> To post to this group, send email to [email protected]. >>>>>>>>>>> Visit this group at http://groups.google.com/group/angular. >>>>>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>> You received this message because you are subscribed to a topic in >>>>>>>> the Google Groups "AngularJS" group. >>>>>>>> To unsubscribe from this topic, visit >>>>>>>> https://groups.google.com/d/topic/angular/WSXJLjdKBVQ/unsubscribe. >>>>>>>> To unsubscribe from this group and all its topics, send an email to >>>>>>>> [email protected]. >>>>>>>> To post to this group, send email to [email protected]. >>>>>>>> Visit this group at http://groups.google.com/group/angular. >>>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "AngularJS" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to [email protected]. >>>>>>> To post to this group, send email to [email protected]. >>>>>>> Visit this group at http://groups.google.com/group/angular. >>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to a topic in >>>>>> the Google Groups "AngularJS" group. >>>>>> To unsubscribe from this topic, visit >>>>>> https://groups.google.com/d/topic/angular/WSXJLjdKBVQ/unsubscribe. >>>>>> To unsubscribe from this group and all its topics, send an email to >>>>>> [email protected]. >>>>>> To post to this group, send email to [email protected]. >>>>>> Visit this group at http://groups.google.com/group/angular. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "AngularJS" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To post to this group, send email to [email protected]. >>>>> Visit this group at http://groups.google.com/group/angular. >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "AngularJS" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/angular/WSXJLjdKBVQ/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at http://groups.google.com/group/angular. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "AngularJS" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/angular. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "AngularJS" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/angular/WSXJLjdKBVQ/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/angular. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
