Openegde rest client 'challenge cannpt be empty', b

Posted by napmo on 03-Jun-2016 04:57

Hello,

I am trying to use OpenEdge rest client to send data to one of our service.

I am getting the "Challenge cannot be empty" error, 

I can do the same request with soapUI and en server is return the expected error message.

It seems that progress client is not able to read the response from the server.

test program is very simple .

DEFINE VARIABLE oClient AS IHttpClient NO-UNDO.
DEFINE VARIABLE oRequest AS IHttpRequest NO-UNDO.
DEFINE VARIABLE oResponse AS IHttpResponse NO-UNDO.
DEFINE VARIABLE oEntity AS Object NO-UNDO.
DEFINE VARIABLE oURI AS URI NO-UNDO.
DEFINE VARIABLE oCredentials AS Credentials NO-UNDO.
DEFINE VARIABLE hXmlDoc AS HANDLE NO-UNDO.
DEFINE VARIABLE oXmlDoc AS WIDGETHANDLE NO-UNDO.

oClient = ClientBuilder:Build()
                 :Client.

oURI = new URI(string(UriSchemeEnum:http), 'xxxt.xxx.com').
oURI:Port = 1466.
oURI:Path = '/yyyy/yyyyr'.

create x-document hXmlDoc.
hXmlDoc:load('file', 'c:\temp\WR_RBR_GROUP.xml', no).

oXmlDoc = new WidgetHandle(hXmlDoc).

oCredentials = new Credentials('xxx.com', 'xxxxxxt', 'xxxxxxxxxxxx').
oRequest = RequestBuilder
                      :Post(oURI, oXmlDoc)
                      :UsingBasicAuthentication(oCredentials)
                      :ContentType('application/xml')
                      :AcceptAll()
                      :Request.

oResponse = oClient:Execute(oRequest).

message
           oResponse:StatusCode skip
           oResponse:StatusReason skip
   view-as alert-box.


in log I have

[16/06/03@11:35:23.603+0200] P-015800 T-018296 1 4GL HTTPCLIB REQUEST: FILE= C:\Windows\TEMP\request-raw.txt
[16/06/03@11:35:23.605+0200] P-015800 T-018296 1 4GL HTTPCLIB RESPONSE: FILE= C:\Windows\TEMP\response-data-received.txt
[16/06/03@11:35:23.607+0200] P-015800 T-018296 1 4GL SOCKET CONNECT: -H xxxxtxxxxx.com -S 1466
[16/06/03@11:35:23.672+0200] P-015800 T-018296 1 4GL SOCKET CONNECT: TIME(ms)=65
[16/06/03@11:35:23.672+0200] P-015800 T-018296 1 4GL SOCKET WRITE: TIME(ms)=0
[16/06/03@11:35:23.672+0200] P-015800 T-018296 1 4GL SOCKET WRITE: SIZE(b)=2364
[16/06/03@11:35:23.824+0200] P-015800 T-018296 1 4GL SOCKET READ: AVAIL(b)=218
[16/06/03@11:35:23.824+0200] P-015800 T-018296 1 4GL SOCKET READ: TIME(ms)=0
[16/06/03@11:35:23.824+0200] P-015800 T-018296 1 4GL SOCKET READ: SIZE(b)=218
[16/06/03@11:35:23.826+0200] P-015800 T-018296 1 4GL HTTPCLIB CHUNK: NUM= 1
[16/06/03@11:35:23.826+0200] P-015800 T-018296 1 4GL HTTPCLIB CHUNK: SIZE(b)= 8192
[16/06/03@11:35:23.826+0200] P-015800 T-018296 1 4GL HTTPCLIB CHUNK: READ(b)= 218
[16/06/03@11:35:23.836+0200] P-015800 T-018296 1 4GL SOCKET READ: COMPLETE= yes
[16/06/03@11:35:23.836+0200] P-015800 T-018296 1 4GL SOCKET READ: ERROR= ?
[16/06/03@11:35:23.836+0200] P-015800 T-018296 1 4GL SOCKET READ: TOTAL TIME(ms)=163
[16/06/03@11:35:23.837+0200] P-015800 T-018296 1 4GL SOCKET READ: TOTAL SIZE(b)=218
[16/06/03@11:35:23.842+0200] P-015800 T-018296 1 4GL HTTPCLIB EXTRACT ENTITY: ERROR = Progress.Lang.SysError_2538
[16/06/03@11:35:23.842+0200] P-015800 T-018296 1 4GL HTTPCLIB EXTRACT ENTITY: Response entity contains raw message body
[16/06/03@11:35:23.846+0200] P-015800 T-018296 1 4GL -- (Procedure: 'C:\Windows\TEMP\p14780_test.ped' Line:76) Challenge cannot be empty

and respose-data-received.txt is an 8KB file which  contains

HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Content-Length: 67
Date: Fri, 03 Jun 2016 09:35:23 GMT

Client RAFGO not allowed to store data to schema MIST1/RAFLATAC_TSG

followed by ASCII 0

which is the expected reply from the server for taht request.

using different :Acceptxxx() in request builder is changing the error message i nlog file

if I use accept acceptXML I get

EXTRACT ENTITY: ERROR = Progress.Lang.SysError_2769

All Replies

Posted by Peter Judge on 06-Jun-2016 11:52

What does the request-raw.txt look like? Also what version of OE?
 

Client RAFGO not allowed to store data to schema MIST1/RAFLATAC_TSG

This seems to indicate a problem on the server, or maybe we're sending the wrong data, or maybe the server isn't sending the WWW-Authenticate header.
 
I've seen  this before (see the thread at community.progress.com/.../84142 ) . Issue PSC00346534 (AuthorizationStatusFilter needs to better handle missing WWW-Authenticate header) was fixed in 11.6.2 to address this.
 
 
 
 

Posted by napmo on 08-Jun-2016 04:59

I installed 11.6.2 and rerun the test.

I now have an issue with authentication.  

Has there been any change in  the authentication in RequestBuilder?

in 11.6.2 the request raw is starting with

the authorization part is missing.

POST /services/dwloader HTTP/1.1

User-Agent: OpenEdge-HttpClient/0.3.0 (WIN32/32) OpenEdge/11.6.2.0.1346 Lib-ABLSockets/0.3.0

Host: igwtest.upm.com:1467

Content-Type: application/xml; charset=UTF-8

Content-Length: 247150

Accept: application/xml,text/xml,text/xml-external-parsed-entity,application/xml-external-parsed-entity,application/xml-dtd

<?xml version="1.0" encoding="UTF-8" ?>

in 11.6.1

POST /services/dwloader HTTP/1.1

User-Agent: OpenEdge-HttpClient/0.3.0 (WIN32/32) OpenEdge/11.6.1.0.1295 Lib-ABLSockets/0.3.0

Host: igwtest.upm.com:1467

Content-Type: application/xml; charset=UTF-8

Content-Length: 247150

Authorization: Basic cmFmZ29fYW1fdGVzdDpwZExRamI5Skc2OXZsTA==

Accept: application/xml,text/xml,text/xml-external-parsed-entity,application/xml-external-parsed-entity,application/xml-dtd

<?xml version="1.0" encoding="UTF-8" ?>

This thread is closed