Re: Getting HTTP headers from a WSMethodInvocationRef
Re: Getting HTTP headers from a WSMethodInvocationRef
- Subject: Re: Getting HTTP headers from a WSMethodInvocationRef
- From: Byron Wright <email@hidden>
- Date: Wed, 6 Sep 2006 11:19:59 -0700
On Sep 6, 2006, at 3:40 AM, Simone Manganelli wrote:
I'm trying to create a Cocoa application that uses Web Services
Core to communicate with a XML-RPC web app. The problem I'm having
is regarding setting and getting the HTTP headers for the request
and the result. The Web Services Core documentation says that I
can set additional HTTP headers using a call such as:
WSMethodInvocationSetProperty(theNewRPCCall, (CFStringRef)
kWSHTTPExtraHeaders, (CFTypeRef) headers);
This should work, I have code that does it like this. You could use
tcpdump or something other tool to verify your headers are getting
set and sent.
where the headers variable is an NSDictionary with objects and keys
for the extra HTTP headers that need to be transmitted.
The documentation also seems to imply that I should be able to
retrieve the header information by getting the message property
kWSHTTPResponseMessage after the invocation completes. I'm
attempting to do so like so:
CFHTTPMessageRef testProp = WSMethodInvocationCopyProperty
(theRPCCall, (CFStringRef) kWSHTTPResponseMessage);
have you called WSMethodInvocationInvoke ? I believe Apple's
WSMakeStubs stuff does that for you. That should return a
CFDictionaryRef. You can then get the header from that like this :
CFDictionaryRef result = WSMethodInvocationInvoke(theRPCCall);
CFHTTPMessageRef headers = (CFHTTPMessageRef)CFDictionaryGetValue
(result,kWSHTTPResponseMessage);
CFDictionaryRef headerDict = CFHTTPMessageCopyAllHeaderFields(headers);
something like that I don't use Carbon all that much.
This testProp variable always seems to return NULL, however. Is
this the correct way to retrieve HTTP headers that are transmitted
with the response to the invocation, or is there an easier/better
way to do it?
-- Simone
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40bluebearstudio.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden