Post by Stefano P.Meno di quello che potrebe sembrare: da certi web service WSDc può generare
quanto occorre (ed è quello che ho fatto): genera la classe java per il web
service e l'rpg per chiamare la classe java.
si, so che esiste questa possibilità, ma non ci ho mai messo il naso
Post by Stefano P.Dato che - nel mio caso - oltre che il collegamento c'è da andare a gestire
anche l'XML, tramite il java ho nascosto la complessità e mi sono occupato
solo di chiamare la classe e leggere quanto mi risponde; il resto è
programmazione più o meno "tradizionale"...
Con interesse
Stefano P.
ti allego il codice del lavoro del buon Scott, con le mie modifiche per
adattarlo al VIES
come vedrai è di una semplicità disarmante
Id&Fix
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* this service program check on VIES if VAT number is valid
*
* Copyright by Id&Fix (newsgroup: it.comp.as400)
* this program is based on a source by Scott C. Klements
* and uses his LIBHTTP (http://www.scottklement.com/)
* Many thanks to Scott for his great job
*
* Redistribution and use of this source is freely permitted.
*
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
H NOMAIN bnddir('QC2LE':'HTTPAPI')
H decedit('0,') datedit(*dmy/) option(*srcstmt:*nodebugio)
H expropts(*resdecpos)
DVatValid PR 10i 0
D ciso 2 value
D piva 20 value
DIncoming PR
D Result n
D depth 10i 0 value
D name 1024A varying const
D path 24576A varying const
D value 32767a varying const
D attrs * dim(32767)
D const options(*varsize)
*--------------------------------------------------------------*
*
* check on Vies if VAT number is valid
*
* Parameters ciso (char 2) INPUT
* piva (char 20) INPUT
* esito (char 2) OUTPUT
* name (char 50) OUTPUT
* address (char 50) OUTPUT
*
* ciso is the iso code of the nation
* piva contanins the Vat number
*
* return code:
* 0 : Vat number not valid
* 1 : Vat number valid
* -1 : error connecting to Vies
*
*--------------------------------------------------------------*
**********************
* VatValid
**********************
PVatValid B export
DVatValid PI 10i 0
D ciso 2 value
D piva 20 value
/copy libhttp/qrpglesrc,httpapi_h
D true S N inz(*on)
D false S N inz(*off)
D soap S 32767A varying
D result S N
D rc S 10i 0
/free
soap =
'<?xml version="1.0" encoding="UTF-8" standalone="no"?> ' +
' <SOAP-ENV:Envelope '+
'xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" '+
' xmlns:apachesoap="http://xml.apache.org/xml-soap" '+
' xmlns:impl="urn:ec.europa.eu:taxud:vies:services:checkVat" '+
' xmlns:intf="urn:ec.europa.eu:taxud:vies:services:checkVat" '+
' xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" '+
' xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types" '+
' xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" '+
' xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" '+
' xmlns:xsd="http://www.w3.org/2001/XMLSchema" '+
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > '+
' <SOAP-ENV:Body> '+
' <mns1:checkVat '+
'xmlns:mns1="urn:ec.europa.eu:taxud:vies:services:checkVat"> '+
' <countryCode>' + %trim(ciso) + '</countryCode> '+
' <vatNumber>' + %trim(piva) + '</vatNumber> '+
' </mns1:checkVat> '+
' </SOAP-ENV:Body> '+
' </SOAP-ENV:Envelope> ';
rc = http_url_post_xml(
'http://ec.europa.eu/taxation_customs/vies/api/checkVatPort':
%addr(soap) + 2:
%len(soap):
*NULL:
%paddr(Incoming):
%addr(Result):
HTTP_TIMEOUT:
HTTP_USERAGENT:
'text/xml':
'checkVat');
if (rc <> 1);
return -1;
else;
if (Result = true);
return 1;
else;
return 0;
endif;
endif;
/end-free
P E
************
* Incoming callback
************
PIncoming B
DIncoming PI
D Result n
D depth 10i 0 value
D name 1024A varying const
D path 24576A varying const
D value 32767a varying const
D attrs * dim(32767)
D const options(*varsize)
D true S N inz(*on)
D false S N inz(*off)
/free
if (name = 'valid');
if (value = 'true');
Result = true;
else;
Result = false;
endif;
endif;
/end-free
P E