Patan
Patan

Reputation: 17883

Remove transfer encoding in Http Request

I am sending one SOAP request. It uses the encoding type as Trasfer-encoding chunked.

The request is not sent properly. I think some issue with content encoding.

Empty Request is sent. I am getting 500 error from server.

"Content-Type: text/xml; charset=UTF-8[\r][\n]"
"SOAPAction: "fir_auto_complete/fir_auto_completeListRequest"[\r][\n]"
"User-Agent: Axis2[\r][\n]"
"Host: localhost:9090[\r][\n]"
"Transfer-Encoding: chunked[\r][\n]"

I have tried like this but does not seem to work. I am getting 500 error from server.

public Response getNumber(@Context final HttpServletRequest context, @QueryParam("name") final String name) throws UnsupportedEncodingException
    {
    return Response.ok(JSONHelper.withJSONCallback(context, JSONHelper.toJSON(name))).header("charset", "utf-8").header("Content-Encoding", "gzip")build();
    }

The packets of data is sent is empty.

I think there is a issue with Transfer encoding type.

Can some one suggest how to change encoding type and what encoding type is suggested here.

Upvotes: 0

Views: 3047

Answers (1)

Scary Wombat
Scary Wombat

Reputation: 44834

try to set setContentLength to the size of the data being sent for no chunked transfer encoding

Upvotes: 1

Related Questions