• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Error Csnet Read Operation Failed (winsock Reported Error=0) (11773)

#1
Hello everybody, good afternoon!

Have version OpenEdge 11.6.3, 03 HOTFIXES.

I'm trying to run the code below:

CREATE SERVER hWebService.
hWebService:CONNECT("-WSDL 'https://preproducao.roadcard.com.br/sistemapamcard/services/WSTransacional?WSDL'
-Port WSTransacional
-sslAuth ssl
-sslKeyFile C:\temp\pamcard\host2017.pfx
-sslKeyPwd hjbg374489").
RUN WSTransacional SET hWSTransacional ON hWebService.

RUN EXECUTE IN hWSTransacional (INPUT lcInput, OUTPUT lcOutput).

And I am getting the following error:

Error receiving Web Service Response: Fatal Error: csnet read operation failed (WinSock reported error=0) (11773)

The error occurs when we execute this line of code:

RUN EXECUTE IN hWSTransacional (INPUT lcInput, OUTPUT lcOutput).

Anyone know tell me how can I solve?
Thank you
 

Cecil

17+ years progress programming and still learning.
#3
Looking at the documentation, I think you are missing the DATASET parameter:

Are you passing a LONGCHAR variable where it's context is an XML string or are you passing in a DATASET?


Code:
DEFINE VARIABLE hWebService AS HANDLE NO-UNDO.
DEFINE VARIABLE hWSTransacional AS HANDLE NO-UNDO.

DEFINE TEMP-TABLE arg0 NO-UNDO
    NAMESPACE-URI ""
    FIELD context AS CHARACTER .

DEFINE TEMP-TABLE fields1 NO-UNDO
    NAMESPACE-URI ""
    XML-NODE-NAME "fields"
    FIELD key AS CHARACTER
    FIELD value1 AS CHARACTER
        XML-NODE-NAME "value"
    FIELD arg0_id AS RECID
        XML-NODE-TYPE "HIDDEN" .HIDDEN" .

DEFINE DATASET execute NAMESPACE-URI "http://webservice.pamcard.jee.pamcary.com.br"
    FOR arg0, fields1
    PARENT-ID-RELATION RELATION1 FOR arg0, fields1
        PARENT-ID-FIELD arg0_id.

DEFINE TEMP-TABLE return1 NO-UNDO
    NAMESPACE-URI ""
    XML-NODE-NAME "return"
    FIELD return1_field AS INTEGER
        XML-NODE-TYPE "HIDDEN" .HIDDEN" .

DEFINE TEMP-TABLE fields1 NO-UNDO
    NAMESPACE-URI ""
    XML-NODE-NAME "fields"
    FIELD key AS CHARACTER
    FIELD value1 AS CHARACTER
        XML-NODE-NAME "value"
    FIELD return1_id AS RECID
        XML-NODE-TYPE "HIDDEN" .HIDDEN" .

DEFINE DATASET executeResponse NAMESPACE-URI "http://webservice.pamcard.jee.pamcary.com.br"
    FOR return1, fields1
    PARENT-ID-RELATION RELATION1 FOR return1, fields1
        PARENT-ID-FIELD return1_id.

CREATE SERVER hWebService.hWebService

hWebService:CONNECT("-WSDL 'https://preproducao.roadcard.com.br/sistemapamcardwsdl/WSTransacional-wsdl.xml?WSDL'").

RUN WSTransacional SET hWSTransacional ON hWebService.hWebService.

RUN execute IN hWSTransacional(INPUT DATASET execute, OUTPUT DATASET executeResponse).
 
Last edited:
#4
I tried to use this template but how do I send the DATASET run with the data for the search? I create the record in the fields1 table?
The DATASET run is INPUT, and note that the temp-table fieldes1 is set 2 times.

Tanks
 

Cecil

17+ years progress programming and still learning.
#5
Okay,... I see that the WSDL analyzer tool has generated two temp-tables with the same name which is causing a bit of confusion.

I have refactored the code (see Below) and I have also included -SOAPEndpoint parameter.

Code:
DEFINE VARIABLE hWebService     AS HANDLE NO-UNDO.
DEFINE VARIABLE hWSTransacional AS HANDLE NO-UNDO.

&SCOPED-DEFINE xFormated TRUE 

/** REQUEST Group. START**/

DEFINE TEMP-TABLE arg0 NO-UNDO
    NAMESPACE-URI ""
    FIELD context AS CHARACTER XML-NODE-NAME "context".

DEFINE TEMP-TABLE fieldsRequest NO-UNDO
    NAMESPACE-URI ""
    XML-NODE-NAME "fields"
    FIELD key       AS CHARACTER XML-NODE-NAME "key"
    FIELD value1    AS CHARACTER XML-NODE-NAME "value"
    FIELD arg0_id   AS RECID     XML-NODE-TYPE "HIDDEN" .

DEFINE DATASET executeRequest NAMESPACE-URI "http://webservice.pamcard.jee.pamcary.com.br"
    XML-NODE-NAME "execute"
    FOR arg0, fieldsRequest
    PARENT-ID-RELATION RELATION1 FOR arg0, fieldsRequest
        PARENT-ID-FIELD arg0_id.
      
/** REQUEST Group.. END**/

/** RESPOUNCE Group.. START**/

DEFINE TEMP-TABLE returnResponce NO-UNDO
    NAMESPACE-URI ""
    XML-NODE-NAME "return"
    FIELD return1_field AS INTEGER XML-NODE-TYPE "HIDDEN" .

DEFINE TEMP-TABLE fieldsResponce NO-UNDO
    NAMESPACE-URI ""
    XML-NODE-NAME "fields"
    FIELD key           AS CHARACTER    XML-NODE-NAME "key"
    FIELD value1        AS CHARACTER    XML-NODE-NAME "value"
    FIELD return1_id    AS RECID        XML-NODE-TYPE "HIDDEN" .

DEFINE DATASET executeResponse
    NAMESPACE-URI "http://webservice.pamcard.jee.pamcary.com.br"
    XML-NODE-NAME "executeResponse"
    FOR returnResponce, fieldsResponce
    PARENT-ID-RELATION RELATION1 FOR returnResponce, fieldsResponce
        PARENT-ID-FIELD return1_id  .

/** RESPOUNCE Group.. END**/


CREATE SERVER hWebService.

hWebService:CONNECT("-WSDL 'https://preproducao.roadcard.com.br/sistemapamcardwsdl/WSTransacional-wsdl.xml?WSDL'
                     -SOAPEndpoint https://preproducao.roadcard.com.br/sistemapamcardwsdl/WSTransacional-wsdl.xml").

RUN WSTransacional SET hWSTransacional ON hWebService.     
      
/*** Create

Create the necessary Temp-tables here.

****/

      
/** debug**/     
DATASET executeRequest:WRITE-XML("file",SESSION:TEMP-DIRECTORY + "/executeRequest.xml":U, {&xFormated} ). 
      
RUN execute IN hWSTransacional(INPUT  DATASET executeRequest,
                               OUTPUT DATASET executeResponse).

/** debug**/     
DATASET executeRequest:WRITE-XML("file",SESSION:TEMP-DIRECTORY + "/executeResponse.xml":U, {&xFormated} ). 

/** Garbage collection is needed here. i.e. DELETE OBJECT hWebService.**/
 
Last edited:
#7
I'm using Progress 11.6, now the error is another:

1513597113332.png


I add the code with the "Create":

Code:
DEFINE VARIABLE hWebService     AS HANDLE NO-UNDO.
DEFINE VARIABLE hWSTransacional AS HANDLE NO-UNDO.
DEF VAR err AS LOG NO-UNDO.
&SCOPED-DEFINE xFormated TRUE 
/** REQUEST Group.. START**/
DEFINE TEMP-TABLE arg0 NO-UNDO
    NAMESPACE-URI ""
    FIELD context AS CHARACTER XML-NODE-NAME "context".
DEFINE TEMP-TABLE fieldsRequest NO-UNDO
    NAMESPACE-URI ""
    XML-NODE-NAME "fields"
    FIELD key       AS CHARACTER XML-NODE-NAME "key"
    FIELD value1    AS CHARACTER XML-NODE-NAME "value"
    FIELD arg0_id   AS RECID     XML-NODE-TYPE "HIDDEN" .
DEFINE DATASET executeRequest NAMESPACE-URI "http://webservice.pamcard.jee.pamcary.com.br"
    XML-NODE-NAME "execute"
    FOR arg0, fieldsRequest
    PARENT-ID-RELATION RELATION1 FOR arg0, fieldsRequest
        PARENT-ID-FIELD arg0_id.
      
/** REQUEST Group.. END**/
/** RESPOUNCE Group.. START**/
DEFINE TEMP-TABLE returnResponce NO-UNDO
    NAMESPACE-URI ""
    XML-NODE-NAME "return"
    FIELD return1_field AS INTEGER XML-NODE-TYPE "HIDDEN" .
DEFINE TEMP-TABLE fieldsResponce NO-UNDO
    NAMESPACE-URI ""
    XML-NODE-NAME "fields"
    FIELD key           AS CHARACTER    XML-NODE-NAME "key"
    FIELD value1        AS CHARACTER    XML-NODE-NAME "value"
    FIELD return1_id    AS RECID        XML-NODE-TYPE "HIDDEN" .
DEFINE DATASET executeResponse
    NAMESPACE-URI "http://webservice.pamcard.jee.pamcary.com.br"
    XML-NODE-NAME "executeResponse"
    FOR returnResponce, fieldsResponce
    PARENT-ID-RELATION RELATION1 FOR returnResponce, fieldsResponce
        PARENT-ID-FIELD return1_id  .
/** RESPOUNCE Group.. END**/

CREATE SERVER hWebService.
hWebService:CONNECT("-WSDL 'https://preproducao.roadcard.com.br/sistemapamcardwsdl/WSTransacional-wsdl.xml?WSDL'
                     -SOAPEndpoint Index of /sistemapamcardwsdl").
RUN WSTransacional SET hWSTransacional ON hWebService.     
      
/*** Create
Create the necessary Temp-tables here.*/
CREATE arg0.
ASSIGN arg0.context = "FindCard".
CREATE fieldsRequest.
ASSIGN fieldsRequest.KEY    = "viagem.contratante.documento.numero"
       fieldsRequest.value1 = "43461789000190".
CREATE fieldsRequest.
ASSIGN fieldsRequest.KEY    = "viagem.cartao.numero"
       fieldsRequest.value1 = "4417819800000860".
/****/
      
/** debug**/     
DATASET executeRequest:WRITE-XML("file",SESSION:TEMP-DIRECTORY + "/executeRequest.xml":U, {&xFormated} ). 
      
RUN execute IN hWSTransacional(INPUT  DATASET executeRequest,
                               OUTPUT DATASET executeResponse).

RUN ErrorInfo (OUTPUT err).
/* IF NOT err THEN DO:                       */
/*     MESSAGE STRING(cResponse) "~n"        */
/*      STRING(MTIME - li) " milisecondes."  */
/*      VIEW-AS ALERT-BOX.                   */
/* END.                                      */

/** debug**/     
DATASET executeRequest:WRITE-XML("file",SESSION:TEMP-DIRECTORY + "/executeResponse.xml":U, {&xFormated} ). 
/** Garbage collection is needed here. i.e. DELETE OBJECT hWebService.**/

/*******************************************************************/
PROCEDURE ErrorInfo: /*1*/
  DEFINE OUTPUT PARAMETER errorfound AS LOGICAL INITIAL FALSE.
  DEFINE VARIABLE i                  AS INTEGER NO-UNDO.
  DEFINE VARIABLE hSOAPFault         AS HANDLE NO-UNDO.
  DEFINE VARIABLE hSOAPFaultDetail   AS HANDLE NO-UNDO.
  DEFINE VARIABLE HeaderXML AS LONGCHAR VIEW-AS EDITOR SIZE 70 BY 15 LARGE.
  IF ERROR-STATUS:NUM-MESSAGES > 0 THEN DO:
     errorfound = TRUE.
     DO i = 1 TO ERROR-STATUS:NUM-MESSAGES:
        MESSAGE ERROR-STATUS:GET-MESSAGE(i) VIEW-AS ALERT-BOX.
     END.
/*2*/
     IF VALID-HANDLE(ERROR-STATUS:ERROR-OBJECT-DETAIL) THEN DO:
       hSOAPFault = ERROR-STATUS:ERROR-OBJECT-DETAIL.
       MESSAGE
       "Fault Code: "   hSOAPFault:SOAP-FAULT-CODE        SKIP
       "Fault String: " hSOAPFault:SOAP-FAULT-STRING      SKIP
       "Fault Actor: "  hSOAPFault:SOAP-FAULT-ACTOR       SKIP
       "Error Type: "   hSOAPFault:TYPE  VIEW-AS ALERT-BOX.
/*3*/
       IF VALID-HANDLE(hSOAPFault:SOAP-FAULT-DETAIL) THEN  DO:
            hSOAPFaultDetail = hSOAPFault:SOAP-FAULT-DETAIL.
            MESSAGE  "Error Type: " hSOAPFaultDetail:TYPE
                     VIEW-AS ALERT-BOX.
            HeaderXML = hSOAPFaultDetail:GET-SERIALIZED().
            DISPLAY HeaderXML LABEL "Serialized SOAP fault detail"
                    WITH FRAME a.
        END.
     END.
  END.
END PROCEDURE.
/*******************************************************************/
 
Last edited by a moderator:

Cecil

17+ years progress programming and still learning.
#8
I believe the 301 return code is an HTTP URL redirect. Somehow the service you are accessing is not where it should be.
 
#9
Hello, how are you?
Please, do you know how to use the POST method, when consuming Webservices?
According to the webservice provider, my source in Progress is using the GET method and should use the POST method. In case this method GET, is with error in the consumption of the webservice.

Tanks