# 411 Error using httpClient

**URL:** <https://forum.inductiveautomation.com/t/411-error-using-httpclient/77375>\
**Category:** Ignition\
**Created:** [August 3, 2023, 3:34pm UTC](https://forum.inductiveautomation.com/t/411-error-using-httpclient/77375 "2023-08-03T15:34:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brad\_Coble](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brad\_Coble](https://forum.inductiveautomation.com/u/Brad_Coble)\
**Post date:** [August 3, 2023, 3:34pm UTC](https://forum.inductiveautomation.com/t/411-error-using-httpclient/77375/1 "2023-08-03T15:34:32Z")

</div>

Hy, I am trying to retrieve XML data from a REST API. I am trying this via the script console.

However, I am always getting a 411.

The API documents tell me to use a POST and to pass in the username and password via parameters.

For ignition I use the following:

```auto
client = system.net.httpClient(bypass_cert_validation = True)
access_response = client.post(url="https://xxxx.svc/?username=xxxx&password=xxxx")

```

The response I get is:

```auto
>>> 
<Response@247370237 'https://xxxx.svc/?username=xxxx&password=xxxx' [411]>
>>>

```

Since the 411 means the server is looking for a content-length, I have also tried to add data="" to the httpClient method just to give it data.

I have also tried to set Content-Length to 0 in the headers but get a java error saying I can't do that.

I have been successful using POSTMAN to post to this server.

Any ideas?

Thanks!

-Brad

---

<div class="post-metadata">

**Author:** ![Brad\_Coble](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brad\_Coble](https://forum.inductiveautomation.com/u/Brad_Coble)\
**Post date:** [August 3, 2023, 3:39pm UTC](https://forum.inductiveautomation.com/t/411-error-using-httpclient/77375/2 "2023-08-03T15:39:27Z")

</div>

Never mind. I changed data="" to data="0" and it works.

Thanks!

-Brad

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 3, 2023, 3:40pm UTC](https://forum.inductiveautomation.com/t/411-error-using-httpclient/77375/3 "2023-08-03T15:40:03Z")

</div>

This is a bit of an issue with the implementation of Java 11's HttpClient.

It restricts the Content-Length header from being set manually, and automatically includes it, but only if there is a non-empty body. This is technically compliant behavior, though I don't think it's in line with recommendations.

---

<div class="post-metadata">

**Author:** ![Brad\_Coble](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brad\_Coble](https://forum.inductiveautomation.com/u/Brad_Coble)\
**Post date:** [August 3, 2023, 3:41pm UTC](https://forum.inductiveautomation.com/t/411-error-using-httpclient/77375/4 "2023-08-03T15:41:30Z")

</div>

Thanks for the quick response! I can live with adding a short piece of data.

-Brad

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 3, 2023, 3:42pm UTC](https://forum.inductiveautomation.com/t/411-error-using-httpclient/77375/5 "2023-08-03T15:42:27Z")

</div>

> [@Brad\_Coble](#):
>
> I can live with adding a short piece of data.

Yes, easy workaround, as long as your API doesn't balk at it.
