Consume Json WCF service with .Net 3.5 client
Asked Answered
K

1

0

I'm having some issues accessing a WCF Web service that returns Json. Usign the WCF Test Client, I figured what config to use but this config is for .Net 4.0 and my client app is in .Net 3.5 (with no possibility for upgrade for now). This is the configuration of my behavior in .Net 4.0:

<behaviors>
   <endpointBehaviors>
       <behavior name="web">
          <webHttp defaultBodyStyle="Wrapped" defaultOutgoingResponseFormat="Xml" />
       </behavior>
   </endpointBehaviors>
</behaviors>

Unfortunately, these 2 attributes don't exist in .Net 3.5. What can I do to specify this for my client (code or other configurations) ?

Thanks

Kurgan answered 23/8, 2012 at 15:55 Comment(0)
K
0

In 3.5 you cannot set these values in config, but you can set then in code, see: http://msdn.microsoft.com/en-us/library/system.servicemodel.description.webhttpbehavior.defaultoutgoingresponseformat(v=vs.90).aspx

The default value is XML, the config example you posted is also XML, but in the text of your question says that the service returns JSON.

Kamasutra answered 26/8, 2012 at 8:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.