[b] Example of use of utl_dbws not working properly [/b]
create or replace
function prova return varchar2
is
service_ sys.utl_dbws.SERVICE;
call_ sys.utl_dbws.CALL;
service_qname sys.utl_dbws.QNAME;
port_qname sys.utl_dbws.QNAME;
xoperation_qname sys.utl_dbws.QNAME;
xstring_type_qname sys.utl_dbws.QNAME;
-- response anydata;
response sys.xmltype;
richiesta sys.xmltype;
richiestastring varchar2(2000);
-- request varchar2(2000);
wsdl_url varchar2(2000);
l_input_params sys.utl_dbws.anydata_list;
string_type_qname sys.utl_dbws.QNAME;
begin
wsdl_url:= 'http://www.comune.grosseto.it/jEnteTest/services/JProtocolloWebservice?wsdl';
service_qname := sys.utl_dbws.to_qname(null, 'JProtocolloWebservice');
port_qname := sys.utl_dbws.to_qname(null,'JProtocolloWebservice');
xoperation_qname:=sys.utl_dbws.to_qname(null,'leggiProtocollo');
service_ := sys.utl_dbws.create_service( wsdl_document_location => URIFACTORY.getURI(wsdl_url), service_name => service_qname);
call_ := sys.utl_dbws.create_call( service_handle => service_, port_name => NULL, operation_name => xoperation_qname);
richiesta := sys.xmltype('JENTEGE'|| 'GE20090200001'||'');
richiestastring := 'JENTEGE'|| 'GE20090200001'||'';
sys.utl_dbws.set_property(call_,'OPERATION_STYLE','DOCUMENT');
-- sys.utl_dbws.set_property(call_,'OPERATION_STYLE','RPC');
string_type_qname := sys.utl_dbws.to_qname('http://www.w3.org/2001/XMLSchema', 'string');
sys.utl_dbws.add_parameter(call_, 'Request', string_type_qname, 'ParameterMode.IN');
-- l_input_params(0):=anydata.ConvertVarchar('PIPPO');
sys.utl_dbws.set_return_type(call_,string_type_qname);
-- response:= utl_dbws.invoke(call_Handle=>call_, l_input_params);
response:= utl_dbws.invoke(call_Handle=>call_, request=> richiesta);
return 'OK';
end;
/
[b] Errors in execution of invoke [/b]
SQL> @prova
Function created.
SQL> select prova from dual;
select prova from dual
*
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected an IN argument at position 1 that
is an instance of an Oracle type convertible to an instance of a user defined
Java class got an exception while converting to the user class
[b] Example of pure java working [/b]
package it.test;
import it.arezzo.infor.*;
import it.arezzo.infor.jente.jprotocollo.webservice.service.JProtocolloWebservice;
import it.arezzo.infor.jente.jprotocollo.webservice.service.JProtocolloWebserviceServiceLocator;
import it.arezzo.infor.jente.webservices.jprotocollo.leggiprotocollo.esito.RispostaDocument;
import it.arezzo.infor.jente.webservices.jprotocollo.leggiprotocollo.esito.RispostaDocument.Risposta;
public class TestWS {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//it.arezzo.infor.jente.jprotocollo.webservice.serviceClient wsc =
new it.arezzo.infor.jente.jprotocollo.webservice.serviceClient();
try
{
String indirizzows =
"http://www.comune.grosseto.it/jEnteTest/services/JProtocolloWebservice";
JProtocolloWebserviceServiceLocator services = new
JProtocolloWebserviceServiceLocator();
services.setJProtocolloWebserviceEndpointAddress(indirizzows);
JProtocolloWebservice protocolloService =
services.getJProtocolloWebservice();
String xml = "
LVRTNN63E07H501TGEGE20090200014";
String rispostaLeggi = protocolloService.leggiProtocollo(xml);
RispostaDocument risposta = RispostaDocument.Factory.parse(rispostaLeggi);
System.out.println("***RISPOSTA: "+rispostaLeggi+" ***");
System.out.println(risposta.getRisposta().getEsito());
System.out.println(risposta.getRisposta().getProtocollo().toString());
} catch (Exception ex)
{
ex.printStackTrace();
}
}
}
[b]Wsdl definition [/b]
--
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−
−