I got this to work! The following is the complete code. All the authorization and data is supplied by the .xml test file that I have stored within the App bundle.
Thanks all! ========================= - (IBAction)startSOAP:(id)sender { NSLog(@"\n{AppDelegate} startSOAP start"); // create the request NSError **myError; NSHTTPURLResponse **serverResponse; NSData *serverData; NSDictionary *headerFieldsDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Apple iPhone",@"User-Agent", @"text/xml; charset=utf-8", @"Content-Type", @"soapAction",@"SOAP_ACTION",nil]; @try { // 1) The Request String. // Note: smsXMLString contains the entire SMS SOAP envelope, without the <? XML declaration command >. NSString *smsXMLPath = [[NSBundle mainBundle] pathForResource:@"sms" ofType:@"xml"]; self.smsXMLString = [NSString stringWithContentsOfFile:smsXMLPath encoding:NSUTF8StringEncoding error:myError]; // ----------------------- // 2) Create the request. NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:theServerURL] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10.0]; // ----------------------- // 2a) Modify the Request from default 'GET' to 'POST': [theRequest setHTTPMethod:@"POST"]; // 2b) Modify the Headers: [theRequest setAllHTTPHeaderFields:headerFieldsDict]; // 2c) Sent the Contents of the Body to the SOAP/XML data: [theRequest setHTTPBody:[self.smsXMLString dataUsingEncoding:NSUTF8StringEncoding]]; // ----------------------- // 3) Get Synchronous Data: serverData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:serverResponse error:myError]; // ----------------------- // 4) Convert Synchronous Data into Human-Readable String (Unicode 8) format: NSString *serverDataString = [[[NSString alloc] initWithData:serverData encoding:NSUTF8StringEncoding] retain]; [[soapResponse layoutManager]replaceTextStorage:[[NSTextStorage alloc] initWithString:serverDataString]]; [serverDataString release]; } @catch (id e) { NSLog(@"\n**** {startSOAP} EXCEPTION: %@ ****\n",e); self.statusLine.stringValue = [NSString stringWithFormat:@"*** Exception flagged: %@ ***",e]; } @finally { NSLog(@"\n{startSoap} end."); } } // end startSOAP(). ========================= On 05/16/2008 12:20 Jens Alfke wrote .. > > On 16 May '08, at 11:11 AM, [EMAIL PROTECTED] wrote: > > > Via the NSMutableURLRequest class, I can alter the HTTP Body, etc. > > However, I need to send a SOAP/XML envelope & receive a XML response. > > NSURLRequest etc. have nothing to do with the type of content you > send. They don't care whether it's XML, HTML, MP3, JPEG, whatever. You > just hand them raw data to send in the body. > > > I don't see where in the NSNetworking docs that I can send a SOAP/ > > XML to the server. > > That's too bad. If only the documentation came with some kind of > "search" feature so you didn't have to ask hundreds of people for help > on every little detail. Then you'd be able to type "SOAP" into the > search field, maybe adjust the settings to "Full Text" and "Contains", > and find that documentation wherever it was! But since Xcode sucks and > has no search feature, and since Apple won't let Google index their > online docs, there's no way around it. Someone else will have to take > over answering, though, because I'm getting tired of it. > > Jens
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]