Showing posts with label jpub. Show all posts
Showing posts with label jpub. Show all posts

ORA-29532: HTTP transport error: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message send fail

Posted by Steve Racanovic | Posted in , | Posted on 1:57 PM

1

After running jpub using the 'get joke' web service and then calling the web service in sqlplus, I get the following error:


[sracanov@sracanov-au D]$ jpub -user=scott/tiger -sysuser=sys/welcome1
-proxywsdl=getjoke.asmx.xml
-endpoint=http://interpressfact.net/webservices/getjoke.asmx
tmp\src\genproxy\GetJokeSoapClientJPub.java
plsql_wrapper.sql
plsql_dropper.sql
plsql_grant.sql
plsql_revoke.sql
Executing plsql_dropper.sql
Executing plsql_wrapper.sql
Executing plsql_grant.sql
Loading plsql_proxy.jar

[sracanov@sracanov-au D]$ sqlplus scott/tiger
Logging into sqlplus - scott @orcl

SQL*Plus: Release 10.2.0.3.0 - Production on Wed Feb 25 14:06:32 2009

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

scott@orcl> select jpub_plsql_wrapper.getjoke('') from dual;
select jpub_plsql_wrapper.getjoke('') from dual
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.rmi.RemoteException: java.rmi.RemoteException:; nested exception is:
HTTP transport error: javax.xml.soap.SOAPException:
java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Message
send failed: Connection refused

This error is occurring due to the proxy. So I need to execute setHttpProxy(host VARCHAR2, port NUMBER) to avoid this.

scott@orcl> call jpub_plsql_wrapper.setHttpProxy('www-proxy',8080);

Call completed.

scott@orcl> select jpub_plsql_wrapper.getjoke('') from dual;

JPUB_PLSQL_WRAPPER.GETJOKE('')
--------------------------------------------------------------------------------
Murphy's Military Laws:15.
Don't be conspicuous. In the combat zone, it draws fire. Out of the combat zone,
it draws sergeants.

To completely avoid this error, set jpub to call the WSDL directly rather than a local file and set the http proxy for jpub.

[sracanov@sracanov-au D]$ jpub -user=scott/tiger -sysuser=sys/welcome1
-proxywsdl=http://interpressfact.net/webservices/getjoke.asmx?WSDL
-endpoint=http://interpressfact.net/webservices/getjoke.asmx
-httpproxy=www-proxy:8080
tmp\src\genproxy\GetJokeSoapClientJPub.java
plsql_wrapper.sql
plsql_dropper.sql
plsql_grant.sql
plsql_revoke.sql
Executing plsql_dropper.sql
Executing plsql_wrapper.sql
Executing plsql_grant.sql
Loading plsql_proxy.jar

[sracanov@sracanov-au D]$ sqlplus scott/tiger
Logging into sqlplus - scott @orcl

SQL*Plus: Release 10.2.0.3.0 - Production on Wed Feb 25 14:02:50 2009

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

scott@orcl> select jpub_plsql_wrapper.getjoke('') from dual;

JPUB_PLSQL_WRAPPER.GETJOKE('')
--------------------------------------------------------------------------------
Q: How many `Real Men' does it take to change a light bulb?
A: None: `Real Men' aren't afraid of the dark.

Using jpub to create webserivce proxy for callouts.

Posted by Steve Racanovic | Posted in , | Posted on 11:58 AM

2

Im my preivous blog I created a simple webservice and used plsql to call the webservice from the database. Here I will use jpub to generate my java proxy and use that to call my webservice without the need to code any plsql. Note all of these steps are done upon the previous blog beginning completed.

1. Download and unzip jpub. You can get it from http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.html
Im using JPublisher 10g Release 10.2


C:\Documents and Settings\stever\Desktop> set_database.bat
C:\Documents and Settings\stever\Desktop> oracle_home
D:\Oracle\product\10.2.0\db_1
C:\Documents and Settings\stever\Desktop> unzip jpub_102.zip -d %oracle_home%
Archive: jpub_102.zip
inflating: D:/Oracle/product/10.2.0/db_1/sqlj/lib/sqljutl.sql
inflating: D:/Oracle/product/10.2.0/db_1/sqlj/lib/translator.jar
...


