Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cannot set Content-Type of Sherlock HTTP POST requests



This is RadarWeb Bug #3136237.

Using the sample code snipped provided in http://developer.apple.com/techpubs/macosx/AdditionalTechnologies/ Sherlock/Tasks/CreatingWebServices.html , it's impossible to set the HTTP POST request's Content-Type header properly.

The following code, when executed from Sherlock's XQuery channel, demonstrates the problem:

let $cgi := "http://localhost/cgi-bin/printenv.cgi";

let $quote := dictionary(("ticker", "AAPL"), ("price", 123.45))

let $query :=
<quote>
<ticker market="NASDAQ"> { $quote/ticker } </ticker>
<price currency="USD"> { $quote/price } </price>
</quote>

let $headers := dictionary (
            ("Content-Type",  "text/xml; charset=utf-8"),
            ("SOAPAction", "urn:offer-quote")
        )

let $html := http-post($cgi, $query, $headers)/DATA

return $html


(No, $query is not a valid SOAP call, but that's not the point here.)

Here's what the CGI sees as the HTTP headers:

CONTENT_LENGTH  '92'
CONTENT_TYPE    'application/x-www-form-urlencoded'
HTTP_SOAPACTION 'urn:offer-quote'

Changing the Content-Type to:

            ("Content-Type:",  "text/xml; charset=utf-8")

produces:

CONTENT_TYPE ': text/xml; charset=utf-8, application/x-www-form-urlencoded'

Finally,

            ("Content-Type: text/xml; charset=utf-8;",  "")

yields

CONTENT_TYPE 'text/xml; charset=utf-8;:, application/x-www-form-urlencoded'


There should be a way to have Sherlock (via WebFoundation) to use a specified HTTP Content-Type for a HTTP POST request, without having "application/x-www-form-urlencoded" or ":" appended to the header.



Source of the CGI used:

http://jpm.best.vwh.net/cgi-bin/printenv.cgi?show-cgi-source

Versions:

System version                :  Mac OS X 10.2.3 (6G30)
Framework Name: SherlockCore.framework
Version:        1.0.1
Framework Name: WebFoundation.framework
Version:        0.3
Application Name:       Sherlock
Version:        3.5.1
_______________________________________________
sherlock-channel-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/sherlock-channel-development
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.