# Websevice Access through proxy (server) using SOAP client in ObjectiveC



## apoorvagajanan (May 8, 2009)

I wrote SOAPclient code in objective-c to access webservice.ie the client code uses SOAP protocol to get information from Webserver.
I want to Access Webmethod "GetLocations" from the URL:"http://secure.gbcblue.com/CMWebService36/CMWebService.asmx"; providing webservice.(it take property id as parameter & return location details to client)

But while trying to connect to webserver, my corparate proxy is not allowing me to connect to the webserver, it is giving HTTP 407 (proxy authontication required) error.


Here my code to Authentication :

NSString *p_username = @"sivaram";
NSString *p_password = @"chneider0!";
//CFStreamError err;

NSURL *proxyurl = NSURL URLWithString"http://proxy.telxsi.com:8080";
// create custom http request with auth creds
NSString *reqMethod = @"POST";

CFHTTPMessageRef proxy_req = CFHTTPMessageCreateRequest (kCFAllocatorDefault,(CFStringRef)reqMethod,(CFURLRef)proxyurl, kCFHTTPVersion1_1);
const CFStringRef kCFHTTPAuthenticationSchemeNTLM;

Boolean s = CFHTTPMessageAddAuthentication(proxy_req, res,(CFStringRef)p_username, (CFStringRef)p_password,kCFHTTPAuthenticationSchemeNTLM,true);

if(!s)
{
NSLog(@"! Failed to Add Auth credential(Proxy not Authenticated");
}
else
{
NSLog(@"******Proxy_Req Authenticated Successfully....\n");
}


But this code always gives "Failed to Add Auth credential Proxy not Authenticated"; Msg..

ie CFHTTPMessageAddAuthentication always fails, why?

Please suggest me if any other way to access webservice in objective-c using SOAP protocol.

thanks
Hariharan


----------

