Threads in Web Services

Hi. Im using the Oracle SOA Suite Platform. I have developed a JAva Web Service that in one of his methods create an instance of an object that extends Thread. I want to create a thread calling a webService. I note that if i debug the web Service everything is correct (the thread continue running). But if i use the service (not debugging). The thread never start to run...
is it posibble to run Threads with a webServices? is it possible that when the web services return the value, he dies and the thread dies too?
thank you

Yes, it is possible to create a thread in web service as java code involved in web services is no different from other kind of applications. A thread will die when it has finished its job, that could be well after the response has been send to the client. If you want to change this behavior then you need to code for the same.

Similar Messages

  • Short question about networking, Threads and  web services..

    Lets say I got 2 classes, Midlet A and Thread B.
    I created Thread B because web services (jsr-172) uses networking and It has to be done in a separate thread other then the Midlet A.
    So, in Thread B, I have the run(), where I do all my stuff, and some getSomething() methods.
    I need to have run() complete before calling getSomething(), so I used something like this in Midlet A:
    while(true){
        if(b.isAlive())
            getSomething();
    }Problem is, Thread B only runs to completion when I don't call b.isAlive(). (I know from System.out.println I placed in it) When I do use any methods like wait() or join() or isAlive(), Thread B stops at the web service call.
    I really don't understand what's the problem. I've tried various ways to only call getSomething() when the thread finishes running, but all of them made my WTK emulator hang at the part where it asks for permission to access the network.
    If I don't use getSomething(), which is the purpose of starting the thread in the first place, it runs fine in the emulator and doesn't hang anywhere. Oh the irony.

    Bump!
    Anyone got even half a clue what's wrong? =O
    Hmm. I think that having the midlet wait for the thread causes the midlet to hang because the thread will then wait for the midlet for permission to access the network, but the midlet is waiting for the thread to finish it's code. Damn.
    Message was edited by:
    lonereaction

  • Using threads in web services

    Is it possible to use threads in a web service? What I propose is a web service that provides a number of different operations just like a standard web service. However, a new thread would be started at the initialisation point of the web service. This thread would wake up every hour and carry out a small task.
    Is this possible?

    I have given this a go. It seems to work in NetBeans5.5 but not in Eclipse WTP. The reason I need to do it in Eclispe WTP is that we need to support Java 1.4.2 whereas I can't seem to create a web service in NetBeans5.5 for 1.4.2, it only lets me create a web service for 1.5.
    I have a main class which I use to create a new instance of the thread. In the constructor of this main class I start the thread running. I have an operation called getThreadCount() which returns the current iteration of the loop. However, when I deploy the webservice and call the getThreadCount() operation it seems to kick off a new thread! What's going on here? See code below.
    public class AuditMaintenance {
         private AuditMaintenanceThread auditMaintenanceThread;
         public AuditMaintenance(){
              this.init();
         public void init()
              auditMaintenanceThread = new AuditMaintenanceThread();
              auditMaintenanceThread.start();
         public void start() {
            // TODO implement operation
        public void stop() {
            // TODO implement operation
        public int getThreadCount() {
            // TODO implement operation
             return auditMaintenanceThread.getThreadCount();
    public class AuditMaintenanceThread extends Thread{
         private int mThreadSleepTime = 1000;
         private int mThreadCount = 0;
         public AuditMaintenanceThread() {
         public void run()
              while(true)
                System.out.println(mThreadCount + " HELLO WORLD!");
                try
                    sleep(mThreadSleepTime);
                catch (InterruptedException ex)
                    ex.printStackTrace();
                mThreadCount++;
         public int getThreadCount()
            return mThreadCount;
    }

  • Web Service Model ---javax.xml.rpc.soap.SOAPFaultException

    Hi Experts,
                     I am working with webservices model Using NWDS 7.013. One application (webservice model) was developed in old portal server after that portal server was scrapped. XI server only available now. Currently i have a new server. I import into that application into My NWDS using the New server.
    Refering the below thread
    Re: Problem calling XI WebServices from WebDynpro Java
    I added following code in the component controller before execute the model
    req._setUser("username"); (eg. user_XI)
    req._setPassword("password"); (eg. password_XI)
    while executing the model in the component controller the following exception will be occured
    javax.xml.rpc.soap.SOAPFaultException
    How can i rectify this? anything i am going to create JCO in SLD or any configuration going to create Visual administrator? Please give me your valuable suggestions....
    Regards,
    P.Manivannan.

    Hi,
    Refer to thread Re: Web Service Error. which may be helpful.
    Kind Regards,
    Nitin

  • PAPI Web Service (PAPI-WS) Example for Oracle BPM Studio

    Here is the location of a step-by-step explanation on how to use PAPI Web Service (PAPI-WS) to create a work item instance and then run the instance inside an activity in a process running on Oracle BPM Studio.
    http://www.4shared.com/file/128256802/f20abc7a/PAPI-WS_for_Oracle_BPM_Studio.html
    Be sure to use the project that is in the zip file for this example.
    If you need an example of how to use PAPI-WS on Oracle BPM Enterprise, go to this thread: PAPI Web Service (PAPI-WS) Example for Oracle BPM Enterprise Standalone
    If you need a step-by-step example of how to use PAPI (the Java API) go to this thread: Creating a new work item instance in a process using PAPI
    Hope this helps,
    Dan

    Hi,
    Is there any sample code showing PAPI-WS with VS 2008? AFAIK, there is a sample using VS 2005 and WSE 3.0, but I'm interested in using VS 2008/WCF.
    Regards,

  • PAPI Web Service (PAPI-WS) Example for Oracle BPM Enterprise Standalone

    Here is the location of a step-by-step explanation on how to use PAPI Web Service (PAPI-WS) to create a work item instance and then run the instance inside an activity in a process running on Oracle BPM Enterprise Standalone.
    http://www.4shared.com/file/128249957/9bd6ef61/PAPI-WS_for_Oracle_BPM_Standalone.html
    Be sure to use the project that is in the zip file for this example.
    To see how to invoke PAPI-WS when using Oracle BPM Studio, go to this thread: PAPI Web Service (PAPI-WS) Example for Oracle BPM Studio
    If you need a step-by-step example of how to use PAPI (the Java API) go to this thread: Creating a new work item instance in a process using PAPI
    Hope this helps,
    Dan

    Dan,
    I tried in both studio and Standalone.
    From Studio :*
    1. The Url for the Webservice is (http://localhost:8585/papiws/PapiWebServiceEndpoint?wsdl). From studio by default port number was 8585.From this studio wsdl URL(http://localhost:8585/papiws/PapiWebServiceEndpoint?wsdl),I did n't see any wsdl text in the browser.
    From Standalone :*
    1. In BPM Admin Center, I have selected *"PAPI Web Services"* check box(Page 5 of your document).
    2. In The BPM Admin Center, I have clicked on *"Start BPM Web Applications"*.
    3. After Stand alone server started *"Launch PAPI WebServices Console"* link was enabled,And I clicked on that link.It opened a browser with URL (http://localhost:8686/papiws/PapiWebService)
    Oracle® BPM PAPI Web Services
    Service Name 'PapiWebService'
    Style: Document Literal Wrapped
    SSO Enabled: false
    WS-Security UsernameToken Profile Authentication Enabled: false
    HTTP Basic Authentication Enabled: true
    Preset Authentication Enabled: false
    MTOM Optimization for attachments Enabled*: false
    Endpoint: http://localhost:8686/papiws/PapiWebServiceEndpoint
    WSDL: http://localhost:8686/papiws/PapiWebServiceEndpoint?wsdl
    I have copied wsdl URL(http://localhost:8686/papiws/PapiWebServiceEndpoint?wsdl) and pasted it into a browser's URL field.I did n't see any wsdl text in the browser,but I see following error
    HTTP Status 404 - Servlet PapiWebServiceServlet is not available
    type Status report
    message Servlet PapiWebServiceServlet is not available
    description The requested resource (Servlet PapiWebServiceServlet is not available) is not available.
    Apache Tomcat/5.5.15
    Edited by: Prabhasankar on Dec 24, 2010 9:10 AM

  • SOAP Messaging Using Crystal Reports Web Services To Return Report in PDF or Excel Format

    All,
    I am trying to use SOAP messaging to fetch a Crystal Report through a Managed repository and getting back either a PDF or Excel file. For some reason, any reference to web services on this site I cannot access. Like thread, "Using Web Services on the Crystal Report Server XI to return reports".  Can anyone point in a direction to Web Service Calls API documentation or does this not exist ?????? I would hope this product has this capability.
    Thanks In Advance,
    Tom

    XI Release 2 Service Pack 2 introduced the Business Process BI Web Services, that allow you to retrieve reports using SOAP messaging.
    It's documented here:
    http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/WS_SDK/wssdk_portal/doc/wssdk_bpbi_doc.pdf
    Sincerely,
    Ted Ueda

  • Exposing a report as RESTful web service - Parameters

    Hi,
    I am creating a RESTful web service by exposing an apex report. It just works fine and it renders the data. However I want to have parameters and values in the web service URL so that the data can be filtered based on the parameter values?
    For example:
    http://127.0.0.1:8080/apex/apex_rest.getReport?app=100&page=15&reportid=rest_example renders correctly for the report query
    select * from (
    select
    "CUSTOMER_ID",
    "CUST_FIRST_NAME",
    "CUST_LAST_NAME",
    "CUST_STREET_ADDRESS1",
    "CUST_STREET_ADDRESS2",
    "CUST_CITY",
    "CUST_STATE",
    "CUST_POSTAL_CODE",
    "PHONE_NUMBER1",
    "PHONE_NUMBER2",
    "CREDIT_LIMIT",
    "CUST_EMAIL"
    from #OWNER#.DEMO_CUSTOMERS )
    where (
    instr(upper("CUST_FIRST_NAME"),upper(nvl(:P15_REPORT_SEARCH,"CUST_FIRST_NAME"))) > 0  or
    instr(upper("CUST_LAST_NAME"),upper(nvl(:P15_REPORT_SEARCH,"CUST_LAST_NAME"))) > 0
    )But I want to filter the result for a particular customer id by getting a value in the URL like this.
    http://127.0.0.1:8080/apex/apex_rest.getReport?app=100&page=15&reportid=rest_example&P15_CUSTOMER_ID=6 and to use the value received thro the URL in the report query
    select * from (
    select
    "CUSTOMER_ID",
    "CUST_FIRST_NAME",
    "CUST_LAST_NAME",
    "CUST_STREET_ADDRESS1",
    "CUST_STREET_ADDRESS2",
    "CUST_CITY",
    "CUST_STATE",
    "CUST_POSTAL_CODE",
    "PHONE_NUMBER1",
    "PHONE_NUMBER2",
    "CREDIT_LIMIT",
    "CUST_EMAIL"
    from #OWNER#.DEMO_CUSTOMERS
    where customer_id = :P15_CUSTOMER_ID)
    where (
    instr(upper("CUST_FIRST_NAME"),upper(nvl(:P15_REPORT_SEARCH,"CUST_FIRST_NAME"))) > 0  or
    instr(upper("CUST_LAST_NAME"),upper(nvl(:P15_REPORT_SEARCH,"CUST_LAST_NAME"))) > 0
    )Is it possible to have it working in this way?
    I am currently testing this in apex 4.2 and Oracle 11g XE. My development environment will be Apex 4.1 and Oracle 11g.
    Thanks in Advance.
    Regards,
    Natarajan
    Edited by: Nattu on Dec 18, 2012 2:09 AM

    It does accept values for the parameters but does not accept value names in the URL.
    The previous thread Restful web service passing character parameters helped me to get it working.
    Thanks.

  • Web Service Help (Login Problem?)

    Hi,
         I'm trying to access the queryview webservice.  I have access to the WSDL, but when I perform the SOAP call I get an "Authority check failed" error.
    Any ideas where this error is coming from gurus or how to get past it.?  I'm using infopath to perform the soap call.
    Any help is greatly appreciated!
    The SOAP response indicates that an error occurred:
    Authority check failed

    i assume that you have desinged the form and saved it. when you open the saved form and run it you get this error.
    to avoid this you have to pass userid and password. for this you may have to add two fields in the form and add a custom code to the form tohandle the user id and password .
    check out the link in my weblog on this subject.
    /people/durairaj.athavanraja/blog/2004/09/07/microsoft-office-2003-infopath-sap-rfcwebservice
    Regards
    Raja
    close your previous threads
    Re: Web Service Login

  • Consume PI7.1 Webservices with Adaptive Web Service Model and Logical Dest.

    Hi all,
    I'm looking for a run-through of how to configure logical destinations for a Web Dynpro 7.00.15 application (running on a AS Java 7.00 SP15 server) that is consuming a web service on a PI 7.10.07 server.
    My problems are no related to:
    - importing the WSDL file into the project and mapping nodes/contexts to perform the call
    - restrictions with access and authorizations (own 7.00 sandbox)
    My problems are:
    - what to put into the WS metadata and execution destinations in Visual Admin
    - how to configure 1 set of destinations per WS provider (using WSIL or UDDI/ESR query)
    I have tried the http:///inspection.wsil, but it only returns standard java AS web services (such as AdobeDocumentServices) but not the ones in the Services Registry / UDDI.
    So: How can I configure the setup so that I only need 2 ws destinations per WS provider?
    I've tried the direct Webservice endpoint WSDL URL, but it's not what I want to do. Anyways, it gives me an "IndexOutOfBoundsException" in the DInterfaceImpl.java file.
    Hope you can help me out. I've dug myself into a hole here...
    Best Regards,
    Hans Petter Bjørn

    Hi Hans
    Please check this thread [Adaptive Web Service Model in SP 17|Adaptive Web Service Model in SP 17]
    Hope this will help you.
    thanks
    Arun Jaiswal

  • Web service client proxy thread safe?

    Is the jax-ws web service client proxy and port objects thread safe in Weblogic 10.3.4?
    Been searching through the docs but can't find any info on this.

    I have searched and it seems that with cxf it's safe to do something like this.
    Nobody knows if this is safe using metro?

  • Are Oracle JDeveloper 10.1.3.3 Web Service Proxys Thread Safe?

    Hi
    Does anybody knows if Oracle JDeveloper 10.1.3.3 Web Service Proxys Thread Safe?. The Oracle JDeveloper 10.1.2 Web Service Stubs were not Thread Safe.
    Regards,
    Néstor Boscán

    Do you have an answer on this? I have the same question. I would like to just cache the Service Instance returned by factory, if it is thread safe.
    Chandresh

  • Problem including: thread, native calls, web service

    I have the following problem:
    There is web service (myService) running on a 2-processor machine
    The web service starts a thread (myThread)
    The thread's run calls a native method (myNative).
    The implementation of the native method simply calls a function (myFunc).
    The web service starts the thread and waits for it to end (with join() ).
    The above are summarized in the following:
    myService
    myThread.run()
    myNative()
    myFunc()
    The problem is:
    it seems that while myThread has ended its execution, the myNative function keeps running.
    (e.g. messages of myNative are printed after the end of the execution of myThread)
    Could this be related to the fact that the machine has 2 processors?
    What could be the cause?
    Thank you in advance.

    This is most likely caused by how the native processes standard output streams are implemented. Try using some other form of feedback (i.e. write to a file, or throw up a user dialog box) and you'll most likely see that the native method is indeed returning when you think it should, but the native output stream doesn't show up until later.
    - K

  • Multiple web services or one with many methods? when are threads created?

    Hey guys,
    I was just wondering how do you implement your web services - if you create one wsdl location with many methods (meaning one @WebService and lots of @WebMethod), or leave one class for each method, having many wsdl locations.
    A follow-up question would be: does each web service call create a thread, even if it's different calls to the same web service?
    Thanks for answering.

    Hi,
    pure from a coder instinct I think I would prefer them to be in separate projects for better reuse and clean separation. If I need project 1 to access aclass from Project 2, I can check the dependency check box in the project properties. Is there any business requirement that makes you think having all of these in a single project will help ?
    Frank
    Btw.: I agree that JDeveloper shouldn't constraint developers from doing what they want and if this is a limitation the feel free to file a bug

  • Anyone got sample C# / VB code for CRM OD web service with multi threading?

    Hi,
    I am writing a small utility app to help bulk delete data from custom objects in CRM OD via web services.
    However from what i can see you can only delete 20 records at a time it can take a long time to delete several thousands records by getting 20 results from a query, then deleting the records, then getting the next page of results and deleting them and so on.
    I thought that using multiple threads would help speed up the process but since I'm new to CRM OD web service development i thought if would see if anyone had any sample code they would like to share to help ease the transition?
    Any help would be appreciated.
    Thanks

    Not done this area myself - but I spotted some code that use these tables:
    CRMD_SRV_OSSET, CRMD_SRV_SUBJECT.
    So your selecting lines from OSSET that match the service ticket header guid
    SELECT * FROM   CRMD_SRV_OSSET
             WHERE  SUBJECT_PROFILE  = 'Subject Profile for classification'
             AND    GUID_SET  in
                            ( SELECT GUID_SET FROM CRMD_LINK
                                   WHERE  GUID_HI EQ header_GUID
                                  ) ... into a internal table
    The selecting more information from CRMD_SRV_SUBJECT that matches guids found on the OSSET table
    loop round internal table
    SELECT * FROM  CRMD_SRV_SUBJECT
           WHERE  GUID_REF    =  crmd_srv_osset-GUID
    endloop.
    On this table you have your code group and code that relate to a classification
    Hope this helps and give me some points if it does

Maybe you are looking for