473,388 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Async Web Service - Oracle 10g JDeveloper

3
Hi All,

I have a JSR 168 portlet that I need to call a J2EE 1.4 JAX-RPC Web Service. I'm using Oracle 10g JDeveloper. (I don't have a choice about this). It works when I call the sync method, but it won't recognizine the async method.

I'm thinking I have to use the async method of the WS because the WS takes a while to do it's thing and return. If it doesn't take a while, everything works fine. If it does take a while, my portlet becomes unavailable.

To create my WS, I wrote a java class, and used JDeveloper's "Create J2EE Web Service" wizard to create a J2EE 1.4 JAX-RPC WS. All my WS does is use a system call to execute a bash script. If the bash script just touches a file and returns, everything works great. If the bash script touches a file and then sleeps for a while, my portlet becomes unavailable.

DatabaseServiceBkupAll.java
Expand|Select|Wrap|Line Numbers
  1. public int bkupAllDB() { 
  2. int exitVal = -1;
  3. try {
  4. Runtime rt = Runtime.getRuntime();
  5. Process p = rt.exec("/auto/touchBash1.sh");
  6. p.waitFor();
  7. exitVal = p.exitValue(); 
  8. } catch (Exception e) {
  9. System.out.println(e);
  10. return exitVal;
  11. }
  12. Currently, my call to the WS is the following and it works just fine. I used the JDeveloper Web Service Proxy wizard to do it. 
  13.  
  14. DatabasePortlet.java
  15. DatabaseServiceBkupAllSoapHttpPortClient myPort = null;
  16. try {
  17. myPort = new DatabaseServiceBkupAllSoapHttpPortClient();
  18. System.err.println("Calling " + myPort.getEndpoint());
  19. } catch (Exception ex) {
  20. ex.printStackTrace(); 
  21. }
  22.  
  23. try {
  24. myPort.setEndpoint("http://localhost:6688/DatabaseServiceBkupAll-DatabaseServiceBkupAll-context- 
  25. root/DatabaseServiceBkupAllSoapHttpPort");
  26. exitVal = myPort.bkupAllDB();
  27. } catch (Exception e) {
  28. e.printStackTrace();
  29. }
  30.  
When I go to http://localhost:6688/DatabaseServic...pPortstub.html, under the Method Summary, it has
Expand|Select|Wrap|Line Numbers
  1. DatabaseServiceBkupAllSoapHttpPort_bkupAllDB
  2. int DatabaseServiceBkupAllSoapHttpPort_bkupAllDB ();
  3. DatabaseServiceBkupAllSoapHttpPort_bkupAllDBAsync
  4. void DatabaseServiceBkupAllSoapHttpPort_bkupAllDBAsync (function callback(int));
  5.  
To me that means the async version is out there and that I should be able to change "exitVal = myPort.bkupAllDB()" to "myPort.bkupAllDBAsync(something)" and everything should work. That's not the case. It doesn't recognize bkupAllDBAsync. Even if my "something" parameter isn't correct, I would at least think it would give me a different error.

Also, my other thought is maybe I needed to create the WS differently. For 11g JDeveloper, when you use the "Create J2EE Web Service" wizard, there's a step that asks you if you want to create it asynchronously, but that's not the case for 10g.

Maybe there's another solution, besides calling the WS asychronously, to make my portlet still be available while it waits for the WS to return. I was thinking threads, but if it's a timeout problem, I don't think threads would help, would it?

Any guidance would be greatly appreciated. This is my first project involving portlets and web service.
Dec 5 '08 #1
4 5618
Dököll
2,364 Expert 2GB
Hey there partner!

Sorry I could not help you too much with this one... But I did find you a link to an Oracle Tutorial, give it a look:

Calling an Asynchronous Web Service

Not too much info in my results, perhaps someone passing thorugh has an idea...

Sorry for your troubles:-)
Dec 8 '08 #2
dlc9s
3
Thank you for the tutorial. I did read it, but it uses BPEL which I cannot use (project restraint).
Dec 9 '08 #3
dlc9s
3
I got it to work using a thread. I'm not sure why my thread doesn't die, but it doesn't.

In DatabasePortlet.java:
private ThreadBean myThreadBean;
myThreadBean = new ThreadBean();
new Thread( myThreadBean ).start();

In ThreadBean.java:
public void run() {
try {
setStillAlive(1);
setExitVal(1);
runScript();
setStillAlive(0);
} finally {
}
}

private void runScript() {
DatabaseServiceBkupSoapHttpPortClient myPort = null;
try {
myPort = new DatabaseServiceBkupSoapHttpPortClient();
System.err.println("Calling " + myPort.getEndpoint());
} catch (Exception ex) {
ex.printStackTrace();
}
try {
myPort.setEndpoint("http://localhost:6688/DatabaseServiceBkup-
DatabaseServiceBkup-context-root/DatabaseServiceBkupSoapHttpPort");
int temp = myPort.bkupAllDB();
setExitVal(temp);
} catch (Exception e) {
e.printStackTrace();
}
}

In working.jsp:
<meta http-equiv="Refresh" content="3">
<!--Web Service is Done-->
<% if ( threadbean.getStillAlive() == 0 ) { %>
<p>Process is Complete.<br><br>
Press the button to continue.</p>
<!--Web Service is Busy-->
<% } else { %>
<p>Working...</p>
<p><font color="#ff0000">Do not interrupt the process.</font></p>
<p>When the Continue button appears, the process is complete.</p>
<% } %>
Dec 21 '08 #4
Dököll
2,364 Expert 2GB
Dino-mite, dlc9s!

Good job getting it to work, and posting your finding...

Happy coding:-)

Dököll
Dec 21 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: John | last post by:
Hi, Has oracle published the DTD for the XML version of their Forms files? I can't find it in the documentation or online. thanks, John.
0
by: Bryan Jackson | last post by:
Greetings, (I am an Oracle newbie -- been working with SQLServer for quite some time, however. I'm using Oracle9i and Oracle9i JDeveloper v9.0.3.1 (build 1107) for my programming environment)....
0
by: aychai | last post by:
Hi all, I am trying to make use Oracle9i db to call an external .Net Web Service from a JAva Stored Procedure. I created the .Net Web Service and use JDeveloper 9.0.3.4Build(1247) to create...
0
by: shay | last post by:
Oracle is proud to announce the immediate availability of Oracle JDeveloper 10g. This new version is focused on making J2EE development simpler by providing a visual and declarative development...
4
by: gengyue | last post by:
Hi, I need to call .Net webservice from my JSP page. My application is Struts application. It is deployed on Oracle application server. Here is the whole process. I have a login form. When user...
4
by: gengyue | last post by:
Hi, I need to call .Net webservice from my JSP page. My application is Struts application. It is deployed on Oracle application server. Here is the whole process. I have a login form. When user...
0
by: gengyue | last post by:
Hi, Refer to my previous post "Calling web serive from JSP", I found an article on msfn2.microsoft.com. "Using the WebService behavior, it is not possible to call a remote method directly on a...
18
by: SteveHasel | last post by:
I'm trying to consume a web service that was generated by Oracle JDeveloper for a ASP.NET site in Visual Studio 2005. I used the Add Web Reference interface and everything seemed to work fine, but...
0
by: The Doctor | last post by:
Hi everyone, I wondered if anyone has have experiences with using JDeveloper with Oracle 7.3.4. (Yeah, I know you are probably wondering why we are stilling 7.3.4....) I have written a simple...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.