This is the function I use to get data from a webservice, in SQL Anywhere v.12.0.1.3436:

CREATE FUNCTION test(in wsurl varchar(2048), in wsns varchar(2048), in cert varchar(2048),
    in username varchar(128), in password varchar(128), in idnum varchar(128), in productNumber varchar(128), in lang varchar(128))
RETURNS xml
url '!wsurl' type 'SOAP:DOC' namespace '!wsns' certificate 'cert=!cert' set 'SOAP(op=GetSaisWithPdf)';

Calling it I get error:

There was an error reading the results of the SQL statement. The displayed results may be incorrect or incomplete. HTTP request failed. Status code '0' SQLCODE=-983, ODBC 3 State="HY000"

And this is what I get in the log file (sensitive data is replaced with ***, sorry for that):

[connid = 15, 03/31 11:38:27.581]
[connid = 15, 03/31 11:38:27.581, REQUEST]
POST ***/SAIS/WebServices/getsais.asmx HTTP/1.0
ASA-Id: f373ec5c77a34acf9e25b85b54eb1150
User-Agent: SQLAnywhere/12.0.1.3436
Accept-Charset: windows-1257, UTF-8, *
Date: Mon, 31 Mar 2014 08:38:21 GMT
Host: ***
Connection: close
Content-Type: text/xml; charset=windows-1257
Content-Length: 528
SOAPAction: "http://tempuri.org/GetSaisWithPdf"

<?xml version="1.0"?>
<SOAP-ENV:Envelope
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:m="http://tempuri.org/">
  <SOAP-ENV:Body>
    <m:GetSaisWithPdf>
      <m:username>***</m:username>
      <m:password>***</m:password>
      <m:idnum>***</m:idnum>
      <m:productNumber>***</m:productNumber>
      <m:lang>***</m:lang>
    </m:GetSaisWithPdf>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
[connid = 15, 03/31 11:38:44.788, RESPONSE]
H
[connid = 15, 03/31 11:38:44.792, RESPONSE]
TTP/1.1 200 OK
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
S: 2
Date: Mon, 31 Mar 2014 08:38:37 GMT
Connection: close
Content-Length: 1203439

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetSaisWithPdfResponse xmlns="http://tempuri.org/"><GetSaisWithPdfResult><XmlDocument><root xmlns=""> <InfoBlock name="tblInfoBlock" title="Santrauka" sectionId="santrauka"> </InfoBlock><Summary name="tblSummary" UnknownValue="Nenustatyta"> <vat Name="Vėlavimo atsiskaityti reitingas" Probability="83,00%" ProbabilityText="tikimybė," ClassValue="10" ClassText="klasė," ClassName="Aukščiausia rizika" IsSet="true" /><bt Name="Bankroto reitingas" Probability="5,032%" ProbabilityText="tikimybė," ClassValue="8" ClassText="klasė," ClassName="A
[connid = 15, Protocol Error]
[connid = 15, socket closed]

As you can see, the response result is truncated some why to 1024 characters, I contacted the webservice maintainers and they confirmed that they send out the full response, I tried the same request (evelope generated by SA) in SoapUI and in C# and got correct results, no truncation, so I am prety sure the problem is somewhere within SQL Anywhere, any ideas where?

Update: Updated to v.12.0.1.4085, now I get the following error:

There was an error reading the results of the SQL statement. The displayed results may be incorrect or incomplete. HTTP request failed. Status code '<none>' SQLCODE=-983, ODBC 3 State="HY000"

And log now looks even worse:

[connid = 24, 03/31 17:09:19.113, REQUEST]
POST /***/SAIS/WebServices/getsais.asmx HTTP/1.0
Connection: close
User-Agent: SQLAnywhere/12.0.1.4085
Accept-Charset: windows-1257, UTF-8, *
Date: Mon, 31 Mar 2014 14:09:19 GMT
ASA-Id: 0ab81a2edc6f4a54b6ff2dad69d858be
Host: ***
Content-Length: 528
SOAPAction: "http://tempuri.org/GetSaisWithPdf"
Content-Type: text/xml; charset=windows-1257

[connid = 24, Error: socket closed]
[connid = 24, socket closed]
[connid = 24, Error: socket closed by peer]

After testing I rolled back to version 12.0.1.3895 and now I am back to error described at the top of this long post.

asked 31 Mar '14, 05:55

Valdas's gravatar image

Valdas
381151929
accept rate: 83%

edited 01 Apr '14, 02:16

Comment Text Removed

What part is truncated to 1024 characters? The third last line is 859 characters long, the whole posted text is longer than 1024. (maybe it is a limitation of this forum software)

Have you solved or explained this message? External environment failed to start and establish a connection within the 45 second timeout SQLCODE=-1556, ODBC 3 State="HY000"

