Http Request never ends

Hi,
Well I had a few minutes on my hand and decided to build a simple socket application that handles a browser request with a �hello�. Then I decided to complicate that a little and to actually send back what I receive. However the while loop that checked the input from the browser never ends (that is I never get a �1 from inputStream.read() method).
Could someone please explain me why this happens? And how this could be solved? I mean how to detect that the request is over and it is time to respond. (In other words how can I base my response according to the request if I never know when the request is over!).
Here is the code I used import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.net.ServerSocket;
import java.net.Socket;
public class Test7 {
public static void main(String[] args) {
  try {
   ServerSocket serverSocket = new ServerSocket(9989);
   while(true){
    Socket socket = serverSocket.accept();
    new Thread(new SimpleHttpHandler(socket)).run();
  catch (Exception e) {
   e.printStackTrace();
class SimpleHttpHandler implements Runnable{
private Socket client;
public SimpleHttpHandler(Socket client){
  this.client = client;
public void run(){
  try{
   BufferedOutputStream outputStream = new BufferedOutputStream(
     this.client.getOutputStream()
   BufferedInputStream inputStream = new BufferedInputStream(
     this.client.getInputStream()
   int in = 0;
   while((in = inputStream.read()) != -1){
    System.out.print((char)in);
    outputStream.write(in);
   outputStream.close();
   outputStream.flush();
  catch(Exception e){
   e.printStackTrace();
Regards,
Sim085

So you can't read RFC but can read forums? :)Can you imagine reading documentation about something by continuously minimizing and maximizing the browser window? (which I do when at work so to attract less attention) :)
Well if you want simplest way then just send header,
data and close connection that's enough.Thanks :) I understand that now :)
@bsamperi & [email protected]
The code I provided above was not correct. I fixed it and posted it again just in case someone else comes across this post. As already said this was not what I had in mind to do in the first place, but it was fun :) Anyways here is the working code! (Although naturally not good for anything)import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class Test7 {
public static void main(String[] args) {
  try {
   ServerSocket serverSocket = new ServerSocket(8871);
   while(true){
    System.out.println("Waiting for request");
    Socket socket = serverSocket.accept();
    new Thread(new SimpleHttpHandler(socket)).run();
  catch (Exception e) {
   e.printStackTrace();
class SimpleHttpHandler implements Runnable{
private final static String CLRF = "\r\n";
private Socket client;
private BufferedWriter writer;
private BufferedReader reader;
public SimpleHttpHandler(Socket client){
  this.client = client;
public void run(){
  try{
   this.writer = new BufferedWriter(
     new OutputStreamWriter(
       this.client.getOutputStream()
   this.reader = new BufferedReader(
     new InputStreamReader(
       this.client.getInputStream()
   System.out.println("-- IN --\n" + this.read() + "\n");
   System.out.println("-- OUT --\n" + this.write("Thank You"));
   this.writer.close();
   this.reader.close();
   this.client.close();
   System.out.println("Completed response");
   System.out.println("--------------------\n");
  catch(Exception e){
   e.printStackTrace();
private String read() throws IOException{
  String in = "";
  StringBuffer buffer = new StringBuffer();
  while(!(in = this.reader.readLine()).trim().equals("")){
   buffer.append(in + "\n");
  return buffer.toString();
private String write(String out) throws IOException{
  StringBuffer buffer = new StringBuffer();   
  buffer.append("HTTP/1.0 200 OK" + CLRF);
  buffer.append("Content-Type: text/html" + CLRF);
  buffer.append(CLRF);
  buffer.append(out);
  buffer.append(CLRF);  
  writer.write(buffer.toString());
  return buffer.toString();
}The output of this code is: Waiting for request
-- IN --
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-powerpoint, application/vnd.ms-excel,
application/msword, application/x-shockwave-flash, */*
Accept-Language: en-us
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2;
.NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: localhost:8871
Connection: Keep-Alive
-- OUT --
HTTP/1.0 200 OK
Content-Type: text/html
Thank You
Completed response
Waiting for request
-- IN --
GET /favicon.ico HTTP/1.1
Accept: */*
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2;
.NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: localhost:8871
Connection: Keep-Alive
-- OUT --
HTTP/1.0 200 OK
Content-Type: text/html
Thank You
Completed response
Waiting for request
...Which shows that this application will handle any web request with a �Thank You� since I am not basing the response on the request. However that should not be hard once the request and response are handled ok.
Thank to both of you for your help :)
Regards,
Sim085

Similar Messages

  • Persistent HTTP Requests in BSP: Can you Flush the Response without Ending It?

    Hello all,
    I have been looking for a way to implement a persistent HTTP Request in a BSP.  This means the server keeps the request open as long as possible and sends data periodically to the browser without closing the request.  In other development environments, there would be a way to flush the response to the client, separate from closing the connection, thus making this possible.  I have looked and do not see any way to do this.
    Also, if it is not possible with a BSP, is there another way to do this via the Web Application Server?
    Thanks for any help,
    -Chris

    There are various limits: the number of sockets / file descriptors that the operating system lets a program have open, the amount of socket buffer space in the operating system, the number of simultaneous connections that the web server allows. Each of these can be configured.
    One problem is that a web server starts a thread for each hit. If you have 1000 simultaneous active hits you have 1000 threads. That is quite a lot. I've seen server OSes start buckling at around 400-500 threads. Given a suitable OS you may get higher with a bit of configuration, but I'd say the number of threads is rather a big concern. 100,000 threads? That dog don't hunt.
    An alternative would be not to use a regular web server, but to use a NIO select -based server. Then you can have one thread that handles all the connections. I once did that to write a stock ticker applet. But if you want to do fully standards compliant HTTP implementation that's not trivial.
    If you are writing the client applet as well as the server, consider using a simpler protocol than HTTP and writing a NIO server. NIO isn't quite trivial to get really right; look at examples and tutorials; google is your friend. If you can keep each client's connection open do so; establishing and tearing down hundreds or thousands of connections a second, and sending HTTP request and reply headers, is going to eat network and CPU resources.
    If you are really targeting 100,000 clients at 5 seconds between messages, that comes to 20,000 messages per second. That's a lot; plan for a load balanced server cluster.

  • AdamSync from AD to LDS goes into a continuous never ending loop... can't figure this out.

    I THINK I've got this thing configured up to the point where it should be able to sync.  The XML config is set to just grab a single OU with roughly 12 accounts in it.
    Everything seems to connect OK, then it does a ton of "Processing Entry", even though there are only a few accounts in this OU.
    Then it begins to do "Adding target object..." and gets stuck in a never ending loop.
    Can someone point me in the right direction on how to troubleshoot this?
    This is what the log looks like:
    ==========================
    Adamsync.exe v1.0 (6)
    Establishing connection to target server localhost:6389.
    There is already an active sync session in progress. 
    Please allow the session to complete, or use -mai to seize the role.
    Saving Configuration File on CN=Test,DC=domain,DC=org
    Saved configuration file.
    ADAMSync is querying for a writeable replica of 10.10.10.10.
    Error: DCLocator call failed with error 1355. Attempting to bind directly to string.
    Establishing connection to source server 10.10.10.10:389.
    Using file .\dam9280.tmp as a store for deferred dn-references.
    Populating the schema cache
    Populating the well known objects cache
    Starting synchronization run from dc=domain,dc=org.
    Starting DirSync Search with object mode security.
    Processing Entry: Page 1, Frame 1, Entry 0, Count 0, USN 0
    Processing source entry <guid=94f6d930da2339439df75278a02accae>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 1, Frame 1, Entry 1, Count 1, USN 0
    Processing source entry <guid=bf15bc4b684ece4f99010548e79decb0>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 1, Frame 1, Entry 2, Count 1, USN 0
    Processing source entry <guid=fcea01637658134eab7ec74fe022d4fe>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 1, Entry 35, Count 1, USN 0
    Processing source entry <guid=5e768f4392863b4d86935e6bf01acc25>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 1, Entry 36, Count 1, USN 0
    Processing source entry <guid=b5d263a264aad045b8f42f19b49dd844>
    Previous entry took 0 seconds (16, 0) to process
    Processing Entry: Page 3, Frame 1, Entry 37, Count 1, USN 0
    Processing source entry <guid=f19994051c804846b7bcbd066d9e9d40>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 1, Entry 38, Count 1, USN 0
    Processing source entry <guid=b16cd765bafa4f4d8649d91f0f055e5f>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 1, Entry 39, Count 1, USN 0
    Processing source entry <guid=6be6a7d551978445aafd3803e60dc560>
    Processing in-scope entry 6be6a7d551978445aafd3803e60dc560.
    Adding target object CN=User Name,OU=Staff Accounts,OU=Users,OU=ITS,CN=Test,dc=domain,dc=org.
    Adding attributes: sourceobjectguid, instanceType, objectSid, sAMAccountName, lastagedchange, objectclass, 
    Adding target object CN=User Name,OU=Staff Accounts,OU=Users,OU=ITS,CN=Test,dc=domain,dc=org. Requesting replication of parent.
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 2, Entry 0, Count 0, USN 53438354
    Processing source entry <guid=bbb4a760a8281741a11d9331efaa3d7a>
    Processing in-scope entry bbb4a760a8281741a11d9331efaa3d7a.
    Adding target object OU=Staff Accounts,OU=Users,OU=ITS,CN=Test,dc=domain,dc=org.
    Adding attributes: objectClass, instanceType, sourceobjectguid, lastagedchange, 
    Adding target object OU=Staff Accounts,OU=Users,OU=ITS,CN=Test,dc=domain,dc=org. Requesting replication of parent.
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 3, Entry 0, Count 0, USN 52660067
    Processing source entry <guid=8d3ef319dff31f47819632af2da5df2c>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 2, Entry 0, Count 0, USN 53438354
    Processing source entry <guid=bbb4a760a8281741a11d9331efaa3d7a>
    Processing in-scope entry bbb4a760a8281741a11d9331efaa3d7a.
    Adding target object OU=Staff Accounts,OU=Users,OU=ITS,CN=Test,dc=domain,dc=org.
    Adding attributes: objectClass, instanceType, sourceobjectguid, lastagedchange, 
    Adding target object OU=Staff Accounts,OU=Users,OU=ITS,CN=Test,dc=domain,dc=org. Requesting replication of parent.
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 3, Entry 0, Count 0, USN 52660067
    Processing source entry <guid=8d3ef319dff31f47819632af2da5df2c>
    Previous entry took 0 seconds (0, 0) to process
    ===================================================

    Hi,
    Are there any error messages from the event log?
    Here is a KB article which describes a similar issue below I suggest you refer to:
    Error message when you use the Adamsync tool in Windows Server 2003: "Error: We seem to be in an infinite recursive loop"
    http://support2.microsoft.com/kb/926933
    Best Regards,
    Amy

  • Launching a never ending vi in sequence

    Hi!
    I have a vi that can basically be represented by a while loop that never stops until i press a button.
    I want to load and run this vi from a sequence without it hanging up that sequence.
    Also, at the end of the sequence it would be great if it could end the loop in the vi.
    For this last part I made the vi read out a variable in my locals and stop the loop as soon as it is a certain value.
    (I think this is a good solution, but any suggestions are of course welcome )
    For being able to run the rest of the sequence, even though the vi never ends, I was less successful.
    I tried putting the vi in a subsequence and then running that subsequence in a different thread.
    However, stepping through the main sequence, it does steps over the call of the subsequence,
    but then the main sequence still freezes until i stop the loop in my vi.
    What am i doing wrong exactly? Any help would be much appreciated!
    Solved!
    Go to Solution.

    Run Asynchronous VI basically uses a sequence call module with the "New Thread" option, but I don't think it does much more than that. I think you still have to do ExternallySuspended and/or Termination monitor in your vi. At any rate, I recommend against using Run asynchronous vi as there have been issues with using that step type (confusion over what passing ThisContext means for the most part). See the following link for more details about the issues with Run asynchronous vi if you are interested:
    http://forums.ni.com/ni/board/message?board.id=330&message.id=28101&query.id=753835#M28101
    As far as termination monitor not detecting whether or not the original thread has completed normally, that is not its purpose and not always what a user might want. For example, you might have a worker thread that you want to keep running even after the thread that launched it completes. There might even be more than two threads in the execution and the execution technically isn't complete until all threads are done, including the asynchronous ones. The purpose of the termination monitor is to give the code module a way to detect when the user is requesting a terminate or abort so that it can return and allow the execution to terminate or abort normally (an execution cannot terminate or abort while a code module is still running).
    Like you are suggesting, you can probably pass in the original caller's thread as a parameter to the asynchronous sequence and your VI and call Thread.WaitForEnd on it with a 0 ms timeout to check if it's done in your loop. You need to make sure that you unchecked the "Automatically Wait for the Thread to Complete at the End of the Current Sequence" setting on the advanced panel of your sequence call step though or your threads will both be waiting for each other and never complete. Also the sequence view of the execution is likely to switch to your asynchrous thread at the end because it will be the last thread running, so if you don't want that you should probably just go with passing a boolean variable instead and leave the setting "Automatically Wait for the Thread to Complete at the End of the Current
    Sequence" checked. Do not ever pass ThisContext from one thread to another though as that is the source of the problems people are having with Run VI Asynchronously.
    Hope this helps,
    -Doug

  • Unexpected error during HTTP request to voucher server The operation timed out

    I read books from my library through a system called READS. I have successfully used DE 1.0 without any problems, however, when I tried to use it recently it required me to upgrade to 1.5. Well I did so and now the books won't authorize. Here is the error message I am getting:
    Adobe DRM Error System: 5 State: 4 Class: 600 Code: 106 Message: Error on request or response from server. Please check your network connection and try again. Scroll below or view error.log for more details.
    Adobe DRM client Error: 706 Unexpected error during HTTP request to voucher server The operation timed out
    Requested URL: http://207.54.136.76/fulfill/ebx.etd?action=lend&orderid=939605378082105&bookid=ContentRe serveID:B91CC494-23AF-4C6A-9B0C-7DA050C05722-50
    Requested URL: http://207.54.136.76/fulfill/ebx.etd ?action=lend &orderid=939605378082105 &bookid=ContentReserveID:B91CC494-23AF-4C6A-9B0C-7DA050C05722-50
    --- end ---
    I have tried this multiple times with more than one book. Again, they worked just fine before I did the upgrade. I am running Vista SP1.

    Never mind, they obviously post the message on the ticket, but it doesn't send an e-mail. I will try what they indicated. Here is their response...
    Thank you for contacting Adobe Technical Support.
    I understand that you are getting "Adobe DRM Error" in Digital Editions.
    We have documented the steps to resolve this error message. Please do
    refer to this TechNote:
    Error: "Adobe DRM Error" when you activate Digital Editions or access an
    eBook
    http://www.adobe.com/go/kb402747

  • Help-- Using GZIPOutputStream, but never end.

    I written serialization object with GZIPOutputStream.
    But recent my Aplication hang 24 hours. I print stack , see the thread is runnable,and lock (0x20fbca10)
    Can any one help me?How the "Deflater.deflateBytes" never end?
    I have two thread.
    thread 1: write serialization object (when receive a message)
    thread 2: close GZip file(when a stop request)
    "RMI TCP Connection(22352)-10.9.146.14" daemon prio=6 tid=0x0792b8d8 nid=0x7b18 runnable [0x4b01d000..0x4b01fa18]
    java.lang.Thread.State: RUNNABLE
         at java.util.zip.Deflater.deflateBytes(Native Method)
         at java.util.zip.Deflater.deflate(Deflater.java:290)
         - locked <0x20fbca10> (a java.util.zip.Deflater)
         at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:159)
         at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:118)
         at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:72)
         - locked <0x1ff90e98> (a java.util.zip.GZIPOutputStream)
         at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
         at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
         - locked <0x1f41f740> (a java.io.BufferedOutputStream)
         at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
    "MessageListenerThread - F_LinkTopic" prio=6 tid=0x05def670 nid=0x16d8 waiting for monitor entry [0x0f90f000..0x0f90fd98]
    java.lang.Thread.State: BLOCKED (on object monitor)
         at java.util.zip.Deflater.deflate(Deflater.java:284)
         - locked <0x20fbca10> (a java.util.zip.Deflater)
         at java.util.zip.GZIPOutputStream.finish(GZIPOutputStream.java:86)
         at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:146)
         at java.io.FilterOutputStream.close(FilterOutputStream.java:143)

    I have seen an almost identical problem within an Apache CXF web service. In my situation the end of the stack looks almost identical, stuck forever (apparently) inside the native Deflater.deflateBytes.
    In my situation I have seen this with two threads, each independently using GZIPOutputStream.
    I am really starting to think that there is a thread safety issue with the native GZIP code - two independent objects in two threads are simultaneously zipping and both get stuck with 100% CPU utilization in the native code. Interestingly my situation is also in the close processing, but not inside the finish processing. Of all the situations I see with searching for similar situations (search the web for Deflater.java:306) there seems to be a set of common circumstances:
    * Exactly the same last few levels on the stack (ending in Deflater.deflateBytes (Native Method)
    * Two threads interacting with GZIP
    * Often seems to relate to close processing (perhaps a short data remainder problem?)
    My situation is documented here:
    http://www.java.net/forum/topic/glassfish/glassfish/glassfish-301-gzip-problem-threads-apparently-spinning-100-cpu-use
    Salient details of thread dump:
    "http-thread-pool-8080-(18)" - Thread t@950
    java.lang.Thread.State: RUNNABLE
    at java.util.zip.Deflater.deflateBytes(Native Method)
    at java.util.zip.Deflater.deflate(Deflater.java:306)
    - locked <21b0c5> (a java.util.zip.ZStreamRef)
    at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:159)
    at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:118)
    at java.util.zip.GZIPOutputStream.write(GZIPOutputStream.java:72)
    - locked <132ba84> (a java.util.zip.GZIPOutputStream)
    at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:46)
    at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69)
    at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:46)
    at org.apache.cxf.io.AbstractThresholdOutputStream.unBuffer(AbstractThresholdOutputStream.java:89)
    at org.apache.cxf.io.AbstractThresholdOutputStream.close(AbstractThresholdOutputStream.java:100)
    at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
    at org.apache.cxf.transport.http.AbstractHTTPDestination$BackChannelConduit.close(AbstractHTTPDestination.java:619)

  • Can CSS route based on cookie info in HTTP request

    Hi
    I am new to CSS and am interested as it might be able to provide a solution to a problem I have seen.
    We currently have 3 Windows Servers running an ASP-based web application with a clustered SQL Server backend. The front end uses windows load balancing to distribute the load. All 3 servers are configured the same and there is only one application.
    The problem lies with the way an the application maintains session state. I am told it uses a non-persistant cookie on the client which corresponds to a session object on the server. This is opposed to maintaining state in central location such as the database. Obviously this means the client needs to be stuck to a particular server for that session. This is currently achieved by setting the Windows NLB to single affinity which places traffic from a particular IP address to the same server. This does work but the clients source IP is changed by a downstream firewall to a NAT overload address meaning all clients appear with the same IP address (different port) and hence always end up on just one server.
    The obvious next step in my mind would be to change the way NAT is done but this is not possible. The next obvious idea would be to change the application so that it maintains state in the database so the affinity of the Windows NLB could be disabled meaning requests would be dealt with using the source IP and port and hence distributed evenly. I am told this cannot be done either :) Joy!
    So I have begain to look at other possible solutions. Apologies for my very limited knowledge on the CSS as I am trying to get my head around how it can be configured. I am thinking that it may be able to help me if I used it instead of Windows NLB. I am interested in the way you can use Layer 5 stickiness. Would it be able to examine the cookie in the HTTP request and route the traffic to the correct server?
    I am aware that this will not alleviate the failover issue. If one of the servers were to fall over then the client would have to login again, however I am under the impression that this is acceptable behaviour. The main driver here is to provide load balancing to improve application performance by using all resources opposed to just one.
    Many many thanks to anyone who can give me advise on this.

    Hi Gilles
    Thanks for the info. Sounds like we are on the right path. Unfortunately I am unable to get much information from the developers. Long story. I did logon to the system whilst doing a network trace. The following is what I found in the HTTP header:
    Hypertext Transfer Protocol
    GET /XXXXX/Includes/style.asp HTTP/1.1\r\n
    Accept: */*\r\n
    Referer:
    http://xxx.xxxxx.xxx/xxxxx/login.asp\r\n
    Accept-Language: en-gb\r\n
    Accept-Encoding: gzip, deflate\r\n
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)\r\n
    Host: xxxx.xxxxx.xxxxx\r\n
    Connection: Keep-Alive\r\n
    Cookie: ASPSESSIONIDQCBCDSCR=AEHBCJEDDGMMCCBHBICLELGD\r\n
    \r\n
    Why do you configure 2 services? How would I go about this given the cookie in the HTTP request?
    Many thanks
    Gary

  • How to send a document in net.HTTP.request as a POST variable?

    I have read and reread the doc on net.HTTP.request, and it says I can pass an argument of oRequest, but I have not succeeded at passing in the current document, which is what I want to do.
    I've tried app.activeDocs[0], or encoding that to a string, but though it makes the call without error, nothing is sent.
    Should oRequest be simply a document, or a variable made up of name-value pairs? How do we send multiple parameters to a POST otherwise?
    I've succeeded fine with calling using GET, but when I tried to pass the document as a GET variable, I got nothing either.
    I'm sending to a LiveCycle REST end point so either POST or GET is fine.
    Thanks!

    POSTing the current document is straightforward *provided* your script is running outside the document context (i.e. in the console or a folder-level script). There's no access from doc-level scripts for obvious reasons.
    For example, putting this in the JS console will POST the current file to a URL:
    Net.HTTP.request({
      cVerb:'POST',
      cURL: 'http://localhost/submit.php',
      oRequest: Collab.documentToStream(this),
      oHandler: {
        response: function (msg, uri, err) {
           if (err!=undefined) app.alert(msg);
    Your problem with talking to a vanilla webservice is that you cannot send the RFC1867 delimeters (i.e. form a "multipart/form-data" request) as the ReadStream object doesn't have a concatenation method in the Acrobat JSAPI. That's also how you would usually prepend other form fields, but if you're careful with your server-side coding you can send those as GET parameters in cURL. Normally you'd be polite and pass a Context-Type header in the aHeaders array - it won't matter to the transmission process but will allow your webservice to predict what the heck it's been sent.
    Your webservice will then have to read the raw data. In PHP for example, you won't get anything in the $_FILES global but you can grab the PDF by reading everything from the input buffer, with the line:
    $pdf = file_get_contents("php://input");
    If that line was in the server script that the above JS code was aimed at, the variable $pdf will contain an exact binary copy of the currently-open document.

  • ORA-29273: HTTP request failed ORA-12535: TNS:operation timed out

    SQL*Plus: Release 11.2.0.3.0
    Solaris 10 SPARC
    Hi,
    I get the following error when trying to make an HTTP request. Below is the snippet of code I run. I get the error after exactly 60 seconds(default timeout?). I searched through the forums and found many similar errors but nothing that helped me resolve this issue. The problem does not exist in the rest of our environments, only our test environment.
    Help is greatly appreciated. Thanks.
    DECLARE
       p_mid_tier    VARCHAR2 (500);
       responsestr   VARCHAR2 (500);
    BEGIN
       SELECT *****
         INTO p_mid_tier
         FROM *****
        WHERE profile_type = '*****';
       UTL_HTTP.set_wallet ('file://$ORACLE_HOME/network/admin/wallets');
       UTL_HTTP.set_transfer_timeout (6000);
       UTL_HTTP.set_response_error_check (TRUE);
       responsestr :=
          UTL_HTTP.request (
             UTL_URL.ESCAPE (p_mid_tier || '*****'));
       DBMS_OUTPUT.put_line (responsestr);
    END;
    ORA-29273: HTTP request failed
    ORA-06512: at "SYS.UTL_HTTP", line 1722
    ORA-12535: TNS:operation timed out
    ORA-06512: at line 15

    1001371 wrote:
    SQL*Plus: Release 11.2.0.3.0
    Solaris 10 SPARC
    Hi,
    I get the following error when trying to make an HTTP request. Below is the snippet of code I run. I get the error after exactly 60 seconds(default timeout?). I searched through the forums and found many similar errors but nothing that helped me resolve this issue. The problem does not exist in the rest of our environments, only our test environment.
    Help is greatly appreciated. Thanks.
    DECLARE 
       p_mid_tier    VARCHAR2 (500); 
       responsestr   VARCHAR2 (500); 
    BEGIN 
       SELECT ***** 
         INTO p_mid_tier 
         FROM ***** 
        WHERE profile_type = '*****'; 
       UTL_HTTP.set_wallet ('file://$ORACLE_HOME/network/admin/wallets'); 
       UTL_HTTP.set_transfer_timeout (6000); 
       UTL_HTTP.set_response_error_check (TRUE); 
       responsestr := 
          UTL_HTTP.request ( 
             UTL_URL.ESCAPE (p_mid_tier || '*****')); 
       DBMS_OUTPUT.put_line (responsestr); 
    END; 
    ORA-29273: HTTP request failed
    ORA-06512: at "SYS.UTL_HTTP", line 1722
    ORA-12535: TNS:operation timed out
    ORA-06512: at line 15
    the most frequent cause for TIMEOUT is a FireWall on or between client & server.
    when was last time this worked without error?
    what changed since then?

  • Firefox aborts its http request silently within 60 seconds

    duplicate of [/questions/1047223]
    *Summary
    Firefox aborts its http request within almost 60 seconds(period till
    timeout varies) and tells nothing to users. This happened with both of
    Nginx and Apache.
    *Environment
    Client browser: Firefox 35.0.1
    Client OS: Windows 7 Enterprise 32bit SP1
    Web Server: Apache 2.2.3-91 & Nginx 1.6.2-1
    Server OS: CentOS 5.11
    PHP: 5.3.3
    FastCGI: spawn-fcgi-1.6.3-1
    *Description of the issue
    I have noticed that nginx logs http response code 499 so often.
    We use nginx almost only for two web applications, the one based on PHP
    and others on ruby. We experiences this problem in both apps. The server and client PC belong to the same subnet.
    Since last month, nginx logged 624 errors for Firefox and 16 for other
    browsers(almost IE).
    So for test, I wrote the simple PHP (see the bottom of this article) and tried to access it
    through both of Apache & Nginx with Firefox 35.0.1 and IE 11. IE11
    waited 120 seconds and returned html successfully through both of nginx
    and Apache, but Firefox failed either.
    Let me describe Firefox's behaviour.
    1. Enter the test php url at location bar and press enter.
    2. The message 'waiting server response' appears at status bar for a while.
    3. Watching network conversation through Wireshark, 'Keep Alive' signals
    are repeated some times between server and client, and after that,
    4. The message dissappears. 'FIN' signal is sent to the server from the client just after that. Firebug logs 'Aborted' at the almost the same time.
    5. The server responses 'FIN ACK.'
    There is a bit difference with nginx and Apache in behaviour after 'FIN
    ACK'.
    A.Nginx
    Nginx logs '499' error and finish conversation immediately.
    B.Apache doesn't log anthying at this step. After 120 seconds(sleep timer
    in PHP) from request it returns expected html. Of course Firefox don't render it but I could confirm both of request and response from Wireshark's 'Follow TCP Stream' function. Finally it is logged with http status code 200 at httpd log file.
    I repeated this test several times. Actual timeout period varies from 22
    to 70 seconds but results are same.
    With my understanding, the browser is expected to show 'time out error'
    after such situation but it doesn't show anything. So end user can't
    know what happend.
    *What I tried to solve the problem
    *disabled all extentions other than firebug.
    *set 'network.tcp.keepalive.enabled' to false at about:config.
    *set 'network.http.spdy.enabled' to false, too.
    *set 'network.http.response.timeout' to 0.
    *disabled IPV6 and DNS prefetch seeing the following help.
    https://support.mozilla.org/en-US/kb/websites-dont-load-troubleshoot-and-fix-errors
    *changed Timeout to 0 at apche's http.conf.
    My purpose is make our web apps to work properly in our working environment. I've recommended Firefox to our collegues because it was very cool application. Changing the default brawser is nightmare to me. Any suggestions are welcome.
    <test php>
    <?php sleep(120); ?>
    <?php echo time(); ?>

    duplicate of [/questions/1047223]
    *Summary
    Firefox aborts its http request within almost 60 seconds(period till
    timeout varies) and tells nothing to users. This happened with both of
    Nginx and Apache.
    *Environment
    Client browser: Firefox 35.0.1
    Client OS: Windows 7 Enterprise 32bit SP1
    Web Server: Apache 2.2.3-91 & Nginx 1.6.2-1
    Server OS: CentOS 5.11
    PHP: 5.3.3
    FastCGI: spawn-fcgi-1.6.3-1
    *Description of the issue
    I have noticed that nginx logs http response code 499 so often.
    We use nginx almost only for two web applications, the one based on PHP
    and others on ruby. We experiences this problem in both apps. The server and client PC belong to the same subnet.
    Since last month, nginx logged 624 errors for Firefox and 16 for other
    browsers(almost IE).
    So for test, I wrote the simple PHP (see the bottom of this article) and tried to access it
    through both of Apache & Nginx with Firefox 35.0.1 and IE 11. IE11
    waited 120 seconds and returned html successfully through both of nginx
    and Apache, but Firefox failed either.
    Let me describe Firefox's behaviour.
    1. Enter the test php url at location bar and press enter.
    2. The message 'waiting server response' appears at status bar for a while.
    3. Watching network conversation through Wireshark, 'Keep Alive' signals
    are repeated some times between server and client, and after that,
    4. The message dissappears. 'FIN' signal is sent to the server from the client just after that. Firebug logs 'Aborted' at the almost the same time.
    5. The server responses 'FIN ACK.'
    There is a bit difference with nginx and Apache in behaviour after 'FIN
    ACK'.
    A.Nginx
    Nginx logs '499' error and finish conversation immediately.
    B.Apache doesn't log anthying at this step. After 120 seconds(sleep timer
    in PHP) from request it returns expected html. Of course Firefox don't render it but I could confirm both of request and response from Wireshark's 'Follow TCP Stream' function. Finally it is logged with http status code 200 at httpd log file.
    I repeated this test several times. Actual timeout period varies from 22
    to 70 seconds but results are same.
    With my understanding, the browser is expected to show 'time out error'
    after such situation but it doesn't show anything. So end user can't
    know what happend.
    *What I tried to solve the problem
    *disabled all extentions other than firebug.
    *set 'network.tcp.keepalive.enabled' to false at about:config.
    *set 'network.http.spdy.enabled' to false, too.
    *set 'network.http.response.timeout' to 0.
    *disabled IPV6 and DNS prefetch seeing the following help.
    https://support.mozilla.org/en-US/kb/websites-dont-load-troubleshoot-and-fix-errors
    *changed Timeout to 0 at apche's http.conf.
    My purpose is make our web apps to work properly in our working environment. I've recommended Firefox to our collegues because it was very cool application. Changing the default brawser is nightmare to me. Any suggestions are welcome.
    <test php>
    <?php sleep(120); ?>
    <?php echo time(); ?>

  • Embedded "multipart/encrypted" HTTP Request?

    Hi,
    I am using 'httpclient.jar'. I am able to successfully send a normal HTTPRequest and receive the response using the 'MultipartRequestEntity' class.
    Now, I need to send an Embedded HTTP Request as mentioned below. Kindly suggest how can I send an Embedded HTTPRequest and how do I set the 'RequestHeader' to change the 'Content Type' to "multipart/encrypted".
    POST /RecipientServer/mailbox HTTP/1.1
    Date: Tue, 20 Dec 2000 08:12:31 GMT
    Connection: Keep-Alive
    Host: www.ontarioRecipientServer.com
    Content-Language: en, fr
    Content-Type: multipart/form-data; boundary=EBTpart;
    Content-Length: 3222
    --EBTpart
    Content-Disposition: form-data; name=”sender”
    12345678
    --EBTpart
    Content-Disposition: form-data; name=”user_id”
    aUser
    --EBTpart
    Content-Disposition: form-data; name=”user_password”
    aPassword
    --EBTpart
    Content-Disposition: form-data; name=”request_type”
    Upload
    --EBTpart
    Content-Disposition: form-data; name=”ebt_document”; filename=”transaction.xml”
    Content-Type: application/octet-stream
    MIME-Version: 1.0
    Content-Type: multipart/encrypted; boundary=”=--”;
    protocol="application/pgp-encrypted"
    --=--
    Content-Type: pgp-encrypted
    Version: 1
    --=--
    Content-Type: application/octet-stream
    -----BEGIN PGP MESSAGE-----
    Version: 2.6.2
    hIwDY32hYGCE8MkBA/wOu7d45aUxF4Q0RKJprD3v5Z9K1YcRJ2fve87lMlDlx4OjeW4GDdBfLbJE7VUpp13N19GL8e/AqbyyjHH4aS0YoTk10QQ9nnRvjY8nZL3MPXSZg9VGQxFeGqzykzmykU6A26MSMexR4ApeeON6xzZWfo+0yOqAq6lb46wsvldZ96YA AABH78hyX7YX4uT1tNCWEIIBoqqvCeIMpp7UQ2IzBrXg6GtukS8NxbukLeamqVW31yt21DYOjuLzcMNe/JNsD9vDVCvOOG3OCi8=
    =zzaA
    -----END PGP MESSAGE-----
    --=----
    EBTpart

    Hi,
    I am using 'httpclient.jar'. I am able to successfully send a normal HTTPRequest and receive the response using the 'MultipartRequestEntity' class.
    Now, I need to send an Embedded HTTP Request as mentioned below. Kindly suggest how can I send an Embedded HTTPRequest and how do I set the 'RequestHeader' to change the 'Content Type' to "multipart/encrypted".
    POST /RecipientServer/mailbox HTTP/1.1
    Date: Tue, 20 Dec 2000 08:12:31 GMT
    Connection: Keep-Alive
    Host: www.ontarioRecipientServer.com
    Content-Language: en, fr
    Content-Type: multipart/form-data; boundary=EBTpart;
    Content-Length: 3222
    --EBTpart
    Content-Disposition: form-data; name=”sender”
    12345678
    --EBTpart
    Content-Disposition: form-data; name=”user_id”
    aUser
    --EBTpart
    Content-Disposition: form-data; name=”user_password”
    aPassword
    --EBTpart
    Content-Disposition: form-data; name=”request_type”
    Upload
    --EBTpart
    Content-Disposition: form-data; name=”ebt_document”; filename=”transaction.xml”
    Content-Type: application/octet-stream
    MIME-Version: 1.0
    Content-Type: multipart/encrypted; boundary=”=--”;
    protocol="application/pgp-encrypted"
    --=--
    Content-Type: pgp-encrypted
    Version: 1
    --=--
    Content-Type: application/octet-stream
    -----BEGIN PGP MESSAGE-----
    Version: 2.6.2
    hIwDY32hYGCE8MkBA/wOu7d45aUxF4Q0RKJprD3v5Z9K1YcRJ2fve87lMlDlx4OjeW4GDdBfLbJE7VUpp13N19GL8e/AqbyyjHH4aS0YoTk10QQ9nnRvjY8nZL3MPXSZg9VGQxFeGqzykzmykU6A26MSMexR4ApeeON6xzZWfo+0yOqAq6lb46wsvldZ96YA AABH78hyX7YX4uT1tNCWEIIBoqqvCeIMpp7UQ2IzBrXg6GtukS8NxbukLeamqVW31yt21DYOjuLzcMNe/JNsD9vDVCvOOG3OCi8=
    =zzaA
    -----END PGP MESSAGE-----
    --=----
    EBTpart

  • Autoscaling Application block for Azure worker role console app not working. Get error as The HTTP request was forbidden with client authentication

    I have written a console application to test the WASABi(AutoScaling Application Block) for my worker role running in azure. The worker role processes the messages in the queue and I want to scale-up based on the queue length. I have configured and set the
    constraints and reactive rules properly. I get the following error when I run this application.
    [BEGIN DATA]{}
        DateTime=2013-12-11T21:30:02.5731267Z
    Autoscaling General Verbose: 1002 : Rule match.
    [BEGIN DATA]{"EvaluationId":"4f9f7cb0-fc0d-4276-826f-b6a5f3ea6801","MatchingRules":[{"RuleName":"default","RuleDescription":"The default constraint rule","Targets":["AutoscalingWebRole","AutoscalingWorkerRole"]},{"RuleName":"ScaleUpOnHighWebRole","RuleDescription":"Scale
    up the web role","Targets":[]},{"RuleName":"ScaleDownOnLowWebRole","RuleDescription":"Scale down the web role","Targets":[]},{"RuleName":"ScaleUpOnHighWorkerRole","RuleDescription":"Scale
    up the worker role","Targets":[]},{"RuleName":"ScaleDownOnLowWorkerRole","RuleDescription":"Scale down the worker role","Targets":[]},{"RuleName":"ScaleUpOnQueueMessages","RuleDescription":"Scale
    up the web role","Targets":[]},{"RuleName":"ScaleDownOnQueueMessages","RuleDescription":"Scale down the web role","Targets":[]}]}
        DateTime=2013-12-11T21:31:03.7516260Z
    Autoscaling General Warning: 1004 : Undefined target.
    [BEGIN DATA]{"EvaluationId":"4f9f7cb0-fc0d-4276-826f-b6a5f3ea6801","TargetName":"AutoscalingWebRole"}
        DateTime=2013-12-11T21:31:03.7516260Z
    Autoscaling Updates Verbose: 3001 : The current deployment configuration for a hosted service is about to be checked to determine if a change is required (for role scaling or changes to settings).
    [BEGIN DATA]{"EvaluationId":"4f9f7cb0-fc0d-4276-826f-b6a5f3ea6801","HostedServiceDetails":{"Subscription":"psicloud","HostedService":"rmsazure","DeploymentSlot":"Staging"},"ScaleRequests":{"AutoscalingWorkerRole":{"Min":1,"Max":2,"AbsoluteDelta":0,"RelativeDelta":0,"MatchingRules":"default"}},"SettingChangeRequests":{}}
        DateTime=2013-12-11T21:31:03.7516260Z
    Autoscaling Updates Error: 3010 : Microsoft.Practices.EnterpriseLibrary.WindowsAzure.Autoscaling.ServiceManagement.ServiceManagementClientException: The service configuration could not be retrieved from Windows Azure for hosted service with DNS prefix 'rmsazure'
    in subscription id 'af1e96ad-43aa-4d05-b3f1-0c9d752e6cbb' and deployment slot 'Staging'. ---> System.ServiceModel.Security.MessageSecurityException: The HTTP request was forbidden with client authentication scheme 'Anonymous'. ---> System.Net.WebException:
    The remote server returned an error: (403) Forbidden.
       at System.Net.HttpWebRequest.GetResponse()
       at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
       --- End of inner exception stack trace ---
    Server stack trace: 
       at System.ServiceModel.Channels.HttpChannelUtilities.ValidateAuthentication(HttpWebRequest request, HttpWebResponse response, WebException responseException, HttpChannelFactory`1 factory)
       at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
       at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
       at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
       at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
       at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
       at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
    If anyone know why I am getting this anonymous access violation error. My webrole is secured site but worker role not.
    I appreciate any help.
    Thanks,
    ravi
      

    Hello,
    >>: The service configuration could not be retrieved from Windows Azure for hosted service with DNS prefix 'rmsazure' in subscription id **************
    Base on error message, I guess your azure service didn't get your certificate and other instances didn't have certificate to auto scale. Please check your upload the certificate on your portal management. Also, you could refer to same thread via link(
    http://stackoverflow.com/questions/12843401/azure-autoscaling-block-cannot-find-certificate ).
    Hope it helps.
    Any question or result, please let me know.
    Thanks
    Regards,
    Will 
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • No response returned for the http request

    My application is running on Weblogic 10 in a clustered environment. The UI is a developed in Eclipse RCP.
    I have a problem where a particular request never returns from the server to the desktop.
    This can be reproduced only in Beta environment and does not happen in Development, Integration or System Test Environment.
    I tried thread dumps but there was no thread waiting for this request.
    I tried http monitor tool but I am unable to find the cause and solution for this.
    Can someone please help me to understand in which situation would this happen and what must be done to overcome this?
    Thanks
    Bala

    Thanks for replying.
    yes, we have put in the logger messages.
    The desktop calls Struts2 Action class and the server does recieves the request, processes it (contacts a 3rd party system), recieves the response from the 3rd party system and then persists the necessary information to the database.
    After this we have logs to print which Action class took how much time. That also gets printed successfully.
    For this process the server took 275 seconds (this is the most time consuming task in the whole app) . After printing this there is no response returned from the server to the desktop.
    There are no exceptions and errors.
    The fact which is most disturbing is that this is not re-creatable in any other environments (dev, IT,ST) and only in BETA. Though all are clustered environments.
    Please help me trace the response. I am ready to implement any ideas. But I want to reach to the root cause. As this is in BETA I am unable to remote debug as well :-((
    Thanks
    Bala

  • How to send POST HTTP Request through PI .

    Hi ,
    I am trying to send a XML mesage at HTTP server from SAP PI 7.1 .
    but not able to , reason is HTTP guy telling me is that ,i am sending a get request through SAP PI 7.1 and it should be POST.
    Where to change this this thing , so that only post request should go.
    There is one more thing , i am facing following request only in Quality . In Development request is going as Post and every thing running fine ...
    Regards
    PS

    It was always HTTP from our end , some config was missing at HTTP guys end , which solve the problem ..
    So there was no issue at PI end.

  • How best to make a transaction span multiple HTTP requests?

    Hi, all. What is the best way to implement a transaction that spans multiple
    HTTP requests? Many J2EE applications must solve this problem, but I can't
    any guidelines for an implementation.
    Consider an application that implements a multi-step wizard. Each step
    gathers data from the user; step one gets the user's name, and step two gets
    his dog's name. When the user completes the wizard, the application saves
    the user & dog in two entity beans. Conceptually, the application treats
    this wizard like a single, long-running transaction. The transaction begins
    when the user launches the wizard. Submitting the JSP for step one adds the
    Boy bean to the transaction, and submitting step two adds the Dog bean.
    Finishing the wizard commits the transaction. Exiting the wizard or timing
    out causes the transaction to rollback.
    Although the wizard looks like a transaction, the entire sequence of user
    interactions can't be captured in a single JTA UserTransaction. A
    UserTransaction must be associated with a single thread, but each wizard
    step is handled asynchronously by its own execution thread. It's impossible
    to funnel the conversation through one thread that can demarcate the
    transaction. (This would be a pretty dumb solution for other reasons, but I
    don't want to get lost in details.)
    I think the standard way to solve this problem is to store conversation
    state in a stateful session bean (or the http session) and create / update
    both entity beans in a transactional EJB method after the wizard completes.
    Unfortunately, this solution prevents me from leveraging a lot of great
    transaction management features provided by the app server. For example, I
    can't use optimistic concurrency to make sure that the dog object hasn't
    changed in the database between the start and end of the wizard. Also, I'm
    forced to keep track of changes to the dog object in the conversation state,
    then replicate these changes to an entity bean at the end of the wizard.
    Keeping track of state in a stateful bean is pretty straightforward, but it
    seems like there must be an existing solution that leverages the appserver's
    concurrency and state management features. Am I missing something? Is there
    code, a pattern, or an article that describes the best way to implement a
    multi-step process that looks transactional? I suppose WLI does what I want,
    but that feels like killing a roach with a SCUD missle. Thanks for any
    advice.
    Dave

    Dave Smith wrote:
    Without a transaction, will the app server manage the version column
    automatically, assuming of course that <concurrency-strategy> is
    "Optimistic" and <verify-columns> is set to "Version"? Of course, I'll have
    to expose the version as a cmp-field, which is fine with me.Yes
    >
    Do you know offhand, so that I don't have to get off my lazy ass and write a
    test, whether the CMP service will create the version column when it
    generates db tables? (I realize it's not good to let WLS generate the tables
    in a production system.)No, I don't think it does.
    >
    I assume from your answer that I'm on my own for implementing stuff like and
    transaction inheritance and tracking object modifications? Well, we'll give you a bit of help on the object modifications. The
    usual pattern is when you're pushing the JavaBean back to the CMP you
    call all the setXXX methods on the CMP bean. Our CMP container will
    check if the value you are setting is the same as read from the db. If
    so, it will not update that column.
    -- Rob
    If so, no big
    deal. I was just hoping somebody would say, "Oh, you want the Jakarta
    SuperBeans project" or something.
    Thanks,
    Dave
    "Rob Woollen" <[email protected]> wrote in message
    news:[email protected]...
    I'd recommend that you include a separate version or timestamp column in
    your db schema.
    Then do something like this:
    Client Server
    1) First HTTP Request
    2) Read current Dog and Boy Entity Beans
    (if any) and copy their values into a JavaBean.
    You want to include the version
    column(s) in the JavaBean(s) along with the data values.
    You probably also want to store the JavaBeans in
    your HTTP Session.
    3) Client proceeds through wizard interacting with JavaBeans
    4) Finish with Wizard, copy JavaBean values (including
    version columns) to CMP 2.0 Entity Beans.
    The version column will give you the optimistic concurrency protection
    that you desire without opening a JTA transaction to span user input.
    -- Rob
    Dave Smith wrote:
    Hi, all. What is the best way to implement a transaction that spans
    multiple
    HTTP requests? Many J2EE applications must solve this problem, but Ican't
    any guidelines for an implementation.
    Consider an application that implements a multi-step wizard. Each step
    gathers data from the user; step one gets the user's name, and step twogets
    his dog's name. When the user completes the wizard, the applicationsaves
    the user & dog in two entity beans. Conceptually, the application treats
    this wizard like a single, long-running transaction. The transactionbegins
    when the user launches the wizard. Submitting the JSP for step one addsthe
    Boy bean to the transaction, and submitting step two adds the Dog bean.
    Finishing the wizard commits the transaction. Exiting the wizard ortiming
    out causes the transaction to rollback.
    Although the wizard looks like a transaction, the entire sequence ofuser
    interactions can't be captured in a single JTA UserTransaction. A
    UserTransaction must be associated with a single thread, but each wizard
    step is handled asynchronously by its own execution thread. It'simpossible
    to funnel the conversation through one thread that can demarcate the
    transaction. (This would be a pretty dumb solution for other reasons,but I
    don't want to get lost in details.)
    I think the standard way to solve this problem is to store conversation
    state in a stateful session bean (or the http session) and create /update
    both entity beans in a transactional EJB method after the wizardcompletes.
    Unfortunately, this solution prevents me from leveraging a lot of great
    transaction management features provided by the app server. For example,I
    can't use optimistic concurrency to make sure that the dog object hasn't
    changed in the database between the start and end of the wizard. Also,I'm
    forced to keep track of changes to the dog object in the conversationstate,
    then replicate these changes to an entity bean at the end of the wizard.
    Keeping track of state in a stateful bean is pretty straightforward, butit
    seems like there must be an existing solution that leverages theappserver's
    concurrency and state management features. Am I missing something? Isthere
    code, a pattern, or an article that describes the best way to implementa
    multi-step process that looks transactional? I suppose WLI does what Iwant,
    but that feels like killing a roach with a SCUD missle. Thanks for any
    advice.
    Dave

Maybe you are looking for