0

I am trying to send data to a biztalk server using a POST action

I found a very good tutorial on this under this linkenter link description here

I wrote it exactly the same ( I changed the xml portion of course to reflect my parameters). but the data does not get transmitted , I know for a fact that the server require authentication . What I was expecting is the function -(void)connection:(NSURLConnection *)connection to be called but instead the function

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error

gets called. I found that the error message that I get is the following :

ERROR: with the connection Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found." UserInfo=0x210f5d70 {NSErrorFailingURLStringKey=<server path>, NSErrorFailingURLKey=<server path>, NSLocalizedDescription=A server with the specified hostname could not be found., NSUnderlyingError=0x210f5290 "A server with the specified hostname could not be found."} 

I did some research on the Code=-1003 is equivalent to kCFURLErrorCannotFindHost and I assume that this is related to the fact that the server is behind a firewall that needs authentication.

my question is the following ,assuming that the logic I have is right, is there a way to access the corporate network first with user credentials before doing the POST action ? I think that if I get this fixed things should work

Thanks!

user1415780
  • 1,153
  • 5
  • 16
  • 33

1 Answers1

0

That error message suggests that it cannot reach the server at all as opposed to an authentication problem. Are you able to navigate to that site in Safari from your iPad/Phone? Do you need to be connected to a VPN to hit the site?

You should get a different error if you have an authentication problem.

Robert Zahm
  • 1,877
  • 2
  • 12
  • 8
  • I tried and can t reach this site from safari .Unfortunately VPN is not an option for me. – user1415780 Oct 24 '12 at 15:24
  • If you cannot connect to the server, then this isn't an authentication problem. You have to be able to access the server in order to download data. – Robert Zahm Oct 24 '12 at 15:30
  • In other words - this URL needs to be available on the public Internet, or your iOS device will need to be on the internal network, or on a VPN in order for you to access the site and even have a chance to provide credentials. – Robert Zahm Oct 24 '12 at 15:37
  • I checked with my security team and you are right :) . they gave me a public link instead , all the functions get called as expected but nothing is transmitted to the server ... can it be a security issue ( I am using https and not http ...)? – user1415780 Nov 27 '12 at 15:22
  • What error are you receiving, and have you confirmed that you are able to access and POST to these URLs from the extranet? – Robert Zahm Nov 28 '12 at 17:04
  • I am not receiving any error . and yes this is an external access and I can access from anywhere and post on it. I just don t see what I have submitted on the servers ... – user1415780 Nov 28 '12 at 18:38
  • To confirm - you aren't receiving an error message from the server? Are you sure that your request is reaching the server? If so, how? You could try using something like Fiddler to examine the traffic. – Robert Zahm Nov 29 '12 at 16:07
  • Yes I am not receiving an error from the server . I think yes it is reaching the server because I get an authentication challenge. – user1415780 Nov 29 '12 at 16:26
  • How are you responding to the challenge? We implement something like the following for our asynchronous connections (had to modify a bit to get under the character limit): – Robert Zahm Nov 29 '12 at 16:43
  • - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { if ([challenge previousFailureCount] == 0) { NSURLCredential *newCredential = [NSURLCredential credentialWithUser:USERNAME password:PASSWORD persistence:NSURLCredentialPersistenceForSession]; [[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge]; } } – Robert Zahm Nov 29 '12 at 16:43
  • it s almost the same ( I don t have the if statment fot the previousFailureCount but I included it now ) – user1415780 Nov 29 '12 at 18:59
  • I'm not sure what behavior you are seeing then, I assume this has diverged from the original question? What callbacks are hit after you send the credentials? – Robert Zahm Nov 30 '12 at 15:13
  • I created another Question for this new issues under this link : http://stackoverflow.com/questions/13627810/objective-c-unable-create-an-xml-post-action – user1415780 Nov 30 '12 at 21:26
  • I'll respond on the new question. Did this post answer your original question though? – Robert Zahm Nov 30 '12 at 21:56