I should add...

Does the NSMutableURLRequest actually send the XML data to the server?

Via the NSMutableURLRequest class, I can alter the HTTP Body, etc.
However, I need to send a SOAP/XML envelope & receive a XML response.

I don't see where in the NSNetworking docs that I can send a SOAP/XML to the 
server.

I'm puzzled. 

Ric.


On 05/16/2008 10:59 [EMAIL PROTECTED] wrote ..
> Hello, I'm having trouble determining the best path to follow.
> 
> Here's the schema in a nutshell:
> 
> [Mac <---- XML/SOAP -----> Server]
> .. where an HTTP Post connection is created and a post/reply is synchronously 
> generated.
> 
> I want to use Cocoa to do the equivalent in Java:
> 
>   StreamConnection xmlstream = null;
>   HttpConnection connection = null;
> xmlstream = (StreamConnection)Connector.open(SOAP_SERVER_URL + 
> ";deviceside=false",Connector.READ_WRITE,true);
>    ...
>    OutputStream out = connection.openOutputStream();  // HttpConnection class.
>    out.write(xmlreq.getBytes()); // Note: 'xmlreq' is type String.
>     ...                
>      // ---- Get Response -----
>      // Get the connection status
>      status = connection.getResponseCode();  // HttpConnection class.
> 
> ------------------------------
> 
> Specifically, I need to:
> 1) Open a read/write connection to a WSDL Soap server.    <-- using 
> NSURLConnection?
> 2) Change Request Properties & Methods to reflect a POST connection.  <-- 
> using
> NSMutableURLRequest?
> 3) Send a XML (SOAP envelope) to the Server; and   <-- ? inside 
> NSURLConnection?
> 4) Get a XML response.    <-- via NSURLConnection?
> 
> This is a SYNCHRONOUS, HTTP (POST) connection.
> 
> ====================
> 
> Here's my dilemma:
> 1) I thought about using the Core Foundation (CFNetworking) route:
> 
>        // Java equivalent: connection.setRequestProperty("Content-Type", 
> "text/xml;
> charset=utf-8");        
> 
>         CFHTTPMessageSetHeaderFieldValue(myRequest,CFSTR("User-Agent"), 
> CFSTR("Apple
> iPhone"));
>         CFHTTPMessageSetHeaderFieldValue(myRequest,CFSTR("Content-Type"), 
> CFSTR("text/xml;
> charset=utf-8"));
>         CFHTTPMessageSetHeaderFieldValue(myRequest,CFSTR("Accept"), 
> CFSTR("text/html"));
> 
> But I don't know how to Synchronously Send/Receive as shown in the Java code, 
> above.
> 
> 
> 2) If possible, I prefer to use the higher-level NSNetworking scheme: via 
> NSMutableURLRequest.
>      I can modify the request to be POST and I think I can modify the header 
> for
> the Content-Type, etc.
> 
>  Do I use NSURLConnection to actually TRANSMIT & RECEIVE XML data to the 
> Server
> like this?
> 
>        serverData = [NSURLConnection sendSynchronousRequest:theRequest 
>                                     returningResponse:serverResponse 
>                                     error:myError];
> 
> 3) Then, how do I flush(), close() this connection?
> 
> 4) or... must I try the CF route?
> 
> Regards,
> Ric.

_______________________________________________

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]

Reply via email to