FROM : fclee
DATE : Fri May 16 19:59:25 2008
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.
DATE : Fri May 16 19:59:25 2008
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.
| Related mails | Author | Date |
|---|---|---|
| fclee | May 16, 19:59 | |
| fclee | May 16, 20:11 | |
| Jens Alfke | May 16, 20:18 | |
| fclee | May 16, 20:20 | |
| stephen joseph but… | May 16, 20:29 | |
| fclee | May 16, 20:53 | |
| stephen joseph but… | May 16, 21:13 | |
| Jens Alfke | May 16, 21:20 | |
| Jens Alfke | May 17, 22:50 |






Cocoa mail archive

