Connecting to a REST webservice and force it to return XML instead of JSON - InfoPath Dev
in

InfoPath Dev

Connecting to a REST webservice and force it to return XML instead of JSON

Last post 06-17-2013 12:48 AM by Jimmy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-05-2013 06:44 AM

    • ejw179
    • Not Ranked
    • Joined on 03-22-2013
    • Posts 9

    Connecting to a REST webservice and force it to return XML instead of JSON

    Hey! I have a webservice that by default returns JSON, i need to add "content-type: application/xml" to the header of my request to force it to return XML to infopath. Any tips?
  • 06-17-2013 12:48 AM In reply to

    Re: Connecting to a REST webservice and force it to return XML instead of JSON

    I think the header you actually want to change is the Accept: header (Content-Type is a response header), and I've done a fair bit of searching, but it looks like InfoPath's buit-in data connections simply don't provide a way to modify the headers, even if you use code. It appears that InfoPath sends an "Accept: */*" header with its requests, probably in an attempt to avoid excluding services that would work otherwise.

    The only alternative I can think of on the InfoPath side is to manually construct an HTTP request in code and then place the response into one of your data sources.

     Is this web service something that you or someone at your organization might be able to modify? If so, perhaps you could add a parameter to indicate the type of response type you want (and default to JSON so you don't break any existing clients).

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.