2 Replies Latest reply: Feb 23, 2013 10:35 PM by Sunita Thorat
Sunita Thorat Level 1 Level 1 (0 points)

How to consume wcf service in iphone?

  • Llessur999 Level 4 Level 4 (1,190 points)

    Xcode does not automatically create service client proxy classes like Visual Studio or other IDE's. Read my post (#2) in this thread, which includes an example using NSURLConnection.

     

    https://discussions.apple.com/message/21319095#21319095

     

    Details of your approach will depend on the specific WCF service contract. For example many WCF operations are not SOAP so instead of POSTing SOAP envelope XML as the body, you either GET (for WebGet operations) with querystring parameters or POST (for WebInvoke operations) a wrapped (WebMessageBodyStyle.WrappedRequest) or unwrapped (WebMessageBodyStyle.Bare) JSON body.

     

    If you have invoked the WCF operations from JavaScript, Objective-C will be very similar.  If you are currently using jQuery.ajax, you will need to programmatically perform some of the steps that .ajax handles automatically.

     

    If you are the developer of the WCF service, you have some flexibility to make it easy for yourself.

     

    Once you have a very good understanding how everything works, you can then survey 3rd-party libraries to see whether one fits your needs (RestKit, MKNetworkKit, etc.).  Some libraries can declaratively bind request and response attributes to the model.

  • Sunita Thorat Level 1 Level 1 (0 points)

    HiLlessur999,

     

    Thanks for the reply.