2. Set the classpath and run jpub.


C:\Documents and Settings\stever\Desktop>cdo

D:\Oracle\product\10.2.0\db_1

D:\Oracle\product\10.2.0\db_1>cd sqlj\bin

D:\Oracle\product\10.2.0\db_1\sqlj\bin>ll
Volume in drive D is ACERDATA
Volume Serial Number is 4059-B823

Directory of D:\Oracle\product\10.2.0\db_1\sqlj\bin

07/21/2005 03:34 AM <DIR> .
07/21/2005 03:34 AM <DIR> ..
07/21/2005 03:34 AM 1,376 jpub
07/21/2005 03:34 AM 2,834 jpub.c
07/21/2005 03:34 AM 50,619 jpub.exe
07/21/2005 03:34 AM 267 README.txt
4 File(s) 55,096 bytes
2 Dir(s) 8,243,344,384 bytes free

D:\Oracle\product\10.2.0\db_1\sqlj\bin> cd ..
D:\Oracle\product\10.2.0\db_1\sqlj>java_home
D:\Oracle\product\10.2.0\db_1\jdk

D:\Oracle\product\10.2.0\db_1\sqlj>classpath
.;D:\Oracle\product\10.2.0\db_1\sqlj\lib\translator.jar;
D:\Oracle\product\10.2.0\db_1\sqlj\lib\runtime12.jar;
D:\Oracle\product\10.2.0\db_1\sqlj\lib\dbwsa.jar;D:\Oracle\product\10.2
.0\db_1\javavm\lib\aurora.zip;
D:\Oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar;

D:\Oracle\product\10.2.0\db_1\sqlj>jpub -u wsuser/wsuser -sysuser sys/welcome1
-proxywsdl=http://stever-5670:8988/DatabaseWSDemo-WS-context-root/MyWebService1SoapHttpPort?WSDL
-endpoint=http://stever-5670:8988/DatabaseWSDemo-WS-context-root/MyWebService1SoapHttpPort
tmp\src\genproxy\MyWebService1SoapHttpPortClientJPub.java
plsql_wrapper.sql
plsql_dropper.sql
plsql_grant.sql
plsql_revoke.sql
Executing plsql_dropper.sql
Executing plsql_wrapper.sql
Executing plsql_grant.sql
Loading plsql_proxy.jar


3. Call the webservice.


D:\Oracle\product\10.2.0\db_1\sqlj>sqlplus wsuser/wsuser

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Nov 10 19:36:58 2008

Copyright (c) 1982, 2006, Oracle. All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> select jpub_plsql_wrapper.sayhelloworld from dual;

SAYHELLOWORLD
--------------------------------------------------------------------------------
Hello World

SQL> select jpub_plsql_wrapper.sayhelloname('Steve') from dual;

JPUB_PLSQL_WRAPPER.SAYHELLONAME('STEVE')
--------------------------------------------------------------------------------
Hello Steve

SQL>

NOTE: My set_database.bat file simply has my environment settings in there.
This is where I set the classpath. It looks like:

set ORACLE_HOME=D:\Oracle\product\10.2.0\db_1
set ORACLE_SID=ORCL
set JAVA_HOME=%ORACLE_HOME%\jdk
set PATH=%ORACLE_HOME%\bin;%TT_HOME%\bin;%JAVA_HOME%\bin;%ORACLE_HOME%\sqlj\bin;%PATH%
set TNS_ADMIN=D:\Oracle\product\10.2.0\db_1\NETWORK\ADMIN
set CLASSPATH=.;%ORACLE_HOME%\sqlj\lib\translator.jar;
%ORACLE_HOME%\sqlj\lib\runtime12.jar;%ORACLE_HOME%\sqlj\lib\dbwsa.jar;
%ORACLE_HOME%\javavm\lib\aurora.zip;%ORACLE_HOME%\jdbc\lib\ojdbc14.jar;