Is this correct? Content-Length: 1203439

(31 Mar '14, 08:06) Breck Carter
Replies hidden

Part from [connid = 15, 03/31 11:38:44.792, RESPONSE] to [connid = 15, Protocol Error], is exactly 1024 characters long. At first I thought it was the logs drawback, but various other webservices, like HTTP:GET, log the whole response without problem, however I never tested with such big data chunks, 100k at most.

Yes, I solved the mentioned problem, it was my mistake, i declared incorrect external name.

Content length may vary depending on time the request is done, at the moment it is 1203463, so yes, the amount of data is huge, but as mentioned before SoapUI and C# manage it just fine.

(31 Mar '14, 08:22) Valdas

Yes, I solved the mentioned problem, it was my mistake, i declared incorrect external name.

Just to understand: Does the cited error message still appear after you have solved the external name issue? Or do you get a different error message now?


Just to add: 12.0.1.3436 is a rather old EBF, you may try with a newer EBF... (No, I do not claim that this will solve the issue, I just don't know.)

(31 Mar '14, 08:43) Volker Barth

I am very sorry, I supplied wrong error message in description, the correct one:

There was an error reading the results of the SQL statement. The displayed results may be incorrect or incomplete. HTTP request failed. Status code '0' SQLCODE=-983, ODBC 3 State="HY000"

External name mistake has nothing to do with this issue, in this situation no external stuff is used, SOAP header is generated by SA, request is done by SA, response received and logged by SA, using "third party" function is a back up plan :)

Regarding EBF, I tried same procedure on SA16, and there I get new error: The secure connection to the remote host failed: The TLS handshake failed, error code 0 SQLCODE=-990, ODBC 3 State="HY000" and this time there is no XML(Envelope) in request at all, but I think this is different story, our clients work with SA12 and are not ready to migrate anyway.

Also tried on SA11, got identical results to SA12.

A few minutes ago updated to version 12.0.1.4085, got similar results to SA16, updated the issue description.

(31 Mar '14, 09:51) Valdas

Do you use HTTPS? In that case, v16 and newer v12.0.1 builds may show a different behaviour because the crypto lib has changed, cf. that question What impact will the switch to OpenSSL have on SQL Anywhere strong encryption?. - Note, that's a very very wild guess - you may just test with an EBF before 12.0.1.3994...

(31 Mar '14, 11:03) Volker Barth

Yes, web service uses HTTPS connection, but we do not use FIPS or MobiLink.

Anyway I rolled back to EBF 12.0.1.3895 so now again I get a perfectly valid <soap-env:envelope>...</soap-env:envelope> in request and get truncated response.

(01 Apr '14, 02:14) Valdas
showing 1 of 6 show all flat view

This issue has been fixed in CR #764411, with the following builds: v16.0.1925, v12.0.1.4119, v11.0.1.3156 (or higher).

The problem was not one of truncation (although this is a symptom) but rather with the way the response from the server was sent back to SQL Anywhere: if the first few bytes of the response was split across two or more packets (which is very rare and, frankly, quite odd that it would even happen) then the response would be rejected.

permanent link

answered 22 May '14, 15:12

Mark%20Culp's gravatar image

Mark Culp
24.8k9139296
accept rate: 41%

edited 23 May '14, 07:12

Jeff%20Albion's gravatar image

Jeff Albion
10.8k171175

Mark, could you share a CR number (in case it already has a public one)?

(23 May '14, 03:30) Volker Barth
Replies hidden

Jeff added the number. Thanks Jeff!

(23 May '14, 09:38) Mark Culp

After reading the What impact will the switch to OpenSSL have on SQL Anywhere strong encryption? I once again updated to latest EBF 12.0.1.4085, got a new root certificate for web service from www.geotrust.com and now TLS handshake succeeded and I got the full response, no truncation!

However SA11 does not has this problem fixed, tried latest EBF 11.0.1.3113 with no luck, more about that in a separate post.

Update: SA11 fixed.

permanent link

answered 01 Apr '14, 04:22

Valdas's gravatar image

Valdas
381151929
accept rate: 83%

edited 26 Aug '14, 03:57

Glad you got it working?

Is there any hint in the EBF's readme that may explain the previous truncation/timeout?

FWIW, you may accept your own answer to show the "case is closed":)

(01 Apr '14, 04:57) Volker Barth
Replies hidden

Problem still persists in SA11, So I'd like to somehow mark it as a partial answer :)

(01 Apr '14, 06:05) Valdas

Please post a new question for the SA11 symptom.

(01 Apr '14, 07:58) Breck Carter
(02 Apr '14, 06:52) Valdas
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×438
×143
×62
×19

question asked: 31 Mar '14, 05:55

question was seen: 6,815 times

last updated: 26 Aug '14, 03:57