Progress - Consumiendo webservices

   
Vista:

Consumiendo webservices

Publicado por Cesar cch2069@yahoo.com (1 intervención) el 07/08/2015 06:29:54
Necesito consumir el web service OFAC (http://www.webservicex.net/OFACSDN.asmx?op=IsSDNAndBlockedPersons) y he creado el script ofac.p detallado abajo. Al ejecutarlo obtengo el error 11781 (Malformed XML fragment: only whitespace content allowed outside root element at line 1 and column 5) al invocar el comando: RUN IsSDNAndBlockedPersons IN hOFACSDNSoap(INPUT names,
OUTPUT IsSDNAndBlockedPersonsResponse) no-error.



Gracias por tu ayuda!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* ofac.p */
* ofac.p progress 10 ver*/
 
DEFINE VARIABLE hWebService AS HANDLE NO-UNDO.
DEFINE VARIABLE hOFACSDNSoap AS HANDLE NO-UNDO.
DEFINE VARIABLE names AS CHARACTER format 'x(70)' NO-UNDO.
DEFINE variable hMyIsSDNAndBlocked as handle no-undo.
DEFINE variable IsSDNAndBlockedPersonsResponse as longchar no-undo.
CREATE SERVER hWebService.
hWebService:CONNECT("-WSDL 'http://www.webservicex.net/OFACSDN.asmx?WSDL'").
 
if NOT hWebService:CONNECTED() THEN DO:
    MESSAGE "SERVER: "
    SKIP "http://www.webservicex.net/OFACSDN.asmx?WSDL"
    SKIP "is not connected"
        VIEW-AS ALERT-BOX INFO BUTTONS OK.
    RETURN.
END.
RUN OFACSDNSoap SET hOFACSDNSoap ON hWebService.
IF NOT VALID-HANDLE(hOFACSDNSoap) THEN DO:
MESSAGE "PortType: " VALID-HANDLE(hOFACSDNSoap) " is not valid"
        VIEW-AS ALERT-BOX INFO BUTTONS OK.
        RETURN.
END.
update names.
RUN IsSDNAndBlockedPersons IN hOFACSDNSoap(INPUT names,
   OUTPUT IsSDNAndBlockedPersonsResponse) no-error.
IF ERROR-STATUS:ERROR THEN DO:
  DEFINE VARIABLE iCnt AS INTEGER NO-UNDO.
  DO iCnt = 1 TO ERROR-STATUS:NUM-MESSAGES:
      MESSAGE ERROR-STATUS:GET-MESSAGE(iCnt)
          VIEW-AS ALERT-BOX INFO BUTTONS OK.
  END.
IF VALID-HANDLE(ERROR-STATUS:ERROR-OBJECT-DETAIL) THEN DO:
     DEFINE VARIABLE hXML        AS HANDLE     NO-UNDO.
     DEFINE VARIABLE mDoc        AS MEMPTR     NO-UNDO.
     CREATE X-DOCUMENT hXML.
   hXML:LOAD('LONGCHAR',
ERROR-STATUS:ERROR-OBJECT-DETAIL:SOAP-FAULT-DETAIL:GET-SERIALIZED(),FALSE).
     hXML:SAVE("memptr", mDoc).
     MESSAGE "Fault Code  : " ERROR-STATUS:ERROR-OBJECT-DETAIL:SOAP-FAULT-CODE
 SKIP
           "Fault String: " ERROR-STATUS:ERROR-OBJECT-DETAIL:SOAP-FAULT-STRING
 SKIP
           "Fault Actor : " ERROR-STATUS:ERROR-OBJECT-DETAIL:SOAP-FAULT-ACTOR
  SKIP
           "Error Type  : " ERROR-STATUS:ERROR-OBJECT-DETAIL:TYPE  SKIP SKIP
                "Fault Detail: " SKIP GET-STRING(mDoc,1)
        VIEW-AS ALERT-BOX INFO BUTTONS OK.
  END.
END.
else do:
 
 CEATE X-DOCUMENT hMyIsSDNAndBlocked.
 hMyIsSDNAndBlocked:LOAD("longchar",IsSDNAndBlockedPersonsResponse,FALSE).
 hMyIsSDNAndBlocked:SAVE("file",'ofacResponse').
 DELETE OBJECT hMyIsSDNAndBlocked.
 message "Ofac written". pause.
 DELETE PROCEDURE hOFACSDNSoap.
 hWebService:DISCONNECT().
 DELETE OBJECT hWebService.
 
end.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder