You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Yampolsky, Robert" <ry...@harris.com> on 2005/05/26 00:33:15 UTC

Wrong content type for ?wsdl - mod_axis2.cpp always sets text/html on GET

After some patching, I'm able to get axis 1.5 to send out wsdl from the
wsdls directory.  Only problem is it sends it out as content type
"text/html", so Firefox tries to display it as HTML (interestingly, IE
does not - I guess it sees the xml header and uses that to decide to
display it as xml).

Anyway, the culprit (I think) is this code snippet from
src/server/apache2/mod_axis2.cpp:

    /* for SOAP 1.2 this this should be "application/soap+xml" but keep
this for
     * the moment. */
    req_rec->content_type = (M_POST == req_rec->method_number) ?
                "text/xml" : "text/html";

Looks like if the caller does a POST operation, axis sets the content
type to xml, otherwise sets it to html.  No special test for a GET on
service?wsdl.

The wsdl handling is done out of process_request(), which is called just
after this code.  Process_request is passed  a pointer to the Transport,
which is constructed with the pointer to req_rec, so I guess it should
be able to override the content type from there.

In fact, I see code in the setTransportProperty method that's supposed
to let you set the content_type via a pointer to the Transport.  Only
thing is, this code is commented out.  Also, I don't see any code that
actually *uses* the content_type value.

So is the content type in axis output just hard-coded somewhere to
"text/html"?  If so, I don't see that anywhere either.

Can anybody explain how this is supposed to work.  Can I fix it by
re-enabling the set content type stuff, or will that break something
else?

R o b   Y a m p o l s k y
Harris Corporation
ryampols@harris.com
(212) 303 - 4250


Re: Wrong content type for ?wsdl - mod_axis2.cpp always sets text/html on GET

Posted by Samisa Abeysinghe <sa...@virtusa.com>.
Hi Rob,
	As you have said, there is no place other than in the mod_axis2.cpp
where "text/html" is hard coded.

I am not sure why content type stuff is commented out in
Apache2Transport::setTransportProperty().
However, if you want to change it and test for side effects, please send
me over the patch, I could test it out for you.

Thanks,
Samisa...

On Wed, 2005-05-25 at 22:33, Yampolsky, Robert wrote:
> After some patching, I'm able to get axis 1.5 to send out wsdl from the
> wsdls directory.  Only problem is it sends it out as content type
> "text/html", so Firefox tries to display it as HTML (interestingly, IE
> does not - I guess it sees the xml header and uses that to decide to
> display it as xml).
> 
> Anyway, the culprit (I think) is this code snippet from
> src/server/apache2/mod_axis2.cpp:
> 
>     /* for SOAP 1.2 this this should be "application/soap+xml" but keep
> this for
>      * the moment. */
>     req_rec->content_type = (M_POST == req_rec->method_number) ?
>                 "text/xml" : "text/html";
> 
> Looks like if the caller does a POST operation, axis sets the content
> type to xml, otherwise sets it to html.  No special test for a GET on
> service?wsdl.
> 
> The wsdl handling is done out of process_request(), which is called just
> after this code.  Process_request is passed  a pointer to the Transport,
> which is constructed with the pointer to req_rec, so I guess it should
> be able to override the content type from there.
> 
> In fact, I see code in the setTransportProperty method that's supposed
> to let you set the content_type via a pointer to the Transport.  Only
> thing is, this code is commented out.  Also, I don't see any code that
> actually *uses* the content_type value.
> 
> So is the content type in axis output just hard-coded somewhere to
> "text/html"?  If so, I don't see that anywhere either.
> 
> Can anybody explain how this is supposed to work.  Can I fix it by
> re-enabling the set content type stuff, or will that break something
> else?
> 
> R o b   Y a m p o l s k y
> Harris Corporation
> ryampols@harris.com
> (212) 303 - 4250
-- 
Samisa Abeysinghe <sa...@virtusa.com>
Virtusa Corporation