JAVA WEB SERVICE AND ORACLE DATABASE

Hi,
I working with Oracle database 10g, Oracle Bpel 10.1.2.0 and JDeveloper 10g on windows xp home.
I have created a java class with incapsulated sql statement (jdbc protocol).
All it's ok when the class runs from command line (JCreator).
After that i created the web service from java classes (with JDeveloper) and I connected (with success) database to OC4J and run the web service, i have this xml message like result:
<?xml version="1.0" encoding="UTF-8" ?>
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Body>
- <SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server.Exception:</faultcode>
<faultstring>java.lang.NullPointerException</faultstring>
<faultactor>/DipendentiWebService/DipendentiWebService</faultactor>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Which's my error?
Thanks

Hi Frank,
thank you for the reply, but i don't undertsand what do you mean "add print statement to java class".
follows the java class code that loads a mail address from database oracle:
import sqlj.runtime.*;
import sqlj.runtime.ref.*;
import java.sql.SQLException;
import java.util.*;
import java.sql.*;
import utility.*;
import java.lang.*;
import java.io.*;
public class DipendentiWS{
protected static String matricola = null;
protected static String email = null;
private static DBConnectionManager connMgr;
private static Connection conn = null;
private static Statement st = null;
private static PreparedStatement pstmt;
private static ResultSet rs = null;
private static final String FIND_BY_MATRICOLA = "SELECT Email FROM ARDIP.DIPENDENTI " +
                                                       "WHERE Matricola = ?";
// metodo ausiliario per il rilascio delle risorse
* @webmethod
     public static String leggiMail(String matricola)throws SQLException{
     // Caricamento dati Dipendente da DB
     try {
connMgr = DBConnectionManager.getInstance();
     Connection conn = connMgr.getConnection("access");
if (conn != null) {
     conn.setAutoCommit(false);
st = conn.createStatement();
pstmt = conn.prepareStatement(FIND_BY_MATRICOLA);
               pstmt.setString(1, matricola);
               rs = pstmt.executeQuery();
if (rs.next()) {
email =rs.getString(1);
conn.commit();
// conn.setAutoCommit(true);
catch(SQLException e){
     e.printStackTrace();
     System.err.println("ATTENZIONE!!!!");
          finally {
     try {st.close();}
     catch(SQLException ex){ ex.printStackTrace();}
          return email;      
     }

Similar Messages

  • How to call web services from oracle database 10g

    Hi all ,
    How can i call web services from oracle database 10g ?
    thanks ...

    abdou123 wrote:
    but how can i get complex result
    for example
    i pass input parameter like National Id Number
    and get the person details ( name , age , date of birth , ............ ) .Basic approach to web services using UTL_HTTP explained in {message:id=10448611}.
    An example of using a pipeline table function as a data transformation process (turning web data into rows and columns) in {message:id=10158148}.

  • Web Service and Oracle HTTP Server

    I have a web environment with Oracle Database 10.2.0.3 , oracle http server (using mod_plsql), Oracle pl/sql web toolkit. I need to create a web service that is accessed externally which will interact with the database (select, insert, delete). Is it possible to publish a web service to the Oracle Http Server or to implement web services with the environment above

    Hello,
    In RDBMS 10g you cannot directly expose WS from the DB you need to use the OracleAS Web Service Runtime to do it, following this documentation:
    - Developing Web Services that Expose Database Resources
    This is true if we are talking about "tooling/runtime/API" but after all Web Services are mainly XML (WSDL and SOAP) so it is still possible to create by hands (PL/SQL & static files) but it is probably a long work depending of the complexity of your services.
    Also, in RDBMS 11, you can now directly expose WS from the DB using the embedded HTTP server, see this Oracle 11g New Features Document
    Note that before taking one approach you must take time to write up your requirement regarding Web Services eg: do I need security, which time of encoding, interoperability, ..., ... For example WS-Security that is the standard to secure SOAP messages is not (yet) supported by the Oracle 11g RDBMS Native Web Services... where when you do use the WS-Runtime you can secure the Web Service..
    Regards
    Tugdual Grall

  • Generating a Web Service and Oracle DATE type

    Hi,
    I need to generate a Web Service from an EJB model based upon entities generated from the Oracle 11g database that contain DATE types.
    I realize that java.sql.Date may not be a supported JAX-RPC type but I would be VERY grateful for some instructions about the easiest way to solve this problem when generating the web service in JDeveloper 11g.
    The integrated WLS server log looks like this:
    <2009-apr-26 kl 23:13 CEST> <Error> <HTTP> <BEA-101216> <Servlet: "WSEE_SERVLET" failed to preload on startup in Web application: "/SessionFacadeBean".
    javax.xml.ws.WebServiceException: Unable to create JAXBContext
         at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:158)
         at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:87)
         at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:264)
         at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:322)
         at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:188)
         Truncated. see log file for complete stacktrace
    java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
    java.sql.Timestamp does not have a no-arg default constructor.
         this problem is related to the following location:
              at java.sql.Timestamp
              at public java.sql.Timestamp oracle.Lan.getAterlamnadDatum()
              at oracle.Lan
              at public java.util.List ejbmodel.jaxws.QueryLanFindByNrResponse._return
              at ejbmodel.jaxws.QueryLanFindByNrResponse
    ..... and so on
    The entity bean i question looks like this:
    package oracle;
    import java.io.Serializable;
    import java.sql.Timestamp;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.JoinColumn;
    import javax.persistence.ManyToOne;
    import javax.persistence.NamedQueries;
    import javax.persistence.NamedQuery;
    @Entity
    @NamedQueries({
    @NamedQuery(name = "Lan.findAll", query = "select o from Lan o"),
    @NamedQuery(name = "Lan.FindByNr", query = "select o from Lan o where o.lanNr = :p_lanNr")
    public class Lan implements Serializable {
    @Column(name="ATERLAMNAD_DATUM")
    private Timestamp aterlamnadDatum;
    @Column(nullable = false)
    private Long demandcount;
    private Timestamp demanddate;
    @Column(name="EXEMPLAR_NR", nullable = false)
    private Long exemplarNr;
    @Column(nullable = false)
    private String isbn;
    @Id
    @Column(name="LAN_NR", nullable = false)
    private Long lanNr;
    @Column(nullable = false)
    private Long remindercount;
    private Timestamp reminderdate;
    @Column(name="TILLBAKA_DATUM")
    private Timestamp tillbakaDatum;
    @Column(name="UTLANAD_DATUM")
    private Timestamp utlanadDatum;
    @ManyToOne
    @JoinColumn(name = "PERSON_NR")
    private Lantagare lantagare;

    Hi All,
    When i'm developing EJB Webservice i am getting following error .. i think it doesn't support java.sql.Date; and java.sql.timestamp; types
    the error are as show in below please suggest me.
    [Running application oil on Server Instance IntegratedWebLogicServer...]
    [05:04:09 AM] ---- Deployment started. ----
    [05:04:09 AM] Target platform is (Weblogic 10.3).
    [05:04:09 AM] Retrieving existing application information
    [05:04:09 AM] Running dependency analysis...
    [05:04:09 AM] Deploying 2 profiles...
    [05:04:10 AM] Wrote EJB Module to C:\Documents and Settings\Administrator\Application Data\JDeveloper\system11.1.1.4.37.59.23\o.j2ee\drs\oil\oil_webservicesEJB.jar
    [05:04:10 AM] Wrote Enterprise Application Module to C:\Documents and Settings\Administrator\Application Data\JDeveloper\system11.1.1.4.37.59.23\o.j2ee\drs\oil
    [05:04:10 AM] Redeploying Application...
    <Jun 30, 2011 5:04:10 AM EDT> <Warning> <J2EE> <BEA-160195> <The application version lifecycle event listener oracle.security.jps.wls.listeners.JpsAppVersionLifecycleListener is ignored because the application oil is not versioned.>
    <Jun 30, 2011 5:04:10 AM EDT> <Warning> <Munger> <BEA-2156203> <A version attribute was not found in element webservices in the deployment descriptor in C:\Documents and Settings\Administrator\Application Data\JDeveloper\system11.1.1.4.37.59.23\o.j2ee\drs\oil\oil_webservicesEJB.jar/META-INF/webservices.xml. A version attribute is required, but this version of the Weblogic Server will assume that the JEE5 is used. Future versions of the Weblogic Server will reject descriptors that do not specify the JEE version.>
    <Jun 30, 2011 5:04:10 AM EDT> <Error> <HTTP> <BEA-101216> <Servlet: "WSEE_SERVLET" failed to preload on startup in Web application: "/oil-oil_webservices-webapp".
    javax.xml.ws.WebServiceException: Unable to create JAXBContext
         at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:164)
         at com.sun.xml.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:94)
         at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:281)
         at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:363)
         at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:202)
         Truncated. see log file for complete stacktrace
    Caused By: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
    java.sql.Timestamp does not have a no-arg default constructor.
         this problem is related to the following location:
              at java.sql.Timestamp
    >
    [05:04:11 AM] #### Deployment incomplete. ####
    #### Cannot run application oil due to error deploying to IntegratedWebLogicServer.
    [05:04:11 AM] Remote deployment failed
    [Application oil stopped and undeployed from Server Instance IntegratedWebLogicServer]
    Thanks in advance..
    Siva
    Edited by: Shankar on Jun 30, 2011 7:02 AM

  • How to Deploy a Simple Java Web service in Oracle E Business Suite Server

    Hi,
    I have created a simple Java webservice using Jdev11g.
    I am able to Test the Webservice using Jdev11g itself.
    How Can i migrate the same to Oracle E Busienss Suite( - 9iAS ) so that webservice clients connect to 9iAS instead of my local machine
    Thanks,
    Gowtam.

    Hi Sudhakar,
    If you are used to working with ant then you can very well use eclipse to deploy your web service.
    You would usually have the ant script in the source root working directory. From eclipse if you select the build file from the navigator view and right click you will see a run ant option in the pop up menu.
    Select that option and you would be able to see each targets with a checkbox select option. So define each target maybe one for wsdl2java conversion, one for compilation and one for deploying your web services. You can either make all of them run by having depends option on or you can run them individually as it takes your fancy.
    I am not sure about debugging a web service yet.
    Hope this helps
    Aviroop
    The truth is out there? Does anyone know the URL?

  • Java web service and pocket pc

    Hi all. I am looking for some advice on how best to go about the following. I have looked on the internet and found info on relevent parts, but not sure how to interact them all together.
    I want to develop an application for a pocket pc (probably windows mobile 5.0) that will interact with a web service(in java). The pocket pc will send some sort of authentication to the service, which will then query a database and send the relevent information back to pocket pc.
    I have read things on SOAP, WSDL and AJAX etc... but am unsure how to put them all together.
    If anyone has any advice, good tutorials or links then they are greatly appreciated.
    Regards

    Hi all. I am looking for some advice on how best to
    go about the following. I have looked on the
    internet and found info on relevent parts, but not
    sure how to interact them all together.Join the crowd :-) For most of this stuff, it seems we're ALL finding our way around.
    I have read things on SOAP, WSDL and AJAX etc... but
    am unsure how to put them all together.That's kind of like asking "how long is a piece of rope?" It depends on what you need it for.
    Try w3schools.org for some great tutorials on some of the underlying technologies that power the above.
    SOAP is nice and all if you want to use third-party libraries and you need industry-standard interactivity (for example with vendors or customers), but if you're doing everything in-house (i.e. your own application will consume the web service you wrote) then I'd seriously consider REST-based webservices. They're easier to write because you're free from the limitations of SOAP, and your apps can be smaller and with fewer parts.
    Screw WSDL. Use it only if you are forced to. Axis has a great WSDL generator and if you can deploy everything in Axis, then you're good to go. I started writing my webservices using Axis and WSDL->Java generators and I was all cool and stuff because I was doing what everyone said was the best way to write these new applications. It took me a while to realize that most of that advice was coming from the people that were writing the software the real applications were based on, not using the stuff they had written to build real apps with. The perspective is completely different.
    Then I had to maintain that mess and it wasn't worth it because all of my uses for webservices are internal. I write the server and client portions both. There's no need to complicate the issue with technologies that are meant for interacting with other systems which you have no control over, nor any knowledge of how they're consuming the information you're providing.
    As to specific documentation, that's a little harder to come by. Your best bet is to first and foremost: read the specs on w3.org. No other pieces of documentation will be as in-depth and informative as the spec. If you're using spec-compliant implementations, then you've already got all your documentation. They're dense, I agree. They take forever, I agree. But I have yet to find anything that can rival the depth of understanding I gain from the specifications. Read the specs. All of them. Download them, print them out, stuff them in a fat folder (mine's in a 3-inch binder) and keep them handy. It seems like enterprise-level webservice-enabled apps will require lots of third-party support libraries, use lots of different technologies, and the documentation required to help the developer actually use all of this stuff will become critical. That's why I say print stuff out and keep it in one spot.
    If you can get any good out of these third-party libraries for generating clients, then more power to ya. I think they're a waste of time, myself, because I can write a client quicker and make it far more easy to maintain if I just do it from scratch. I'm only interested in using these technologies to make it quicker, more effiicient, easier to maintain, etc... be careful you don't get carried away with the vastly divergent advice you'll get on how to build your app and end up making it much more complicated and harder to maintain than it would have been had you not used industry-standard methodologies. Think small and simple.
    To get started, I would get a really good XML IDE. I use oxygen (http://www.oxygenxml.com). Version 7 is out, which has XQuery debugging and lots of other stuff. Have your company buy it. It's worth it. (has eclipse integration too). Then download Sarissa: http://sourceforge.net/projects/sarissa it's a great cross-browser javascript library for doing AJAX stuff. We use it for our AJAX applications and it's great. Fairly well documented too. Then use as much client-side processing as you can get away with because with webservices, your XML processing will hammer the server. Our IBM dual 3GHz/8GB RAM machine is chugging constantly. We process around 300,000 pages of XML in a normal business day, and it's intensive processing (lots of SQL serialization and transforms). We're trying to offload as much work to the client as we can. We're using Mozilla now, so that's making life much easier for us. Even the embedded mozillas have fantastic support for AJAX-friendly technologies.
    As for putting everything together, well, you're pretty much on your own there. In our environment, we have a custom XML-based intranet portal, which I had to write myself because there's nothing out there that does what we need it to, we use Postgres as our enterprise database, JBoss as our application server, Apache as our front-end, and oh yeah, we have an AS-400 on which resides all the "real" data. Just try and find documentation on serving data via an AJAX-enabled enterprise app from data that resides on DB2/400 and generating the interface on the client using XSLT. Or how about getting data from the postgres server into an RPG program using a webservices client on the 400. I don't even think I'm supposed to be doing stuff like that, let alone be able to find documentation on a solution that someone has come up with.
    Now if someone would just make a good JavaScript IDE, AJAX would take off like a bat out of hell. How long has JavaScript been around now? 10 years-ish? And how many good IDE's are there for JavaScript? Zero. Really irritates me sometimes... A good Mozilla-based AJAX-friendly JavaScript IDE would be a HUGE and I mean HUGE benefit to the webservices community.

  • Java web start and MySQL database

    My application needs to connect to a database wich is inth server. When a user is connecting some specific information are dowlonding from the database. Is it possible to do this with java web start?

    best would be to have a app. server running and clients reading urls or should use EJB.
    You will have problems if any firewall is set up on the server side making direct sql calls to db, for example.

  • Java Web Services and hosting companies

    Hi
    At this moment I am looking for a web hosting companies.
    I will be developing website in Java and I will also develop Web Services.
    Can you tell if I am able to host Web Services with any hosting company that supports Java. Or is there any special requirement on the behalf of the hosting companies to support Web Services written in Java
    regardas

    No Problem at all
    Nomally the Web Service is big different between Web application. or you can build your Web service structure like web application structure. It depends on the web server:
    If the Web Server of hosting company has WEB Service framework, you just need know how to deploy your Web service to Web Service framework and How to deploy to Web Server. In this case, you need deploy it two time, one is for Web Server framework and one is for Web Service framework
    If the Web Server of hosting company doesn't has WEB Service framework, you need build your own Web Service framework into a web application, then you just need know how to deploy your web application with Web service into Web Server framework

  • Java Web service and dynamic entry list

    Hello,
    In my VC mode, I have a combo box with a dynamic entry list. This entry list call a web service function which the source is :
    public EntryListBean[] getEntryList() {
              EntryListBean[] liste = new EntryListBean[2];
              liste[0] = new EntryListBean();
                    liste[0].setText("1");
              liste[0].setValue("Liste 1");
              liste[1] = new EntryListBean();
                    liste[2].setText("2");
              liste[1].setValue("Liste 2");
              return liste;
    In output port, i have:
    VALUE -
    > @value
    TEXT    -
    > @text
    When i test this function with 'Test Data Service', it work but when i deploy the model, there is nothing in the combo box. Do you have the same problem ?
    I have installed NWDW v7.0 SP9 with Visual Composer patch 2.
    Regards

    Hi Francois,
    Did u try using dynamic entry list with a BAPI. Is that working fine?
    Actually, I faced the same problem. I used a drop-down list, in which dynamic entry list works fine in case of a BAPI and appears blank in case of a webservice. I applied the latest patch files mentioned in a SAP note. People in forum asked me to do that. Its mentioned in the note that, "Dynamic entry list with webservice bug is fixed in the released patch file". But even after applying the latest patch files, it did not work for me. So, i think this bug is yet to be fixed.
    Regards,
    Kavitha.

  • Java web Service and Tomcat

    Hello,
    how can I set where service save files. Becouse when I save file in web service running on Tomcat 6.0, it is in directory Tomcat\bin.

    Well how do you tell it which file/directory to save it in?
    Just with new File("myFileName.txt") ?
    In that case it just uses the current working directory which normally just happens to be the Tomcat/bin directory.
    Better way is to use the constructor for File which takes two arguments - a directory and a filename
    File saveDirectory = new File("c:/data/webservicefiles/");
    File saveFile = new File(saveDirectory, "myFileName.txt");
    Of course the directory for saving should be configurable somewhere. In a properties file most likely.

  • Java web services and jdk1.3.1

    Hello.
    It seems that the new "webservices Developer pack" 1.3 only works with JD1.4, since it uses the new logging API's.
    My situation is this: I want to use the pack, but I can only run on 1.3.1 for application reasons. I cannot find an old version either?
    Any input, anyone?

    http://java.sun.com/webservices/archive.html

  • Send an event from Java Web Service to BPEL

    Hi,
    I have a requirement where from an Async BPEL service I have to call a Java Web Service. After the completion of its task Java Web Service will fire an event that has to be consumed by the BPEL to initiate further process. Can anybody help me with how to send an event from Java Web Service and at the same time consume it in BPEL?
    Thanks,
    Anuj

    See the following posts for your answer
    http://blogs.oracle.com/soabpm/entry/event_delivery_network_chapter
    http://blogs.oracle.com/soabpm/entry/using_the_event_api_to_publish
    http://guidoschmutz.wordpress.com/2010/01/12/using-the-event-api-to-publish-an-event-to-the-event-delivery-network-edn-the-spring-way/

  • Java Web Service Deployed on App server does not run

    hi,
    I created a java web service and deployed it on my Application server. When i open the enterprise manager i find my webservice there. I click on test web service and it gives me two options one with a 4443 port and other with a 7777 port. It picks up a 0.0.0.0 hostname though i deplyoed it on to a different machine.
    I choose to use the 7777 port and test the web service whrn i click invoke it give me the error
    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
    More information about this error may be available in the server error log.
    and when using the 4443 port it gives me the error as
    "SSL Error: unable to find valid certification path to requested target"
    please suggest how i can test a simple java webservice.
    Thanks
    Sravanti

    I think the problem is to add the custom dll files while deploying the application. Could any one please suggest how i can add custom dll file for deployment?
    Thanks
    Sravanti

  • Calling normal java web service from bpel

    hi,
    i want to call a normal java web service (which has been deployed in an application server) and not a bpel process from my .bpel file.
    i see that while creating a partner link , i have to specify the wsdl file location.
    there are two options.
    from local bpel server and
    from local file system.
    since the web service is not a bpel prcess, it can not be deployed in the bpel process manager and i have to choose the wsdl file location from local file system.
    now there are some major differences in the two type of wsdl file, i.e., that of a java web service and a bpel process.
    let me give u all a concrete example.
    let i have a hello world web service which takes a name as input , concatenates the name with "hello" and outputs.
    i created a partner link to this web service.
    after creating the partner link, a local copy of the wsdl file is added into my bpel project which only contains definition import and partnerlink statements.
    but i can not progress any further.
    can any one help me out of this problem.
    also i will be helpful if any one can suggest a tutorial where bpel is used to orchestarate between normal java web services deployed in some other application server and not mere bpel processes.
    thanks & regards.
    sudipto

    Hi Sudipto,
    Just to add to the options. There are three options.
    1 and 2 as mentioned by you.
    3 you can give the hosted wsdl location directly in the text box. (i.e. somthing like http://ws.strikeiron.com/CensusData?WSDL)
    This in turn will create a local wsdl which has partnerLink info and an import of the original wsdl.
    once you have this select the appropreate Partner Link Type and Partner Role.
    HTH
    Dhaval

  • Using request object in java web service code

    Hi,
    I am working on a java web service and require the request object in my code.
    This is because i want to get the name of the user who is using this web service.
    I am getting error in the line
    IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
    Please guide me how to use the request object.
    Please also suggest if there is any other way to get the name of the user who is using the web service.

    Simple answer: This is not possible due a web service doesn't has such request objects.
    If you want to use the user information you have to pass it from the programm logic you are calling the web service. When you have e.g. a JSPDynPage you can read out the user information and supply this information for your web service.

Maybe you are looking for

  • Existing books re-created with iBooks Author

    Alright, I am working for a company who is publishing and selling harcopy books. Now, I used iBooks Author to create one of these books into iBooks and I am about to sign-up with Apple to have this book into the Store but I want to be sure that I wil

  • Quick Preview problem on MacbookPro

    Following issue is about me not be able top open full preview of my RAW files sistem is reporting the ERROR here is the printscreen of my problem. I think it is the problem with mayority of extensions acept JPG sice JPG files are opend with no proble

  • How do I export Pages document into iPhoto

    How do I export Pages document into iPhoto?

  • Playlist Shuffle as Default Setting

    Hi, Anyone know if you can set song shuffle as the default setting for an iPod nano? Every time my iPod is powered off, or synchronizes to my PC, the settings go back to no shuffle and repeat and I have to reset when I power back on. Thanks, Chris

  • Relating two items

    I have two items that I need to relate together. One is a abbreviation and the other is a full text value. If the abbrevation changes I need to change the full text. Is that possible?