Developer forum

Forum » Integration » Endpoint Management OData Request Error

Endpoint Management OData Request Error

Shawn Tehini Dynamicweb Employee
Shawn Tehini
Reply

Hi Matthias, 

Hoping you can help me with an error I am getting setting up an OData endpoint using endpoint management.  The site is https://qa-aci.dw-demo2.com/Admin/Default with endpoint as https://internalcrmlivetest.online.agricover.com/CRMLiveTest/api/data/v8.2.  If you hit that url in a broswer with credentials you get a good response:

Furthermore, I am trying to pull a specific entity based on this url: https://internalcrmlivetest.online.agricover.com/CRMLiveTest/api/data/v8.2/bmi_leadtimes?$top=2

That also renders a good response:

Being able to get both those responses confirms the url and creds.  

Setting that up in the endpoint management I am getting the following error:

The remote server returned an error: (411) Length Required. Response: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>

I have tried setting a request header for Content-Length but that has not resolved.  It is also interesting that the error message is noting "text/html" but the request is an OData Json request and response.  The website version is 9.10.17.

Please let me know if you can assist.

Thanks, 
Shawn


Replies

 
Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

@shawn

did you set Authentication in endpoint management?

as this url data under autherization and it will return data on your browser as it has already saved auth data with your previous check.

1. check you set your authetication correctly in endpoint management

2. if still not works try with latest dw as i think it has considerable changes from 9.10 to 9.15 

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Shawn,

Sorry for this late answer, been on holiday all last week :P

The error you're getting is because you've added the Endpoint as a POST and not a GET, then it tries to add the body to the request:

The remote server returned an error: (411) Length Required. Response: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>

I do have trouble getting any response on my own computer for that endpoint, is it still up and running? :)

So maybe double check that the server is running, next change the endpoint so it is a GET instead of a POST, and see if any of this works.. but will agree on Shiwanka that it's a really old DW-version that site is running

 

BR

Matthias Sort

 
Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply
Original message by Matthias Sebastian Sort posted on 12/06/2023 10:46:44:

Hi Shawn,

Sorry for this late answer, been on holiday all last week :P

The error you're getting is because you've added the Endpoint as a POST and not a GET, then it tries to add the body to the request:

The remote server returned an error: (411) Length Required. Response: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>Length Required</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY></HTML>

I do have trouble getting any response on my own computer for that endpoint, is it still up and running? :)

So maybe double check that the server is running, next change the endpoint so it is a GET instead of a POST, and see if any of this works.. but will agree on Shiwanka that it's a really old DW-version that site is running

 

BR

Matthias Sort

HI Matthias

Url is working but seems its restricted only to USA IP range ;) , but this has authentication 

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Shiwanka,

Then you could go to the DW-site --> Settings --> Integration --> SQL Firehose --> and do a SELECT * FROM EndpointAuthentication and test the credentials that are used?

BR

Matthias Sort

 
Shawn Tehini Dynamicweb Employee
Shawn Tehini
Reply

Hi Matthias, 

Still havent gotten it working.  I am able to confirm that the endpoint is up via web browser. 

Changing to a GET I now get the following error:

"The remote server returned an error: (401) Unauthorized."

I have confirmed those creditials are correct - do I need to be using a different auth type?

 

I have tried with the domain and without the domain.


Thanks, 
Shawn

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Shawn,
I have checked your endpoint authentication and it contains whitespaces in the username/pwd fields, so can you check if they are correct?
BR, Dmitrij

 
Shawn Tehini Dynamicweb Employee
Shawn Tehini
Reply

Hi Dmitrij, 

Yes I have checked and have no white space.

Still getting "The remote server returned an error: (401) Unauthorized."

Using those creds in an incognito windows works:

 

Thanks, 

Shawn

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Shawn,
could you get it to work in Postman?
BR, Dmitrij

 
Shawn Tehini Dynamicweb Employee
Shawn Tehini
Reply

Hi Dmitrij, 

Yes we can connect via Postman.  Here is how:

In order to connect you'll need to head to 'Cookies' in Postman:

Once there click the 'Sync Cookies' tab and install the Interceptor on Google Chrome.  In addition add two domains to this tab:

internalcrmlivetest.online.agricover.com

login.windows.net

Select 'Start Syncing' and once finished your 'Sync Cookies' tab should look similar to this:

From there visit the internalcrmlivetest site and login: https://internalcrmlivetest.online.agricover.com/CRMLiveTest/

This should retrieve cookies needed for the API and should look similar to this:

Once finished you should receive a response similar to below:

Thanks, Shawn

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply

Hi Shawn,
can you send me your postman request file to mine email: dbe@dynamicweb-cms.com?
If it does not work without cookies collection setting then this is probably the problem as we don't have any input fields for the entering of the cookies into the endpoint request.
BR, Dmitrij

 
Shawn Tehini Dynamicweb Employee
Shawn Tehini
Reply

Sent!


Thanks, Shawn

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi,

I did notice that after you've synced the cookies, then your authorization changes from "Basic" to "NTLM"?

maybe it adds something extra in your postman that you could use in the DW-backend?

BR

Matthias Sort

 

You must be logged in to post in the forum