Error running the PL/SQL consuming web services demo
I downloaded and installed the PL/SQL code from:
http://technet.oracle.com/tech/webservices/htdocs/samples/dbwebservice/DBWebServices_PLSQL.html
on Oracle 9i version 2 (on both Windows and Solaris) which can be used to consume simple web services. However, I got the following error running the local time demo:
select time_service.GET_LOCAL_TIME('19104') from dualORA-30625: method dispatch on NULL SELF argument is disallowed
ORA-06512: at "XN.DEMO_SOAP", line 84
ORA-06512: at "XN.TIME_SERVICE", line 13
It appears to occur upon doing this:
resp.doc.getstringval()
It seems to mean eith resp or resp.doc is null. BTW, the following:
select utl_http.request('www.oracle.com') from dual
works fine, so does the web service URL. Please
help me get this work!
Thanks a lot!
I downloaded and installed the PL/SQL code from:
http://technet.oracle.com/tech/webservices/htdocs/samples/dbwebservice/DBWebServices_PLSQL.html
on Oracle 9i version 2 (on both Windows and Solaris) which can be used to consume simple web services. However, I got the following error running the local time demo:
select time_service.GET_LOCAL_TIME('19104') from dualORA-30625: method dispatch on NULL SELF argument is disallowed
ORA-06512: at "XN.DEMO_SOAP", line 84
ORA-06512: at "XN.TIME_SERVICE", line 13
It appears to occur upon doing this:
resp.doc.getstringval()
It seems to mean eith resp or resp.doc is null. BTW, the following:
select utl_http.request('www.oracle.com') from dual
works fine, so does the web service URL. Please
help me get this work!
Thanks a lot!
Similar Messages
-
Error running demo PL/SQL consuming web services
I downloaded and installed the code from:
http://technet.oracle.com/tech/webservices/htdocs/samples/dbwebservice/DBWebServices_PLSQL.html
on Oracle 9i version 2 (on both Windows and Solaris).
But I got the following error running the local time
demo:
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1022
ORA-12545: Connect failed because target host or object does not exist
ORA-06512: at "XN.DEMO_SOAP", line 72
ORA-06512: at "XN.TIME_SERVICE", line 13
ORA-06512: at line 2
The error occurs on this line:
http_req := utl_http.begin_request(url, 'POST','HTTP/1.0');
Can anybody tell me what I do wrong? Thanks a lot!
Also, is there any alternative ways to consume web services
using PL/SQL only? Many thanks!
Henry X.Mike,
Thanks so much for your help. I tried your code just now.
Same error:
ORA-30625: method dispatch on NULL SELF argument is disallowed
ORA-06512: at "XN.DEMO_SOAP", line 50
ORA-06512: at "XN.DEMO_SOAP", line 83
ORA-06512: at "XN.TIME_SERVICE", line 27
ORA-06512: at line 7
Let me post the code I am using. Note that
I removed the code for using proxy in time_service.
Henry
-- code for calling the time_service
DECLARE
ZIPCODE VARCHAR2(200);
v_Return VARCHAR2(200);
BEGIN
ZIPCODE := '94065';
v_Return := TIME_SERVICE.GET_LOCAL_TIME(ZIPCODE => ZIPCODE);
DBMS_OUTPUT.PUT_LINE('v_Return = ' || v_Return);
END;
-- code for the package demo_soap
CREATE OR REPLACE PACKAGE demo_soap AS
TYPE request IS RECORD (
method VARCHAR2(256),
namespace VARCHAR2(256),
body VARCHAR2(32767));
TYPE response IS RECORD (
doc xmltype);
FUNCTION new_request(method IN VARCHAR2,
namespace IN VARCHAR2)
RETURN request;
PROCEDURE add_parameter(req IN OUT NOCOPY request,
name IN VARCHAR2,
type IN VARCHAR2,
value IN VARCHAR2);
FUNCTION invoke(req IN OUT NOCOPY request,
url IN VARCHAR2,
action IN VARCHAR2) RETURN response;
FUNCTION get_return_value(resp IN OUT NOCOPY response,
name IN VARCHAR2,
namespace IN VARCHAR2) RETURN VARCHAR2;
END;
CREATE OR REPLACE PACKAGE BODY demo_soap AS
FUNCTION new_request(method IN VARCHAR2,
namespace IN VARCHAR2)
RETURN request AS
req request;
BEGIN
req.method := method;
req.namespace := namespace;
RETURN req;
END;
PROCEDURE add_parameter(req IN OUT NOCOPY request,
name IN VARCHAR2,
type IN VARCHAR2,
value IN VARCHAR2) AS
BEGIN
req.body := req.body ||
'<'||name||' xsi:type="'||type||'">'||value||'</'||name||'>';
END;
PROCEDURE generate_envelope(req IN OUT NOCOPY request,
env IN OUT NOCOPY VARCHAR2) AS
BEGIN
env := '<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body><'||req.method||' '||req.namespace||'
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'||
req.body||'</'||req.method||'></SOAP-ENV:Body></SOAP-ENV:Envelope>';
END;
PROCEDURE show_envelope(env IN VARCHAR2) AS
i pls_integer;
len pls_integer;
BEGIN
i := 1; len := length(env);
WHILE (i <= len) LOOP
dbms_output.put_line(substr(env, i, 60));
i := i + 60;
END LOOP;
END;
PROCEDURE check_fault(resp IN OUT NOCOPY response) AS
fault_node xmltype;
fault_code VARCHAR2(256);
fault_string VARCHAR2(32767);
BEGIN
fault_node := resp.doc.extract('/soap:Fault',
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/');
IF (fault_node IS NOT NULL) THEN
fault_code := fault_node.extract('/soap:Fault/faultcode/child::text()',
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/').getstringval();
fault_string := fault_node.extract('/soap:Fault/faultstring/child::text()',
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/').getstringval();
raise_application_error(-20000, fault_code || ' - ' || fault_string);
END IF;
END;
FUNCTION invoke(req IN OUT NOCOPY request,
url IN VARCHAR2,
action IN VARCHAR2) RETURN response AS
env VARCHAR2(32767);
http_req utl_http.req;
http_resp utl_http.resp;
resp response;
BEGIN
generate_envelope(req, env);
-- show_envelope(env);
http_req := utl_http.begin_request(url, 'POST','HTTP/1.0');
utl_http.set_header(http_req, 'Content-Type', 'text/xml');
utl_http.set_header(http_req, 'Content-Length', length(env));
utl_http.set_header(http_req, 'SOAPAction', action);
utl_http.write_text(http_req, env);
http_resp := utl_http.get_response(http_req);
utl_http.read_text(http_resp, env);
utl_http.end_response(http_resp);
resp.doc := xmltype.createxml(env);
resp.doc := resp.doc.extract('/soap:Envelope/soap:Body/child::node()',
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"');
-- show_envelope(resp.doc.getstringval());
check_fault(resp);
RETURN resp;
END;
FUNCTION get_return_value(resp IN OUT NOCOPY response,
name IN VARCHAR2,
namespace IN VARCHAR2) RETURN VARCHAR2 AS
BEGIN
RETURN resp.doc.extract('//'||name||'/child::text()',
namespace).getstringval();
END;
END;
-- code for the package time_service
CREATE OR REPLACE PACKAGE time_service AS
FUNCTION get_local_time(zipcode IN VARCHAR2) RETURN VARCHAR2;
END;
CREATE OR REPLACE PACKAGE BODY time_service AS
-- Location of Web service definition
-- http://www.alethea.net/webservices/LocalTime.asmx?WSDL
FUNCTION get_local_time(zipcode IN VARCHAR2) RETURN VARCHAR2 IS
req demo_soap.request;
resp demo_soap.response;
BEGIN
req := demo_soap.new_request('LocalTimeByZipCode',
'xmlns="http://www.alethea.net/webservices/"');
demo_soap.add_parameter(req, 'ZipCode', 'xsd:string', zipcode);
resp := demo_soap.invoke(req,
'http://www.alethea.net/webservices/LocalTime.asmx',
'http://www.alethea.net/webservices/LocalTimeByZipCode');
RETURN demo_soap.get_return_value(resp, 'LocalTimeByZipCodeResult',
'xmlns="http://www.alethea.net/webservices/"');
END;
END; -
Consuming Web Service - Proxy Generation Terminated
Hello all,
I have recently been exploring the capabilities of consuming Web Services from ABAP and have run into some issues.
When I generate the Client Proxy from different WSDL files, I am frequently getting these two errors:
<i>Proxy generation terminated: "mixed content" not supported</i>
<i>Proxy generation terminated: WSDL error (<extension> not supported)</i>
Is this just a limitation of ABAP? If I get these errors, is there any way to use the Web Service?
Thanks in advance!Hi, had the same issue. try to rename the file to .xml ending.
HTH; rgds, marco -
How to Consume Web Service?
Hi Experts,
I need to call a Function Module in the Exit.
In this Function Create to write the code to consume web service created by third party.
Then get the Data from there and uodate SAP
Can u plz help me with the Steps Involved in this?Hi Mohsin,
Please chk this link once for consuming web services..
http://help.sap.com/saphelp_nw70/helpdata/en/bf/d005244e9d1d4d92b2fe7935556b4c/frameset.htm
http://help.sap.com/saphelp_nw04/Helpdata/EN/b4/6aae409567942ae10000000a155106/content.htm.
U shuld have authorizations for tcodes WSADMIN and SOAMANAGER for creating web services
Hope it will be useful..
Regards,
Lakshman.
Edited by: Lakshman N on Jan 13, 2009 12:06 PM -
Hi I m getting the below wxpection when i run test browser from workshop. please help me.
An unexpected exception occurred while attempting to locate the run-time information for this Web Service. Error: java.lang.reflect.InvocationTargetException:nullThamarai,
Can you provide more information on your jws ? Also can you start the server
from the command line with verbose option. This will cause
weblogic_debug.log to be generated in the domain folder.
Raj Alagumalai
Backline Workshop Support
"Thamarai Selvan" <[email protected]> wrote in message
news:[email protected]..
Hi I m getting the below wxpection when i run test browser from workshop.please help me.
>
An unexpected exception occurred while attempting to locate the run-timeinformation for this Web Service. Error:
java.lang.reflect.InvocationTargetException:null -
Error consuming Web service from an ABAP Program
Hello guys,
I'm trying to consume a Web Service that is exposed in the internet. The conecction to the Web Service its via SSL.
I'm having a problem at the moment I call the web service from my abap program. But I'm able to test the same web service, from the SE80 tx with out trouble.
I have identify that there is a difference in the SOAP envelope, that its received in the Web service, when I call it from the test enviorment and when I call it from the program.
This is how it is received from the TEST tool (a succesfull call of th WS) :
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header><n0:Trace xmlns:n0="http://www.sap.com/webas/630/soap/features/runtime/tracing/"><TraceLevel xmlns="http://www.sap.com/webas/630/soap/features/runtime/tracing/">Error</TraceLevel></n0:Trace></soap-env:Header><soap-env:Body><nr1:putXMLDocument xmlns:nr1="http://bel.bci.cl/WsBEL/services/Carga"><body><?xml version="1.0" encoding="ISO-8859-1"?><Mensaje><RutEmpresa><Numero>76555400</Numero><Digito>4</Digito></RutEmpresa><RutUsuario><Numero>12307972</Numero><Digito>8</Digito></RutUsuario><Convenio>58422</Convenio><Pin>aro79728</Pin><Archivo><Tipo>PPR</Tipo><Plantilla>2142970592</Plantilla><Nombre>cargatest174.txt</Nombre><Cuerpo><![CDATA[G126919727 JORGE CRISTIAN VARGAS ROMERO 0000VVC01600000000000000000000245FAC0000000089900032000021030000010000000000190000 2910200714082008Boletas honorarios|]]></Cuerpo></Archivo><Fecha>20080814</Fecha></Mensaje></body></nr1:putXMLDocument></soap-env:Body></soap-env:Envelope>
And this is how it is received when I consume the web service from the ABAP program.
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header><n0:Trace xmlns:n0="http://www.sap.com/webas/630/soap/features/runtime/tracing/"><TraceLevel xmlns="http://www.sap.com/webas/630/soap/features/runtime/tracing/">Error</TraceLevel></n0:Trace></soap-env:Header><soap-env:Body><nr1:putXMLDocument xmlns:nr1="http://bel.bci.cl/WsBEL/services/Carga"><body><?xml version="1.0" encoding="utf-8" ?><nr1:putXMLDocument xmlns:nr1="http://bel.bci.cl/WsBEL/services/Carga"><body><?xml version="1.0" encoding="ISO-8859-1"?><Mensaje><RutEmpresa><Numero>76555400</Numero><Digito>4</Digito></RutEmpresa><RutUsuario><Numero>12307972</Numero><Digito>8</Digito></RutUsuario><Convenio>58422</Convenio><Pin>aro79728</Pin><Archivo><Tipo>PPR</Tipo><Plantilla>2142970592</Plantilla><Nombre>cargatest174.txt</Nombre><Cuerpo><![CDATA[G126919727 JORGE CRISTIAN VARGAS ROMERO 0000VVC01600000000000000000000245FAC0000000089900032000021030000010000000000190000 2910200714082008Boletas honorarios|]]></Cuerpo></Archivo><Fecha>20080814</Fecha></Mensaje></body></nr1:putXMLDocument></body></nr1:putXMLDocument></soap-env:Body></soap-env:Envelope>
As you can see, it is generating a nr1:putXMLDocument tag, that it should not go there.
Why do you think that this situation is happening? Please guys, this is very important, and need your help. Thanks in advance.
Samuel.BSP a Developer's Journal Part XIV - Consuming WebServices with ABAP
Calling WebServices from ABAP via HTTPS
Consuming Web Service from ABAP by Durairaj Athavan Raja
Search on SDN wiki, and you will find above mentioned links. -
Error when running P6 web services Demo
Hi All,
I am trying to run P6 web services demo application, p6 web services server is running, however I get this error when running the demo application:
org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
Appreciate if someone can help me to resolve it.
Thanks in advanceIf you are getting this error, then you are most likely compiling your code with a different JVM than what is shipped with the application server. Oracle9iAS Release 2 (9.0.2) uses the JDK1.3.1. I got this error when I compiled the code with JDK1.4.0_01.
-
REP-1437: Run time error in the PL/SQL development environment (DE).
I have a report that has always worked. Now I get the following error
REP-0003: Warning: Unable to open global preference file.
Starting report STCONF6 [Mon Nov 10 21:38:59 2008] ...
REP-1437: Run time error in the PL/SQL development environment (DE).
PDE-PSD001 Could not resolve reference to <Unknown Program Unit> while loading <Unknown> <Unknown>.
End report STCONF6 [Mon Nov 10 21:39:10 2008].
What is it? I DON'T know.
Regards SILVIAI recall my report from a form, I get the parameter form with my parameters, then click on the traffic light to run and the error appears here
Silvia -
Error when running the apxldimg.sql to update the images direct from rel3.0
Hi everyone,
I'm new to APEX. I'm upgrading from v3.0 to v3.1. I'm on the post-installation, section on "Updating the Images Directory When Upgrading from Release 3.0", I ran into error below when running the apxldimg.sql script. Has anyone run into the is error before. If yes, how did you fix it?
Directory created.
filelist_xml xmltype := xmltype(bfilename(upload_directory_name,file_list),nls_charset_id('AL32UTF8'));
ERROR at line 15:
ORA-06550: line 15, column 36:
PLS-00306: wrong number or types of arguments in call to 'XMLTYPE'
ORA-06550: line 15, column 25:
PL/SQL: Item ignored
ORA-06550: line 38, column 15:
PLS-00302: component 'EXISTSRESOURCE' must be declared
ORA-06550: line 38, column 3:
PL/SQL: Statement ignored
ORA-06550: line 52, column 46:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 52, column 3:
PL/SQL: Statement ignoredMy team member found another post that ran into the same problem and the section is for 11g only. My db is 9.2.0.5.
-
Consume Web Service In Coldfusion Error
I'm having a problem using cfinvoke or adding this web service url in the coldfusion admin.
<cfinvoke returnvariable="returndata" webservice="http://www.fortedata.com:8080/axis2/services/FdsWebService?wsdl" refreshwsdl="yes" method="PostData">
I get the error for cfinvoke
"Cannot generate stub objects for web service invocation. "
"Name:
http://www.fortedata.com:8080/axis2/services/FdsWebService?wsdl. WSDL:
http://www.fortedata.com:8080/axis2/services/FdsWebService?wsdl. java.io.IOException: ERROR: Missing element inFault "SQLException" in operation "SQLException", in binding GetRates It is recommended that you use a web browser to retrieve and examine the requested WSDL document to ensure it is correct. If the requested WSDL document cannot be retrieved or is dynamically generated, it is likely that the target web service has programming errors. "
and in the administrator
""Error creating web service. Please ensure that you have entered a correct Web Service name or URL.""
The url is
http://www.fortedata.com:8080/axis2/services/FdsWebService?wsdl
page loads fine in a browser...
I do see an issue being brought up here in the wsdl, but I have no idea why...this isnt my wsdl btw..
<wsdl:operation name="GetRates">
<wsdl:input message="ns:GetRatesRequest" wsaw:Action="urn:GetRates"/>
<wsdl:output message="ns:GetRatesResponse" wsaw:Action="urn:GetRatesResponse"/>
<wsdl:fault message="ns:SQLException" name="SQLException" wsaw:Action="urn:GetRatesSQLException"/>
</wsdl:operation>
line 3
any ideas?
Thanks for any help...Sorry didnt post everything for the sake of space
I just ended up using .NET to deal with the service..CF just didnt even recognize the url as a valid web service let alone care if I was passing arguments to it.
On a side note, CF admin doesnt recognize the url as a web service and dreamweaver doesnt recognize the url as a web service either.
<cfinvoke method="PostLead" returnvariable="returndata" webservice="http://www.fortedata.com:8080/axis2/services/FdsWebService?wsdl" refreshwsdl="yes">
<cfinvokeargument name="SpecVersion" value="0">
<cfinvokeargument name="ForteId" value="TESTID">
<cfinvokeargument name="AuthKey" value="guestauthenticationkey">
<cfinvokeargument name="LastName" value="0">
<cfinvokeargument name="FirstName" value="0">
<cfinvokeargument name="Address" value="0">
<cfinvokeargument name="city" value="0">
<cfinvokeargument name="state" value="0">
<cfinvokeargument name="zip" value="0">
<cfinvokeargument name="year" value="0">
<cfinvokeargument name="vin" value="0">
<cfinvokeargument name="make" value="0">
<cfinvokeargument name="model" value="0">
<cfinvokeargument name="phone" value="0">
<cfinvokeargument name="crdate" value="0">
<cfinvokeargument name="listcode" value="0">
<cfinvokeargument name="odometer" value="0">
<cfinvokeargument name="dually" value="0">
<cfinvokeargument name="commercial" value="0">
<cfinvokeargument name="convvan" value="0">
<cfinvokeargument name="coverage" value="0">
<cfinvokeargument name="term" value="0">
<cfinvokeargument name="deduct" value="0">
<cfinvokeargument name="av" value="0">
<cfinvokeargument name="gps" value="0">
<cfinvokeargument name="wt" value="0">
<cfinvokeargument name="sg" value="0">
<cfinvokeargument name="emis" value="0">
<cfinvokeargument name="fintype" value="0">
<cfinvokeargument name="finterm" value="0">
<cfinvokeargument name="downpay" value="0">
<cfinvokeargument name="cuscost" value="0">
<cfinvokeargument name="paymeth" value="0">
<cfinvokeargument name="cc" value="0">
<cfinvokeargument name="expdt" value="0">
<cfinvokeargument name="ccid" value="0">
<cfinvokeargument name="routing" value="0">
<cfinvokeargument name="banacct" value="0">
<cfinvokeargument name="checking" value="0">
<cfinvokeargument name="fbdt" value="0">
<cfinvokeargument name="promo" value="0">
<cfinvokeargument name="timeofday" value="0">
<cfinvokeargument name="prefmeth" value="0">
<cfinvokeargument name="email" value="0">
</cfinvoke> -
Consuming Web Services in 11.2 does not work (UTL_DBWS)
Hello
i read some documents for consuming web services on the internet , but i get an error when i call add_numbers function as follows:
i connected on WSUSER , then
SQL> select add_numbers(1,3) from dual;
The Error message is:
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.IllegalAccessException: java.lang.ExceptionInInitializerError
ORA-06512: at "WSUSER.UTL_DBWS", line 193
ORA-06512: at "WSUSER.UTL_DBWS", line 190
ORA-06512: at "WSUSER.ADD_NUMBERS", line 25"
I use the following steps to setup the UTL_DBWS :
1- Create new user 'WSUSER'
2- Run the UTL_DBWS scripts ( utl_dbws_decl.sql , utl_dbws_body.sql) on WSUSER.
3- Execute this command
loadjava -u scott/tiger -r -v -f -genmissing dbwsclientws.jar dbwsclientdb11.jar
4- Log in as sys and grant these privileges to our new user:
execute dbms_java.grant_permission('WSUSER','SYS:java.util.PropertyPermission','http.proxySet','write');
execute dbms_java.grant_permission('WSUSER','SYS:java.util.PropertyPermission','http.proxyHost', 'write');
execute dbms_java.grant_permission('WSUSER','SYS:java.util.PropertyPermission','http.proxyPort', 'write');
execute dbms_java.grant_permission('WSUSER','SYS:java.lang.RuntimePermission', 'accessClassInPackage.sun.util.calendar','');
execute dbms_java.grant_permission('WSUSER','SYS:java.lang.RuntimePermission','getClassLoader','');
execute dbms_java.grant_permission('WSUSER','SYS:java.net.SocketPermission','*','connect,resolve');
execute dbms_java.grant_permission('WSUSER','SYS:java.util.PropertyPermission','*','read,write');
execute dbms_java.grant_permission('WSUSER','SYS:java.lang.RuntimePermission','setFactory','');
execute dbms_java.grant_permission('WSUSER','SYS:java.lang.RuntimePermission', 'createClassLoader', '' )
5- Create add_numbers function on wsuser to test utl_dbws:
CREATE OR REPLACE FUNCTION add_numbers (p_int_1 IN NUMBER,
p_int_2 IN NUMBER)
RETURN NUMBER
AS
l_service UTL_DBWS.service;
l_call UTL_DBWS.call;
l_wsdl_url VARCHAR2(32767);
l_namespace VARCHAR2(32767);
l_service_qname UTL_DBWS.qname;
l_port_qname UTL_DBWS.qname;
l_operation_qname UTL_DBWS.qname;
l_xmltype_in SYS.XMLTYPE;
l_xmltype_out SYS.XMLTYPE;
l_return NUMBER;
BEGIN
l_wsdl_url := 'http://www.oracle-base.com/webservices/server.php?wsdl';
l_namespace := 'http://www.oracle-base.com/webservices/';
l_service_qname := UTL_DBWS.to_qname(l_namespace, 'Calculator');
l_port_qname := UTL_DBWS.to_qname(l_namespace, 'CalculatorPort');
l_operation_qname := UTL_DBWS.to_qname(l_namespace, 'ws_add');
l_service := UTL_DBWS.create_service (
wsdl_document_location => URIFACTORY.getURI(l_wsdl_url),
service_name => l_service_qname);
l_call := UTL_DBWS.create_call (
service_handle => l_service,
port_name => l_port_qname,
operation_name => l_operation_qname);
l_xmltype_in := SYS.XMLTYPE('<?xml version="1.0" encoding="utf-8"?>
<ws_add xmlns="' || l_namespace || '">
<int1>' || p_int_1 || '</int1>
<int2>' || p_int_2 || '</int2>
</ws_add>');
l_xmltype_out := UTL_DBWS.invoke(call_Handle => l_call,
request => l_xmltype_in);
UTL_DBWS.release_call (call_handle => l_call);
UTL_DBWS.release_service (service_handle => l_service);
l_return := l_xmltype_out.extract('//return/text()').getNumberVal();
RETURN l_return;
END;
6- Test the function
Select add_numbers(1,2) from dual
on the test i get the error message :
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.IllegalAccessException: java.lang.ExceptionInInitializerError
ORA-06512: at "WSUSER.UTL_DBWS", line 193
ORA-06512: at "WSUSER.UTL_DBWS", line 190
ORA-06512: at "WSUSER.ADD_NUMBERS", line 25
anyone have an idea to resolve this error .
thanks alotHi.
Looking at the code, it seems it is my article you are asking about.
http://www.oracle-base.com/articles/10g/utl_dbws10g.php
I've just run through it on an 11.2 instance and it works fine for me.
Make sure your server has access to the Internet and make sure the java classes are loaded successfully.
Cheers
Tim... -
Consuming Web Services in 11.2 does not work ??
Hello,
Did anyone manage to call a Web Service from Oracle 11.2 database?
We wanted to call a web service from Oracle, so for example if I execute:
SELECT add_numbers(1, 5) FROM dual;
from my database, I get the result 6.
Cool thing is that the add_numbers function is not in my database, but in a database somewhere in the cloud, and I access the function as a web service.
Oracle provides step-by-step documentation how to do it, but we couldn't make it working by following the docs. It was done on a clean Oracle 11.2 database install.
We followed the instructions from: http://www.oracle.com/technology/sample_code/tech/java/jsp/callout_users_guide.htm
The main part of the job is to:
1) Load the java classes into the Oracle database by issuing the following command: % loadjava -u sys\<password> -r -v -f -genmissing dbwsclientws.jar dbwsclientdb11.jar
2) Install the UTL_DBWS package into the database (it is not installed by default in 11g):
SQL> @?/sqlj/lib/utl_dbws_decl.sql
SQL> @?/sqlj/lib/utl_dbws_body.sql
We loaded the classes into the SYS user and installed the UTL_DBWS package into the SYS user as well.
3) Create a function that uses UTL_DBWS package to call a web service: http://www.oracle-base.com/articles/10g/utl_dbws10g.php
However, when we tried to run the add_numbers function, it returned an error from the UTL_DBWS package, from the create_service function (line 190), the function returned that the java class that it calls does not exist:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.IllegalAccessException: java.lang.NoClassDefFoundError
ORA-06512: at "SYS.UTL_DBWS", line 193
ORA-06512: at "SYS.UTL_DBWS", line 190
ORA-06512: at "SYS.ADD_NUMBERS", line 25
Line 193 in UTL_DBWS package goes like this:
function create_service_proxy(wsdl_Document_Location VARCHAR2, service_Name VARCHAR2) return SERVICE
as language java
name 'oracle.jpub.runtime.dbws.DbwsProxy.createService(java.lang.String,java.lang.String) return long';
However, this makes no sense because the class is loaded:
select dbms_java.longname(object_name), status, object_type from all_objects where
object_name like '%DbwsProxy%'
and object_type = 'JAVA CLASS'
Output:
oracle/jpub/runtime/dbws/DbwsProxy$1;VALID;JAVA CLASS
oracle/jpub/runtime/dbws/DbwsProxy$CallProxy;VALID;JAVA CLASS
oracle/jpub/runtime/dbws/DbwsProxy$ServiceProxy;VALID;JAVA CLASS
oracle/jpub/runtime/dbws/DbwsProxy;VALID;JAVA CLASS
Anyone knows the cause of the exception?
Edited by: user8938058 on Feb 1, 2011 2:08 AMI had the same problem. For me below code works:
CREATE OR REPLACE FUNCTION SYS.add_numbers (p_int_1 IN NUMBER,
p_int_2 IN NUMBER)
RETURN NUMBER
AS
l_service UTL_DBWS.service;
l_call UTL_DBWS.call;
l_wsdl_url VARCHAR2(32767);
l_namespace VARCHAR2(32767);
l_service_qname UTL_DBWS.qname;
l_port_qname UTL_DBWS.qname;
l_operation_qname UTL_DBWS.qname;
l_xmltype_in SYS.XMLTYPE;
l_xmltype_out SYS.XMLTYPE;
l_return NUMBER;
BEGIN
l_wsdl_url := 'http://www.oracle-base.com/webservices/server.php?wsdl';
l_namespace := 'http://www.oracle-base.com/webservices/';
l_service_qname := UTL_DBWS.to_qname(l_namespace, 'Calculator');
l_port_qname := UTL_DBWS.to_qname(l_namespace, 'CalculatorPort');
l_operation_qname := UTL_DBWS.to_qname(l_namespace, 'ws_add');
l_service := UTL_DBWS.create_service (
service_name => l_service_qname);
l_call := UTL_DBWS.create_call (
service_handle => l_service);
utl_dbws.set_target_endpoint_address(l_call, 'http://www.oracle-base.com/webservices/server.php');
utl_dbws.set_property( l_call, 'OPERATION_STYLE', 'rpc');
l_xmltype_in := SYS.XMLTYPE('<?xml version="1.0" encoding="utf-8"?>
<ws_add xmlns="' || l_namespace || '">
<int1>' || p_int_1 || '</int1>
<int2>' || p_int_2 || '</int2>
</ws_add>');
l_xmltype_out := UTL_DBWS.invoke(call_Handle => l_call,
request => l_xmltype_in);
UTL_DBWS.release_call (call_handle => l_call);
UTL_DBWS.release_service (service_handle => l_service);
l_return := l_xmltype_out.extract('//return/text()').getNumberVal();
RETURN l_return;
END;
It seems that the problem is with class oracle.jpub.runtime.dbws.DbwsProxy.createService(java.lang.String,java.lang.String) return long
I rewrite your example that it uses oracle.jpub.runtime.dbws.DbwsProxy.createService(java.lang.String) return long
In the database log I get this stacktrace:
*** 2011-06-03 11:22:37.390
ServiceFacotory: oracle.j2ee.ws.client.ServiceFactoryImpl@3b689a27
WSDL: http://www.oracle-base.com/webservices/server.php?wsdl
ERROR: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.readDocument(WSDLReaderImpl.java:309)
at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:275)
at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:462)
at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:440)
at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:161)
at oracle.j2ee.ws.common.processor.config.ModelInfo.buildModel(ModelInfo.java:167)
at oracle.j2ee.ws.client.dii.ServiceInfoBuilder.getModel(ServiceInfoBuilder.java:196)
at oracle.j2ee.ws.client.dii.ServiceInfoBuilder.getModel(ServiceInfoBuilder.java:181)
at oracle.j2ee.ws.client.dii.ServiceInfoBuilder.buildServiceInfo(ServiceInfoBuilder.java:114)
at oracle.j2ee.ws.client.dii.ConfiguredService.<init>(ConfiguredService.java:54)
at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:43)
at oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy.<init>(Unknown Source)
at oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy.<init>(Unknown Source)
at oracle.jpub.runtime.dbws.DbwsProxy.createService(Unknown Source)
Caused by: java.util.MissingResourceException: Can't find oracle.j2ee.ws.wsdl.ORAWSDLMessageBundle bundle
at java.util.logging.Logger.setupResourceInfo(Logger.java:1285)
at java.util.logging.Logger.<init>(Logger.java:203)
at java.util.logging.Logger.getLogger(Logger.java:271)
at oracle.j2ee.ws.wsdl.ORAWSDLMessages.<clinit>(ORAWSDLMessages.java:14)
... 14 more
java.lang.IllegalAccessException: java.lang.ExceptionInInitializerError
at oracle.jpub.runtime.dbws.DbwsProxy.createService(Unknown Source)
ServiceFacotory: oracle.j2ee.ws.client.ServiceFactoryImpl@3b689a27
WSDL: http://www.oracle-base.com/webservices/server.php?wsdl
ERROR: java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError
at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.readDocument(WSDLReaderImpl.java:309)
at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:275)
at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:462)
at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:440)
at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:161)
at oracle.j2ee.ws.common.processor.config.ModelInfo.buildModel(ModelInfo.java:167)
at oracle.j2ee.ws.client.dii.ServiceInfoBuilder.getModel(ServiceInfoBuilder.java:196)
at oracle.j2ee.ws.client.dii.ServiceInfoBuilder.getModel(ServiceInfoBuilder.java:181)
at oracle.j2ee.ws.client.dii.ServiceInfoBuilder.buildServiceInfo(ServiceInfoBuilder.java:114)
at oracle.j2ee.ws.client.dii.ConfiguredService.<init>(ConfiguredService.java:54)
at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:43)
at oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy.<init>(Unknown Source)
at oracle.jpub.runtime.dbws.DbwsProxy$ServiceProxy.<init>(Unknown Source)
at oracle.jpub.runtime.dbws.DbwsProxy.createService(Unknown Source)
java.lang.IllegalAccessException: java.lang.NoClassDefFoundError
at oracle.jpub.runtime.dbws.DbwsProxy.createService(Unknown Source)
Maybe somebody explain why if I use function create_service(wsdl_Document_Location URITYPE, service_Name QNAME)
RETURN SERVICE it throws ORA-29532: Java call terminated by uncaught Java exception: java.lang.IllegalAccessException: java.lang.NoClassDefFoundError
and when I use function create_service(service_Name QNAME) RETURN SERVICE it works ?
Please help
Edited by: user10200937 on 2011-06-03 03:14 -
Hi All,
I am trying to consume a web service in XI.I downloaded the Temperature to Fahrenheit converter web service.
My scenario is like is will take temperature from File1 and pass it on to BPM,BPM calls the webservice through business service using SOAP request and then the response is send back to File2.
Message interfaces are Inbound,outbound,sync-abstract,sync-inbound,4 Async_Abstract and 1 business service and 2 technical systems.
When i test it,the flow gets stuck on the synchronous sender to the business service.
Regards,
Satpreet Singh
Edited by: Satpreet Singh Ratra on Jul 22, 2008 12:28 PMDanny,
I have checked in sxmb_moni_bpe. The failure is at the "Synchronous sender" to Web service. And the error message is
Work item 000000002076: Object CL_SWF_XI_MSG_BROKER method SEND_SYNCHRON cannot be executed.
No clues
And also when I check message monitoring, the error occurs during SOAP call. Call fails with error:
java.lang.IllegalArgumentException: can't parse argument number http://schemas.xmlsoap.org/wsdl/
at java.text.MessageFormat.makeFormat(MessageFormat.java:1323)
at java.text.MessageFormat.applyPattern(MessageFormat.java:447)
at java.text.MessageFormat.(MessageFormat.java:347)
at java.text.MessageFormat.format(MessageFormat.java:800)
at jsp_auditlog1201346243234._jspService(jsp_auditlog1201346243234.java:297)
at com.sap.engine.services.servlets_jsp.server.jsp.JspBase.service(JspBase.java:112)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:544)
at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:186)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Regards,
Satpreet -
Hi All,
I am looking for some advice in regards to consuming web services via UCCX scripting. In the past i have been doing so successfully in our environment by using document steps and Xpath expressions for both SOAP and REST web services that were configured to allow an HTTP GET request (tomcat running on apache server to expose public methods written in Java).
Our company is in the midst of a Microsoft Dynamics 2012 (r2) implementation and I have the task of establishing communication with AX in order to pass information back and forth. Our consultants with dynamics have setup a test web service using AIF, but it seems that these services require authentication. Currently the test web service is using NTLM authentication and exposed via SOAP. Apparently it is not possible to use HTTP GET for these web services.
This means i had to write java code in Set steps to communicate with the SOAP services. I was able to successfully do this for some of our own web services using SOAP. however i am having problems with the AX test web service due to the authentication. (Thanks to Gergely Szabo, as i used some of his code found here: https://supportforums.cisco.com/document/97736/uccx-8x-really-simple-soap-client-no-custom-jar )
I am hoping someone has some experience with having consumed AIF web services via Java or at least Java written within a UCCX script. Or if someone has been able to implement authentication and can provide some details for how that works? I don't even know if i can authenticate via NTLM from UCCX scripts due to it being a windows authentication protocol and not linux based.
Any thoughts or ideas would be appreciated!
Thanks,
Kevin.Hi,
Thus far I have been unsuccessful in my attempts to communicate with this particular web service. The consults did create another service using Basic HTTP Auth and I was able to consume and use the service using SOAPUI just fine.
However, my soapResponseString code (small tweak of Gergely's code) is not working. After 2-3 minutes of sitting on that step in the CRS Editor my stacktrace exception is thrown and shows "Connection timed out". This is way past the time for the 5000ms read timeout, so I imagine the initial communication is successful but then eventually times out due to not returning a response?
I tried to mimic the headers SOAPUI uses from it's HTTP Log, hence the number of urlCon.setRequestProperty lines..
CODE for Set soapResponseString below:
// create a ByteArrayOutputStream - this is actually a buffer
// we are going to use to store the response coming from the SOAP server
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
// this is quite unnecessary: assigning the value of the soapRequest (still holding our XML document)
// to another variable, named content, type String; but anyway, it's just cleaner
String content = soapRequest;
// specify a timeout - 5000 milliseconds - if the web server does not start sending back
// anything within this timeframe, an exception will be raised
int readTimeout = 5000;
try {
// a new URL, which is the soapServiceEndpoint variable value (http://ip:port/ etc):
java.net.URL url = new java.net.URL(soapServiceEndpoint);
// creating a HTTP connection to the above URL:
java.net.HttpURLConnection urlCon = (java.net.HttpURLConnection) url.openConnection();
// setting some important header parameters, first of all, content length, this is most likely expected
// by the SOAP server
urlCon.setFixedLengthStreamingMode(content.length());
// setting the timeout:
urlCon.setReadTimeout(readTimeout);
// we tell Java we will do input (in other words, we will read):
urlCon.setDoInput (true);
// we tell Java we will do output (in other words, we will send):
urlCon.setDoOutput (true);
// we tell Java not to cache:
urlCon.setUseCaches (false);
// we are using HTTP POST
urlCon.setRequestMethod("POST");
// finally, we set the Content-Type header,
// this way we are telling the SOAP server we are sending an XML, using the UTF-8 charset
urlCon.setRequestProperty("Content-Type","text/xml;charset=UTF-8");
// here we are sending our Basic Auth - authStringEnc is a base64 encoded user:pass credential that's initialized in a previous step
urlCon.setRequestProperty("Authorization","Basic " + authStringEnc);
//set some other header information for the request required by the AIF Web Service
urlCon.setRequestProperty("SOAPAction","http://tempuri.org/myService/getSiteId");
urlCon.setRequestProperty("Host", "myServer.myDomain.com:8080");
urlCon.setRequestProperty("Connection","Keep-Alive");
urlCon.setRequestProperty("User-Agent","Java/1.6.0_29");
urlCon.setRequestProperty("Accept-Encoding","gzip,deflate");
// opening an OutputStream (this is a one-way channel towards the SOAP server:
java.io.DataOutputStream output = new java.io.DataOutputStream(urlCon.getOutputStream());
// we write the contents of the content variable (= soapRequest = XML document):
output.writeBytes(content);
// telling Java to flush "speed up!" and then close the stream:
output.flush();
output.close();
// now getting the InputStream (getting a one way channel coming from the SOAP server):
java.io.DataInputStream input = new java.io.DataInputStream(urlCon.getInputStream());
// buffered read from the InputStream, buffer size 4Kilobytes (= 4096 bytes):
// and the buffer is always written to the other buffer, named baos, that we specified
// on the first line of this block of code
int bufSize = 4096; // buffer size, bytes
byte[] bytesRead = new byte[bufSize];
int bytesReadLength = 0;
while(( bytesReadLength = input.read( bytesRead )) > 0 ) {
baos.write(bytesRead,0,bytesReadLength);
} //while block ends here
// closing the InputStream:
input.close();
// closing the baos buffer
baos.close();
} catch (Exception e) {
// again, if an error occurs, let's just send the stack trace to stdout (stdout.log)
// and then return null or can we can return e.getMessage() to see the exception caught inside the script
e.printStackTrace();
return e.getMessage();
//return null;
} // try..catch block ends here
// construct a new String, and return that to the CRS script:
return new String(baos.toByteArray());
} // closure ends here -
Consume Web Service in EJB Application
Hi Experts,
I have EJB Application with some Java Classes.My Requirement is to Consume Web Service in EJB Application.
I am new to EJB Application.Please share if have any ideas regarding the same.
Thanks & Regards,
SatheshKumar RHi Vijay,
Thanks for the Reply.
Please provide the JAR Files i need to add.
I had tried to consume the web service by using the java class in Java Project ie EJB.
After creating the Project i will import the WSDL file in that Project and create the Client Application.
The Request and Response java class is created by importing the WSDL file.
The Client Java Class is created to access the Request and Response objects.
After this Main class is created and I have run the application to execute the Client Java Class. During this time its shows some error.
The Error Message are:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sap/engine/interfaces/sca/logtrace/CallEntry$TraceLevel
at com.sap.engine.services.webservices.espbase.client.bindings.ConfigurationUtil.getTransportBinding(ConfigurationUtil.java:249)
at com.sap.engine.services.webservices.espbase.client.bindings.ConfigurationUtil.createClientConfiguration(ConfigurationUtil.java:109)
at com.sap.engine.services.webservices.espbase.client.jaxws.metadata.InterfaceMetadata.createClientConfigurationContext(InterfaceMetadata.java:178)
at com.sap.engine.services.webservices.espbase.client.jaxws.metadata.InterfaceMetadata.getProxy(InterfaceMetadata.java:70)
at com.sap.engine.services.webservices.espbase.client.jaxws.core.SAPServiceDelegate.getPort(SAPServiceDelegate.java:258)
at javax.xml.ws.Service.getPort(Service.java:92)
at com.sap.tutorial.testwebser1ejb.TestAddService.getTestAddPort(TestAddService.java:38)
at com.sap.tutorial.testwebser1ejb.TestAddClient.testAdd(TestAddClient.java:12)
at com.sap.tutorial.testwebser1ejb.MainClass.main(MainClass.java:12)
Caused by: java.lang.ClassNotFoundException: com.sap.engine.interfaces.sca.logtrace.CallEntry$TraceLevel
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
... 9 more
Thanks & Regards,
SatheshKumar R
Maybe you are looking for
-
Macbook Santa Rosa Keyboard Swap
Hello i have on of the first macbooks that was put out a couple of years ago and i was wondering if i were to switch the keyboard for the new santa rosa would the keys be the same as my old keyboard meaning would i still have to press F5 in order to
-
How to check if internal table exists in dynamical called subroutine ?
Hi, in a dynamically called subroutine i'm using a internal table, but in some calls this table is not exist. How can i check in the code whether the internal table exist or not ? regards, Hans
-
I am in the process of Migration all servers from our Content switch to CIsco ACE4710. one content has this line item advanced-balance sticky-srcip What would be similar option in ACE.? Thanks for any help on this. Mehdi
-
Searching/Restoring Mail on Time Machine
Hello. I am considering a Time Capsule and Time Machine on top of my existing Crashplan subscription. I am particularly interested in a good backup plan for backing up Mac Mail and my iCloud account, since iCloud deletes e-mails put into trash afte
-
Combine multiple photos in one
Wife is going to prepare the school year book, how do I combine a few photos in one page? I can't seem to find anything in iphoto, any freebie out there? I am looking for something easy to use, she is a dummy. Thanks! Alex