[JAVA] 411 Error: Length Required in SOAP communication

Introduction

When I created a client and communicated with SOAP communication, An error in the subject has occurred.

Most of the materials that came out during the survey were old, I will write it as a memorandum when it occurs again.

environment

Version: Java8 Application server: Tomcat 8.5 Library: axis2

Flow until occurrence

Using the Axis2 library, I generated a client side stub from the following command.

wsdl2java.bat -uri [wsdl address] -s -o [Output destination]

Then add the generated client to your project and We communicated.

And the error of the subject occurred.

411 Error: Length Required

Cause

This was because Transfer-Encoding: chunked was set.

When I created the stub, the Transfer-Encoding setting was chunked by default.

Workaround

I added the following source code and disabled the Transfer-Encoding: chunked setting.

options.setProperty(MessageContextConstants.CHUNKED, Constants.VALUE_FALSE);

Reference material

http://blogs.yahoo.co.jp/dk521123/32003685.html http://b.hatena.ne.jp/entry/akitosblog.seesaa.net/article/168401299.html http://axis2.exblog.jp/2966162/

Recommended Posts

411 Error: Length Required in SOAP communication
Error handling in Graphql-ruby
Avoid Yubaba's error in Java
NameError in Income # index error
ActiveRecord :: NotNullViolation in Devise error
Error in rails db: migrate
npm error in docker tutorial
Error in Spring database connection