Pages

Saturday, February 23, 2013

Re: consume wcf service

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.


View the original article here

0 comments:

Post a Comment