On Sun, 29 Jul 2001, Paul Kulchenko wrote:

> Hi, All!
>
> Code is simple, but I can't return custom content-type with
> SERVER_ERROR:
>
> sub handler {
>
>   ..... $self->response is HTTP::Response object
>
>   if ($self->response->is_success) {
>     $self->response->headers->scan(sub { $r->header_out(@_) });
>     $r->send_http_header(join '; ', $self->response->content_type);
>     $r->print($self->response->content);
>   } else {
>     $self->response->headers->scan(sub { $r->err_header_out(@_) });
>     $r->content_type(join '; ', $self->response->content_type);
>     $r->custom_response($self->response->code,
>                         $self->response->content);
>   }
>   $self->response->code;
> }

i think you want to use err_headers_out() instead.
http://www.modperl.com/book/chapters/ch9.html#Server_Response_Methods

> In ALL cases (200OK and 500ServerError) I need to return error code,
> content, content-type and optional headers.
>
> Regardless of my settings content-type is always "text/html;
> charset=iso-8859-1" which I expect to be "text/xml; charset=utf-8":
>
> HTTP/1.1 500 Internal Server Error
> Connection: close
> Date: Sun, 29 Jul 2001 16:01:20 GMT
> Server: Apache/1.3.12 (Win32) mod_perl/1.23
> Content-Length: 642
> Content-Type: text/html; charset=iso-8859-1
> Client-Date: Sun, 29 Jul 2001 16:01:22 GMT
> Client-Peer: 127.0.0.1:80
> SOAPServer: SOAP::Lite/Perl/0.51
>
> <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance";
> 
>xmlns:xsd="http://www.w3.org/1999/XMLSchema";><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode
> xsi:type="xsd:string">SOAP-ENV:Client</faultcode><faultstring
> xsi:type="xsd:string">Failed to locate method (echo1) in class
> (My::Parameters) at C:/Perl/site/5.6.0/lib/SOAP/Lite.pm line 1997.
> </faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
>
> What am I doing wrong and what is the correct way to specify custom
> content-type? Everything works fine with 200OK. Thanks a lot.
>
> Best wishes, Paul.
>
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/
>



_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Reply via email to