[SOLVED] U97 SOAP call-out to https site got error
Author: marco.aquino@dedalus.eu (Marco)
Hi, when we migrated our customer from U9401R126 to U9703G308 we got an error in SOAP call-out when try to invoke a webservice on https site. I think that the signature is the same from U94 and U97 because we migrate the repository and build a new urr from idf with /urr command line switch. In asn we use driver SOP U2.0 and the webservice is configured like this:
[SERVICES_EXEC] GAC_ARTICOLI $SOP:GAC_ARTICOLI euser=domain\user epass=password scheme=L ign=HP
$status and $procerror are -150 and the error in the error context variable on debug is:
ERROR | -150 |
MNEM | |
DESCRIPTION | Activation error occurred |
COMPONENT | XSTTF10 |
PROCNAME | LF_ARTICOLILISTA |
TRIGGER | OPER |
LINE | 19 |
ADDITIONAL | |
INSTANCENAME | GAC_ARTICOLI |
DRV | SOP |
LOCATION | INVOCATION |
CODE | TRANSPORT |
MESSAGE | HTTP transport error |
DETAIL | Request::handleRequest HTTPTransportException:HTTP transport error - The requested URL https://xxxxxxxx returned error: The requested URL returned error: 411 Length Required |
Because the webservice is available only on customer network, I create locally in my network a SOAPUI mockservice from wsdl to view a soap evelope from a uniface call to find where is the difference from U94 and U97.
U94 SOAP envelope
true 2017-06-01T18:07:00.00+02:00 2017-06-05T11:34:00.00+02:00
U94 HTTP header
Content-Length |
728 |
Accept-Encoding |
identity |
SOAPAction |
"http://AvenStacWs.org/ArticoliInteresseAziendaliList" |
User-Agent |
CURLTransport/1.0 |
Accept |
*/* |
Content-Type |
text/xml;charset=UTF-8 |
U97 SOAP envelope
true 2017-06-01T18:07:00.00+02:00 2017-06-05T11:35:00.00+02:00
U97 HTTP header
Host |
nb-019096:38080 |
Content-Length |
727 |
Accept-Encoding |
identity |
SOAPAction |
"http://AvenStacWs.org/ArticoliInteresseAziendaliList" |
User-Agent |
CURLTransport/1.1 |
Accept |
*/* |
Content-Type |
text/xml;charset=UTF-8 |
First, I saw that the envelope was different, so I created a callback service to reproduce the same envelope, but I got error again. Second, I saw that the User-agent identified a different cURL transport, so I decided to try replace the libcurl.dll in bin folder with U94 old version. This is not recommended but now the SOAP call-out work fine like before migration. Maybe the problem is on cURL dll version, is it possibile to configure the SOAP call-out to use CURL transport/1.0? Or the problem is inside a dll ? Enviroment: Platform: W2008R2 Uniface: U97G308 DBRMS: Oracle 11g Thanks Marco
12 Comments
Local Administrator
Hi, I haven't read your topic very carefully, but have you looked at this topic http://unifaceinfo.com/forum/uniface9/web-service-u9-7/ and especially this: For some reason I had to reimport the wsdl. I see no important change in the signature exported from U9.6.04 to U9.7 and the one reimported into U9.7 ?? The above indicates that I had to reimport the wsdl with "/sti", it wasn't enough to migrate the signature?? And the need for using a "local" file [SERVICES_EXEC] smsservice=$sop:smsservice wsdl=g:/unifaceappdir/SMSService.wsdl Regards RogerW.
Author: rogerw (roger.wallin@abilita.fi)
Local Administrator
Hi Marco, could be obvious but...considering https protocol: do you migrated related certificate as well ? Gianni
Author: gianni (gianni.sandigliano@unifacesolutions.com)
Local Administrator
Hi Gianni, correct, but I haven't certificate in U94 and even in U97. I use ign=HP parameter on SOAP params in asn definition to remove control on there. In my case the error is on HTTP transport, but I tried to remove ign parameter and I receved a correct certificate error. I tried also to use a ca_bundle.crt downloaded from mozilla site, as suggested in other post, and tried different combination of ign parameter (only H, only P). Marco
Author: Marco (marco.aquino@dedalus.eu)
Local Administrator
Hi Marco, Do you know what web server your customer is using? And have you checked the complete response from the server in the SOAP_CALLOUT_POST operation? Maybe it contains some additional info about the error? I've seen the HTTP error 411 before with (e.g.) Apache version 1.3 and chunked transfer encoding. The workaround was to use the HTTP version 1.0 instead of 1.1. It could be that the version in the User-Agent header refers to the HTTP version used by curl ("CURLTransport/1.0" and "CURLTransport/1.1"). Not sure though. Unfortunately it is not possible to specify the HTTP version the SOAP connector should used. AFAIK it will always use the internally preferred HTTP version of curl. So in case HTTP version 1.0 is required then it might be an option to call the webservice by doing the request with the curl command line tool and spawn it from Uniface (or use the OS command signature). Hope this helps. Kind regards, Daniel Iseli Uniface Technical Support
Author: diseli (daniel.iseli@uniface.com)
Local Administrator
Hi Daniel, I don't know what web server version is on the third part (not my customer) and the SOAP_CALLOUT_POST isn't executed after the activate command, only the SOAP_CALLOUT_PRE is executed. So, there isn't the solution by code? It's not a bug? In U94 the SOAP call-out with activate works, in U97 doesn't work anymore. As the problem is HTTP error 411 Length Required and as both UHTTP and SOAP call-out use cURL library, is possibile that the FLAG 4 (Do not calculate the content-length of the payload itself for a POST method), visible in UHTTP operation, is set by default on SOAP call-out? Or maybe the error is in the cURL library? In this case, replace libcurl.dll with the old version from U94 (that I tried and it works) is possible and correct? I tried to install the new cURL library (libcurl.dll W32 edition) downloaded from cURL site, but on activate I got a -81 procerror and the error context indicates "Failure to connect to engine". Marco
Author: Marco (marco.aquino@dedalus.eu)
Local Administrator
Hi Marco,
Indeed, in case the returned HTTP status is 411 (or anything other than 200) then the SOAP_CALLOUT_POST operation is not activated. We could e.g. use a web proxy (like e.g. Fiddler) or the command line tool curl (Uniface 9.7.03 + G308 is e.g. using the version 7.40.0) to figure out the exact reply from the webservice.
Currently I can't think of a code solution and I'm also not convinced that this is a bug. I did a quick check and my assumption seems to be correct that the Uniface 9.4 SOAP connector (i.e. libcurl) is using HTTP version 1.0 and Uniface 9.7 HTTP version 1.1. So it's quite possible that the web server has a problem with chunked transfer encoding and that's the reason for the HTTP error 411. A possible workaround could be to use the curl command line tool and use HTTP version 1.0 (see command line option -0, --http1.0).
No, I don't think so. The SOAP connector will add the Content-Length header to the request.
See above - I don't think that there's an error in the libcurl.dll. And please don't copy the libcurl.dll from an older Uniface version or try to replace it with another curl version. The libcurl.dll used by Uniface is modified and replacing it with something else could break the SOAP connector or might make Uniface unstable.
Hope this helps. Daniel
Author: diseli (daniel.iseli@uniface.com)
Local Administrator
Hi Roger, I tried your suggestion, but it doesn't work, I got same error. I tried to launch curl 7.40.0 command line and it works perfectly, so why libcurl.dll inside U97 doesn't work? This is the line that I run: curl --ntlm --insecure --user userid:password --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:http://XXXXXXXXXXXXX/XXXXXXXXXXXXXXXXX" --data @envelope.xml https://xxxxxxxx where envelope.xml is catched with SOAP_CALLOUT_PRE function. I hope that the switches used are like $SOP parameter used in asn file (scheme=L ign=HP). With verbose option, I saw that the server http protocol is 1.1. This is the result:
Marco
Author: Marco (marco.aquino@dedalus.eu)
Local Administrator
Hi Marco, Thanks for the additional info. This is really helpful. From the curl tracing I can see that the Web Service is Microsoft IIS 7.5. I did a quick test here on one of our Windows Test-Servers and I can see the problem now as well. It seems that when the SOAP connector is sending the initial request with the NTLM authorization then the Content-Length header is not set (and this seems to trigger the HTTP error 411). It looks like that this issue was introduced after we've upgraded the curl version used by Uniface to 7.40.0 (with the version 9.6.06 patch X604 and version 9.7.01). Before the curl upgrade the SOAP connector sets the Content-Length header to 0 ("Content-Length: 0") and after the upgrade the header is omitted. I'll discuss this with the lab and shall keep you posted. The good news is that I've found a workaround: when you set the scheme connector option to LN (NTLM and Negotiate) then the request should work (again) correctly. E.g.
Hope this helps. Daniel
Author: diseli (daniel.iseli@uniface.com)
Local Administrator
Hi Daniel, I tried the workaround and now SOAP call-out works correctly again. Thanks Marco
Author: Marco (marco.aquino@dedalus.eu)
Local Administrator
Thanks, Marco. It's good to hear that the workaround is solving the problem. In the meantime I had a chat with one of the engineers in the lab. It seems that curl has a problem when the Context-Length header is explicitly set (which the SOAP connector does for all requests) and NTLM authentication is used. curl also seems to add the mentioned header (i.e. Content-Length: 0) and when it already has been set by the calling code (i.e. the SOAP connector) then this will result in the Context-Length header being removed from the request. This was not an issue with older curl versions (at least before version 7.40). The workaround for this issue is to omit the Content-Length header from the request (since it automatically will be added by curl). I'll create a new bug report for this issue. But I don't think that this will be resolved quickly, since there is an easy workaround for this issue (i.e. set scheme=LN). Hope this helps. If you have any further questions or concerns regarding this issue then let me know. Daniel
Author: diseli (daniel.iseli@uniface.com)
Local Administrator
Just a quick update: I've created in the meantime, as promised, a new BUG report for this problem:
This issue will be added to the maintenance backlog with a low priority. In case this problem is time critical for someone then please log a call with support. Hope this helps. Daniel
Author: diseli (daniel.iseli@uniface.com)
Local Administrator
Just another update: the BUG#31620 just has been fixed with the patch G413. Hope this helps. Daniel
Author: diseli (daniel.iseli@uniface.com)