Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

consume wcf service

How to consume wcf service in iphone?

Posted on Feb 22, 2013 2:21 AM

Reply
Question marked as Best reply

Posted on Feb 22, 2013 8:18 AM

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/thread/3960907?answerId=21319095022#21319095022


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.

2 replies
Question marked as Best reply

Feb 22, 2013 8:18 AM in response to Sunita Thorat

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/thread/3960907?answerId=21319095022#21319095022


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.

consume wcf service

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.