aspose file tools*
The moose likes Web Services and the fly likes Content-Length not set in the Axis 1.4 http Response Header Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Content-Length not set in the Axis 1.4 http Response Header" Watch "Content-Length not set in the Axis 1.4 http Response Header" New topic
Author

Content-Length not set in the Axis 1.4 http Response Header

vasu Sanaboina
Greenhorn

Joined: Sep 11, 2007
Posts: 16
Content-Length is not set in the http response header. We are using AXIS 1.4 version. tomcat7. We need Content-Length to process the SOAP message. Kindly provide any configuration changes need to set in the response header.

Server : Tomcat7
Java : jre6
Protocol : HTTP/1.1
web service : AXIS 1.4

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12823
    
    5
It is my impression that AXIS 1 has not been supported for years and has been supplanted by Axis 2.

You should probably move your project to AXIS 2.

Bill
vasu Sanaboina
Greenhorn

Joined: Sep 11, 2007
Posts: 16
To set the content length in response header attribute we implemented handler and configured the same in server-config.wsdd.

<transport name="http">
<requestFlow>
<handler type="URLMapper"/>
<handler type="javarg.apache.axis.handlers.http.HTTPAuthHandler"/>
</requestFlow>

<responseFlow>
<handler type="java:com.lucent.tcoma.webservice.STARSAxisHandler"/>
</responseFlow>


<parameter name="qs:list" value="org.apache.axis.transport.http.QSListHandler"/>
<parameter name="qs:wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
<parameter name="qs.list" value="org.apache.axis.transport.http.QSListHandler"/>
<parameter name="qs.method" value="org.apache.axis.transport.http.QSMethodHandler"/>
<parameter name="qs:method" value="org.apache.axis.transport.http.QSMethodHandler"/>
<parameter name="qs.wsdl" value="org.apache.axis.transport.http.QSWSDLHandler"/>
</transport>

Handler Class implementation as follows

public void invoke(MessageContext context) throws AxisFault {
try {
Message msg = context.getResponseMessage();
HttpServletResponse res = (HttpServletResponse) context
.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE);
res.setContentLength(msg.getSOAPPartAsString().length());
logger.info("Setting Content-Length in Response Header-->"
+ msg.getSOAPPartAsString().length());
} catch (Exception e) {
logger.error("Setting Content-Length in Response Failed for STARS exposed services -->"
+ e.getMessage());
e.printStackTrace();
}
}

 
jQuery in Action, 2nd edition
 
subject: Content-Length not set in the Axis 1.4 http Response Header