• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invalid HTTP server response [411] - Length Required

 
jaya kemmannu
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

We are using jboss 4.2.2 on HP -UX. While trying to send soap message with pdf as an attachment i Get below Exception. Any Idea on what is causing below Exception.

2013-12-21 16:15:22,238 FATAL [NP_SYS_AL] 130-M-211-20131221-A000406|39914|5915023|NPO : SyniverseAttachmentClient : send
javax.xml.soap.SOAPException: java.io.IOException: Could not transmit message
at org.jboss.ws.core.soap.SOAPConnectionImpl.callInternal(SOAPConnectionImpl.java:152)
at org.jboss.ws.core.soap.SOAPConnectionImpl.call(SOAPConnectionImpl.java:64)
at com.al.np.ch.syniverse.SyniverseAttachmentClient.send(SyniverseAttachmentClient.java:91)

Caused by: java.io.IOException: Could not transmit message
at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:265)
at org.jboss.ws.core.client.SOAPProtocolConnectionHTTP.invoke(SOAPProtocolConnectionHTTP.java:71)
at org.jboss.ws.core.soap.SOAPConnectionImpl.callInternal(SOAPConnectionImpl.java:143)
... 10 more
Caused by: org.jboss.remoting.CannotConnectException: Can not connect http client invoker.
at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:333)
at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:135)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
at org.jboss.remoting.Client.invoke(Client.java:1634)
at org.jboss.remoting.Client.invoke(Client.java:548)
at org.jboss.ws.core.client.HTTPRemotingConnection.invoke(HTTPRemotingConnection.java:243)
... 12 more
Caused by: org.jboss.ws.WSException: Invalid HTTP server response [411] - Length Required
at org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP.read(SOAPMessageUnMarshallerHTTP.java:75)
at org.jboss.remoting.transport.http.HTTPClientInvoker.readResponse(HTTPClientInvoker.java:473)
at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:305)


Regards,
Jay
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTTP 411 error means that server refuses to accept the request without a defined Content- Length. The client MAY repeat the request if it adds a valid Content-Length header field containing the length of the message-body in the request message. This is typically used only for HTTP methods that result in the placement of data on the Web server So please try adding Content_length header in SOAP Request and check whether that solve your problem.
 
jaya kemmannu
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Abhay,

I have already set content length. But still getting the same Error.

Regards,
Jaya
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly how and where are you setting the content length?

Bill
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As William asked, please share how you are setting content length in SOAP header.
I searched online for error and found that there can be one more reason for this failure.
Reason - The remote WSEndpoint did not like the HTTP Chunking feature activated. Try disabling this feature for WS client.

 
prema harish
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abhay and Willam,

Part of the same team. we are setting the content lenght as follow.

msg.getMimeHeaders().addHeader("Content-Length",String.valueOf((soapXml.length+attachment.length)));

here is the apps details.

OS is RHEL 5.3

Java is JDK 5

JBOSS 4.2.2 AS

Thanks In Advance. We lookfw your suggestion to solve the issues
Regards,
Prema

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this was my problem I would use SOAPui or TCPMON to see exactly what the client software is actually sending in the request.

One of those tools should be part of every Web Service programmer's toolkit - you may be surprised by what your code is actually sending and receiving.

Bill
 
prema harish
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Issuse is Transfer-Encoding is getting set to chunked. Tried to disable it using the possible options.

1. In the Client Properties, updated the chunk size as 0
<property-name>http://org.jboss.ws/http#chunksize</property-name>
<property-value>0</property-value>

2.In Java Programalso, trying to diable it

responseMsg.getMimeHeaders().addHeader("Transfer-Encoding", "disabled");

Still, when i trace the message using TCPMON, i see the message is getting traced using CHUNKED.


POST /mnpserver/services/mnpservice?wsdl= HTTP/1.1

SOAPAction: ""

MIME-Version: 1.0

Content-Type: multipart/related; type="text/xml"; start="<rootpart@ws.jboss.org>";

boundary="----=_Part_0_4999541.1390232970391"

JBoss-Remoting-Version: 22

User-Agent: JBossRemoting - 2.2.2.SP1 (Bluto)

Host: 121.241.250.122:8088

Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

Connection: keep-alive

Transfer-Encoding: chunked


When i send using SOAP UI, it TCPMON Trace looks as follows.

POST /mnpserver/services/mnpservice HTTP/1.1

Accept-Encoding: gzip,deflate

SOAPAction: "send"

Content-Type: multipart/related; type="text/xml"; start="<rootpart@soapui.org>"; boundary="----=_Part_3_3951667.1390215591684"

MIME-Version: 1.0

User-Agent: Jakarta Commons-HttpClient/3.1

Host: 121.241.250.122:80

Content-Length: 103614

Advice on the solution How can disable the chunksize that helps me to send the 2 MB file to server.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic