Archived Forum Post

Index of archived forum posts

Question:

http SynchronousRequest 9.5.0.39 vs 9.5.0.54

Jun 01 '17 at 11:31

I have a problem when updating version of chilkat DLL (ActiveX).

I'm using Visual FoxPro 9 to create the .EXE and using the same one with both DLL's.

With version 9.5.0.39 all works fine an I have this LastErrorXml:

<ChilkatLog>
<SynchronousRequest>
    <DllDate>May  9 2014</DllDate>
    <ChilkatVersion>9.5.0.39</ChilkatVersion>
    <UnlockPrefix>ELABORHttp</UnlockPrefix>
    <Username>CTFSVR:Fernanda</Username>
    <Architecture>Little Endian; 32-bit</Architecture>
    <Language>ActiveX</Language>
    <VerboseLogging>1</VerboseLogging>
    <domain>servicos.portaldasfinancas.gov.pt</domain>
    <port>701</port>
    <ssl>1</ssl>
    <httpRequest>
        <httpVersion>1.1</httpVersion>
        <verb>POST</verb>
        <path>/sgdtws/documentosTransporte</path>
        <contentType />
        <charset>windows-1252</charset>
        <sendCharset>0</sendCharset>
        <mimeHeader>SOAPAction: envioDocumentoTransporte</mimeHeader>
    </httpRequest>
    <readTimeout>20</readTimeout>
    <connectTimeout>10</connectTimeout>
    <fullRequest>
        <httpRequest>
            <httpVersion>1.1</httpVersion>
            <verb>POST</verb>
            <path>/sgdtws/documentosTransporte</path>
            <contentType />
            <charset>windows-1252</charset>
            <sendCharset>0</sendCharset>
            <mimeHeader>SOAPAction: envioDocumentoTransporte</mimeHeader>
        </httpRequest>
        <HttpOptions>
            <AddHostHeader>1</AddHostHeader>
            <AllowCookieResponseCaching>0</AllowCookieResponseCaching>
            <AllowGzip>1</AllowGzip>
            <ConnectTimeoutMs>10000</ConnectTimeoutMs>
            <CookieDir />
            <FollowRedirects>1</FollowRedirects>
            <Login />
            <LoginDomain />
            <AuthMethod />
            <MaxResponseSize>0</MaxResponseSize>
            <MaxUrlLen>2000</MaxUrlLen>
            <PasswordLen>0</PasswordLen>
            <ProxyHostname />
            <ProxyLogin />
            <ProxyLogin />
            <ProxyAuthDomain />
            <ProxyPasswordLen>0</ProxyPasswordLen>
            <ProxyPort>80</ProxyPort>
            <ReadTimeoutMs>20000</ReadTimeoutMs>
            <RequiredContentType />
            <ResumePoint>0</ResumePoint>
            <SaveCookies>1</SaveCookies>
            <SendBufferSize>65535</SendBufferSize>
            <SendCookies>1</SendCookies>
            <SslProtocol>0</SslProtocol>
            <UnavailableRetryCount>0</UnavailableRetryCount>
            <UnavailableRetryWaitMs>2000</UnavailableRetryWaitMs>
        </HttpOptions>
        <a_synchronousRequest>
            <generateRequest>
                <httpRequestGenStartLine>
                    <authOnly>0</authOnly>
                    <hasMimeBody>1</hasMimeBody>
                    <genStartLine>
                        <startLine>POST /sgdtws/documentosTransporte HTTP/1.1</startLine>
                    </genStartLine>
                </httpRequestGenStartLine>
                <genHeaderSb>
                    <getMimeHeaderHttp>
                        <headerField>SOAPAction: envioDocumentoTransporte</headerField>
                    </getMimeHeaderHttp>
                </genHeaderSb>
                <addCookies>
                    <info>Not auto-adding cookies.</info>
                </addCookies>
                <addHostHeader>servicos.portaldasfinancas.gov.pt</addHostHeader>
            </generateRequest>
            <fullHttpRequest>
                <domain>servicos.portaldasfinancas.gov.pt</domain>
                <port>701</port>
                <ssl>1</ssl>
                <openHttpConnection>
                    <info>Opening connection directly to HTTP server.</info>
                    <httpHostname>servicos.portaldasfinancas.gov.pt</httpHostname>
                    <httpPort>701</httpPort>
                    <ssl>1</ssl>
                    <bUsingHttpProxy>0</bUsingHttpProxy>
                    <httpProxyAuthMethod />
                    <connect2>
                        <hostname>servicos.portaldasfinancas.gov.pt</hostname>
                        <port>701</port>
                        <ssl>1</ssl>
                        <connectImplicitSsl>
                            <connectSocket>
                                <domainOrIpAddress>servicos.portaldasfinancas.gov.pt</domainOrIpAddress>
                                <port>701</port>
                                <connectTimeoutMs>20000</connectTimeoutMs>
                                <connect_ipv6_or_ipv4>
                                    <info>Multi-threaded domain to IP address resolution</info>
                                    <AddrInfoList>
                                        <AddrInfo>
                                            <ai_flags>0</ai_flags>
                                            <ai_family>2</ai_family>
                                            <ai_socktype>0</ai_socktype>
                                            <ai_protocol>0</ai_protocol>
                                            <ai_addrlen>16</ai_addrlen>
                                            <ai_canonname>(NULL)</ai_canonname>
                                        </AddrInfo>
                                    </AddrInfoList>
                                    <info>connecting to IPV4 address...</info>
                                    <ipAddress>213.13.158.240</ipAddress>
                                    <connect>
                                        <info>Waiting for the connect to complete...</info>
                                        <myIP>192.168.1.94</myIP>
                                        <myPort>1634</myPort>
                                        <info>socket connect successful.</info>
                                    </connect>
                                </connect_ipv6_or_ipv4>
                            </connectSocket>
                            <cacheClientCerts>
                                <info>Found cert with private key.</info>
                            </cacheClientCerts>
                            <clientHandshake2>
                                <sendCertificateVerify>
                                    <info>Sending ClientCertVerify message...</info>
                                    <ModulusLen>257</ModulusLen>
                                    <DLen>256</DLen>
                                    <PLen>129</PLen>
                                    <QLen>129</QLen>
                                    <DPLen>129</DPLen>
                                    <DQLen>128</DQLen>
                                    <InvQLen>129</InvQLen>
                                    <signSslSig>
                                        <signatureSize>256</signatureSize>
                                    </signSslSig>
                                </sendCertificateVerify>
                                <checkServerCert>
                                    <info>Not verifying server certificate...</info>
                                    <info>Set the RequireSslCertVerify property to true to enable verification.</info>
                                </checkServerCert>
                                <info>Secure Channel Established.</info>
                            </clientHandshake2>
                        </connectImplicitSsl>
                        <connectElapsedMs>109</connectElapsedMs>
                        <info>HTTP connection succeeded.</info>
                    </connect2>
                    <connectTime>Elapsed time: 109 millisec</connectTime>
                    <startLine>POST /sgdtws/documentosTransporte HTTP/1.1</startLine>
                    <requestHeader>
                        <requestHeader><![CDATA[SOAPAction: envioDocumentoTransporte Host: servicos.portaldasfinancas.gov.pt:701 Content-Length: 3057]]></requestHeader>
                    </requestHeader>
                    <sendRequestHeader>
                        <sendHeaderElapsedMs>0</sendHeaderElapsedMs>
                    </sendRequestHeader>
                    <sendRequestBody>
                        <sendBodyElapsedMs>0</sendBodyElapsedMs>
                    </sendRequestBody>
                    <readResponseHeader>
                        <responseHeader><![CDATA[HTTP/1.1 200 OK X-Backside-Transport: OK OK Connection: Keep-Alive Transfer-Encoding: chunked Date: Tue, 22 Dec 2015 17:41:25 GMT Set-Cookie: gdtws_JSessionID=VTzpW5LFWGJWJT2yS4y8pTWq8LWfrBp8Z5JyMpLz2N8JmX8rPxmF!285905933; path=/; HttpOnly Content-Type: text/xml X-Client-IP: 10.186.1.65 Set-Cookie: SERVICOS-48386- G_SERVICOS_TCP701=HCIOLPAKLNAC; Expires=Tue, 22-Dec-2015 19:41:25 GMT; Path=/ ]]></responseHeader>
                    </readResponseHeader>
                    <statusCode>200</statusCode>
                    <statusText>OK</statusText>
                    <readResponseBody>
                        <info>Response has no Content-Length header.</info>
                    </readResponseBody>
                </openHttpConnection>
                <success>1</success>
            </fullHttpRequest>
        </a_synchronousRequest>
        <totalTime>Elapsed time: 281 millisec</totalTime>
        <info>Success.</info>
    </fullRequest>
</SynchronousRequest>
</chilkatlog>

With version 9.5.0.54 nothing works an I have this LastErrorXml:

<ChilkatLog>
<SynchronousRequest ms="140">
    <DllDate>Oct 29 2015</DllDate>
    <ChilkatVersion>9.5.0.54</ChilkatVersion>
    <UnlockPrefix>ELABORHttp</UnlockPrefix>
    <Username>WIN7-PC:win7</Username>
    <Architecture>Little Endian; 32-bit</Architecture>
    <Language>ActiveX</Language>
    <VerboseLogging>1</VerboseLogging>
    <domain>servicos.portaldasfinancas.gov.pt</domain>
    <port>701</port>
    <ssl>1</ssl>
    <httpRequest>
        <httpVersion>1.1</httpVersion>
        <verb>POST</verb>
        <path>/sgdtws/documentosTransporte</path>
        <contentType />
        <charset>windows-1252</charset>
        <sendCharset>0</sendCharset>
        <mimeHeader>SOAPAction: envioDocumentoTransporte</mimeHeader>
    </httpRequest>
    <readTimeout>20</readTimeout>
    <connectTimeout>30</connectTimeout>
    <computeRequestDataSize>
        <info>Request body is in a memory buffer..</info>
    </computeRequestDataSize>
    <approxRequestSize>3052</approxRequestSize>
    <fullRequest ms="140">
        <httpRequest>
            <httpVersion>1.1</httpVersion>
            <verb>POST</verb>
            <path>/sgdtws/documentosTransporte</path>
            <contentType />
            <charset>windows-1252</charset>
            <sendCharset>0</sendCharset>
            <mimeHeader>SOAPAction: envioDocumentoTransporte</mimeHeader>
        </httpRequest>
        <HttpOptions>
            <AddHostHeader>1</AddHostHeader>
            <AllowCookieResponseCaching>0</AllowCookieResponseCaching>
            <AllowGzip>1</AllowGzip>
            <CookieDir />
            <FollowRedirects>1</FollowRedirects>
            <Login />
            <LoginDomain />
            <AuthMethod />
            <MaxResponseSize>0</MaxResponseSize>
            <MaxUrlLen>2000</MaxUrlLen>
            <PasswordLen>0</PasswordLen>
            <ReadTimeoutMs>20000</ReadTimeoutMs>
            <RequiredContentType />
            <ResumePoint>0</ResumePoint>
            <SaveCookies>1</SaveCookies>
            <SendBufferSize>65535</SendBufferSize>
            <SendCookies>1</SendCookies>
            <UnavailableRetryCount>0</UnavailableRetryCount>
            <UnavailableRetryWaitMs>2000</UnavailableRetryWaitMs>
        </HttpOptions>
        <a_synchronousRequest ms="140">
            <generateRequest>
                <httpRequestGenStartLine>
                    <authOnly>0</authOnly>
                    <hasMimeBody>1</hasMimeBody>
                    <genStartLine>
                        <startLine>POST /sgdtws/documentosTransporte HTTP/1.1</startLine>
                    </genStartLine>
                </httpRequestGenStartLine>
                <genHeaderSb>
                    <getMimeHeaderHttp>
                        <headerField>SOAPAction: envioDocumentoTransporte</headerField>
                    </getMimeHeaderHttp>
                </genHeaderSb>
                <addCookies>
                    <info>Not auto-adding cookies.</info>
                    <sendCookies>1</sendCookies>
                    <cookieDir />
                </addCookies>
                <addHostHeader>servicos.portaldasfinancas.gov.pt</addHostHeader>
            </generateRequest>
            <fullHttpRequest ms="140">
                <domain>servicos.portaldasfinancas.gov.pt</domain>
                <port>701</port>
                <ssl>1</ssl>
                <openHttpConnection ms="93">
                    <info>Opening connection directly to HTTP server.</info>
                    <httpHostname>servicos.portaldasfinancas.gov.pt</httpHostname>
                    <httpPort>701</httpPort>
                    <ssl>1</ssl>
                    <bUsingHttpProxy>0</bUsingHttpProxy>
                    <httpProxyAuthMethod />
                    <socket2Connect ms="93">
                        <connect2 ms="93">
                            <hostname>servicos.portaldasfinancas.gov.pt</hostname>
                            <port>701</port>
                            <ssl>1</ssl>
                            <connectImplicitSsl ms="93">
                                <info>Clearing TLS client certificates.</info>
                                <connectSocket ms="31">
                                    <domainOrIpAddress>servicos.portaldasfinancas.gov.pt</domainOrIpAddress>
                                    <port>701</port>
                                    <connectTimeoutMs>30000</connectTimeoutMs>
                                    <connect_ipv6_or_ipv4 ms="31">
                                        <info>Multi-threaded domain to IP address resolution</info>
                                        <info>connecting to IPV4 address...</info>
                                        <ipAddress>213.13.158.240</ipAddress>
                                        <createSocket>
                                            <info>Setting SO_SNDBUF size</info>
                                            <sendBufSize>262144</sendBufSize>
                                            <info>Setting SO_RCVBUF size</info>
                                            <recvBufSize>4194304</recvBufSize>
                                        </createSocket>
                                        <connect ms="31">
                                            <info>Waiting for the connect to complete...</info>
                                            <myIP>192.168.1.75</myIP>
                                            <myPort>53945</myPort>
                                            <info>socket connect successful.</info>
                                        </connect>
                                    </connect_ipv6_or_ipv4>
                                </connectSocket>
                                <clientHandshake ms="62">
                                    <certChain>
                                        <subjectDN>C=PT, ST=LISBOA, L=LISBOA, O=AT - Autoridade Tributaria e Aduaneira, OU=ASI, CN=TestesWebServices</subjectDN>
                                        <subjectDN>DC=local, DC=ritta, CN=DGITA Issuing CA1</subjectDN>
                                        <subjectDN>DC=local, DC=ritta, CN=DGITA Root CA</subjectDN>
                                    </certChain>
                                    <cacheClientCerts>
                                        <info>Cached TLS client certificates.</info>
                                        <certChain>
                                            <subjectDN>C=PT, ST=LISBOA, L=LISBOA, O=AT - Autoridade Tributaria e Aduaneira, OU=ASI, CN=TestesWebServices</subjectDN>
                                            <subjectDN>DC=local, DC=ritta, CN=DGITA Issuing CA1</subjectDN>
                                            <subjectDN>DC=local, DC=ritta, CN=DGITA Root CA</subjectDN>
                                        </certChain>
                                    </cacheClientCerts>
                                    <clientHandshake2 ms="62">
                                        <readHandshakeMessages>
                                            <processHandshakeRecord>
                                                <processHandshakeMessage>
                                                    <processServerHello>
                                                        <MajorVersion>3</MajorVersion>
                                                        <MinorVersion>3</MinorVersion>
                                                        <cipherSuite>RSA_WITH_AES_256_CBC_SHA</cipherSuite>
                                                        <cipherSuiteNumeric>00,35</cipherSuiteNumeric>
                                                        <compressionMethod>0</compressionMethod>
                                                        <minAcceptableRsaKeySize>1024</minAcceptableRsaKeySize>
                                                    </processServerHello>
                                                </processHandshakeMessage>
                                            </processHandshakeRecord>
                                        </readHandshakeMessages>
                                        <info>Sending client-side certificate(s)...</info>
                                        <sendClientCertificates>
                                            <buildCertificatesMessage>
                                                <numCerts>3</numCerts>
                                            </buildCertificatesMessage>
                                        </sendClientCertificates>
                                        <buildClientKeyExchange ms="15">
                                            <buildClientKeyExchangeRsa ms="15">
                                                <modulus_bitlen>2048</modulus_bitlen>
                                                <bigEndian>1</bigEndian>
                                                <padding>PKCS 1.5</padding>
                                            </buildClientKeyExchangeRsa>
                                        </buildClientKeyExchange>
                                        <sendCertificateVerify ms="32">
                                            <info>Sending ClientCertVerify message...</info>
                                            <signatureSize>260</signatureSize>
                                        </sendCertificateVerify>
                                    </clientHandshake2>
                                </clientHandshake>
                                <checkServerCert>
                                    <info>Not verifying server certificate...</info>
                                    <info>Set the RequireSslCertVerify property to enable verification.</info>
                                </checkServerCert>
                                <info>SSL/TLS Channel Established.</info>
                            </connectImplicitSsl>
                        </connect2>
                    </socket2Connect>
                    <socketOptions>
                        <SO_SNDBUF>262144</SO_SNDBUF>
                        <SO_RCVBUF>4194304</SO_RCVBUF>
                        <TCP_NODELAY>0</TCP_NODELAY>
                        <SO_KEEPALIVE>1</SO_KEEPALIVE>
                    </socketOptions>
                    <info>HTTPS secure channel established.</info>
                </openHttpConnection>
                <connectTime>Elapsed time: 93 millisec</connectTime>
                <startLine>POST /sgdtws/documentosTransporte HTTP/1.1</startLine>
                <fullRequestHeader>
                    <requestHeader><![CDATA[SOAPAction: envioDocumentoTransporte Host: servicos.portaldasfinancas.gov.pt:701 Content-Length: 3052]]></requestHeader>
                </fullRequestHeader>
                <computeRequestDataSize>
                    <info>Request body is in a memory buffer..</info>
                </computeRequestDataSize>
                <sendRequestHeader>
                    <sendHeaderElapsedMs>0</sendHeaderElapsedMs>
                </sendRequestHeader>
                <sendRequestBody>
                    <idleTimeoutMs>20000</idleTimeoutMs>
                    <sendBodyElapsedMs>0</sendBodyElapsedMs>
                </sendRequestBody>
                <readResponseHeader ms="32">
                    <responseHeader><![CDATA[HTTP/1.1 500 Internal Server Error Content-Type: text/xml X-Backside-Transport: FAIL FAIL Connection: close Set-Cookie: SERVICOS-48386-SG_SERVICOS_TCP701=HCIOLPAKLNAC; Expires=Tue, 22-Dec-2015 19:54:58 GMT; Path=/ ]]></responseHeader>
                </readResponseHeader>
                <statusCode>500</statusCode>
                <statusText>Internal Server Error</statusText>
                <readResponseBody ms="15">
                    <info>Response has no content-length.</info>
                    <info>Non-chunked response with no Content-Length.</info>
                    <readingUntilServerClosesConnection ms="15">
                        <info>Any errors reported within this context are not actual errors...</info>
                        <numBytesRequested>5</numBytesRequested>
                        <error>Connection closed by peer.</error>
                        <passiveClose ms="15">
                            <info>Passive socket closing complete.</info>
                        </passiveClose>
                        <error>Failed to read beginning of SSL/TLS record.</error>
                        <error>Failed to receive more TLS applicaton data.</error>
                        <readNToOutput>Socket connection closed.</readNToOutput>
                    </readingUntilServerClosesConnection>
                </readResponseBody>
                <checkCloseConnection>
                    <info>Response includes connection:close header (or proxy-connection:close header)</info>
                </checkCloseConnection>
            </fullHttpRequest>
            <originalUrl>https://servicos.portaldasfinancas.gov.pt:701/sgdtws/documentosTransporte</originalUrl>
            <success>1</success>
        </a_synchronousRequest>
        <success>1</success>
    </fullRequest>
    <totalTime>Elapsed time: 140 millisec</totalTime>
    <info>Success.</info>
</SynchronousRequest>
</chilkatlog>

Anyone can explain me what's the diference between them, since there is the same code and the same service behind them.

Tried a DIFF tool but couldn't understand diferences.


Accepted Answer

Solved!

Here is the explanation to whom may need it:

I use a chilkat RSA object to encrypt the communication as demanded by the service.

When implementing, I did LittleEndian = 1

Yet in version 9.0.49 this property changed as in Reference Documentation for RSA ActiveX:

LittleEndian As Long

The default value is 0, which means that signatures and encrypted output will be created using the big endian byte ordering. A value of 1 will produce little-endian output, which is what Microsoft's Crypto API produces.

Important: Prior to v9.5.0.49, this property behaved the opposite as it should for encryption. When updating from an older version of Chilkat to v9.5.0.49 or greater, the following change is required: 
•If the application did NOT explicity set the LittleEndian property, then no change is required for encryption/decryption. If signatures were being created or verified, then explicitly set this property to 1. 
•If the application explicitly set this property, then reverse the setting ONLY if doing encryption/decryption. No changes are required if doing signature creation/verification.

So the solution was to let it as Default since it was 1 until version 9.0.48 and is 0 after that.