Sending response back to client

The result of a request is in the format of inputStream before sending back to client... I used to use getPrinter() method to write my output back to the client... so how can I write the output from the inputStream back to the client without reading the data from the inputstream then writing them to the PrintWriter object??
Thanks...

Actually I miss-stated one point.. the result should be in Output stream format...
eg. the cleint makes a request to servlet A, then A asks class B to get the result and B writes the result to an output stream and return the stream back to servlet A...
now servlet A has the result in the format of Output stream..... so how can servlet A get the data from the output stream (as output stream only has write methods) and sends them back to the client?

Similar Messages

  • Sending response back

    Hi
    I’m getting message from source system (MQ) for   which I need to validate the header details and mandatory field information in XI, if success then send to SAP system through proxy otherwise send the response back to MQ system with batch number or some mandatory fields missing information.
    Client not agrees to send this information through alert want to send response to MQ system only.
    Please suggest good design option for sending response back. Can we achive this through acknowledgement or how? Please provide suggestive document on the approach suggesting would be grateful
    Thanks,
    Srini

    Hi,
    See you can use two target messages , in mapping , handle the condition and route the message , in determination use interface mapping.
    see the below links also
    /people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping
    https://media.sdn.sap.com/javadocs/NW04/SPS15/pi/com/sap/aii/mapping/api/DynamicConfiguration.html
    Regards
    Chilla

  • Sending response back to RFC in UDF

    Hi All,
    I have a Sync scenario from RFC to SOAP. I want to check the line items in RFC request. If there are no line items , then i want to stop the scenario and use UDF to send the constant (Invalid line items based on validations) back to RFC responce by using RFC lookup.
    Is it possible to send response back to RFC in UDF?
    Please suggest me, i want to handle exceptions without BPM.
    Thanks and regards
    Uma

    hi,
    >>Is it possible to send response back to RFC in UDF?
    I don't think such an option exists in standard
    but maybe you can do the check in the RFC much faster instead os checking
    this in XI ?
    Regards,
    Michal Krawczyk

  • Any way to combine multiple incoming streams and send it back to clients?

    I am trying to make a server that receives HUNDREDS of incoming audio streams and then combines them into one stream and send it back to all clients- like audio conferencing. Is it possible to combine those streams together into a single one and send it to the receiving ends? I read on some topics in the forum and there really doesnt seem to be any answers.
    Also, if its not possible to combine those streams then is the next "best" alternative be having the server send all the audio streams from everyone to everyone? Its going to take a lot of resources doing that i think... any ideas? Thanks!

    hi bgl. I read that thread and its a litle bit hard to follow. it seems that you managed to grab Bytes of the incoming audio stream and continuing grabing them in a loop. I guess you use the player to play the Bytes? I also dont really see how i can mix all the Bytes together from lets say 10 users. Can you show me an example of it? Like making an incoming stream into Bytes and playing it. I assume it would have the same effect as playing the stream using a player? thanks

  • Sync-Sync Scenario.. To Send Response back to Sender.

    Hi All,
    I got a scenario to send the data to BI through proxy and get the response back to PI and pass it to sender system.
    Request:
    Store system Sync call(Soap)>PI->Sync call(ABAP proxy)>BI
    Response:
    BI(response to Sync call)>PI>Store system.
    The response has to go back to sender system with in few seconds. So I need to priotirize this scenario separately in both Integration and Adapter engine. This scenario should not collide with any other scenarios as the response has to deliver ASAP.
    Can we acheive this? Is there any better method to deal with this kind of scenario in terms of performance? Kindly suggest your ideas.
    Thanks
    Deepthi

    i conused why are you using BPM for this, any way SOAP adapter,ABAP proxy supports sync calls . dont required BPM.
    Yes. Now I decided to go without BPM.  I'm getting the below error from the proxy. Any idea about this error?
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Inbound Message
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIProxy</SAP:Category>
      <SAP:Code area="ABAP">DYNAMIC_CALL_FAILURE</SAP:Code>
      <SAP:P1>UNCAUGHT_EXCEPTION</SAP:P1>
      <SAP:P2>ZPI_CL_MI_BAPI_SYNC1</SAP:P2>
      <SAP:P3>EXECUTE_SYNCHRONOUS</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Error during proxy processing An exception with the type CX_SY_DYN_CALL_PARAM_NOT_FOUND occurred, but was neither handled locally, nor declared in a RAISING clause Call of the function BAPI_COMPANY_GETDETAIL failed; the formal parameter COMPANY_DETAIL does not exist</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>

  • Sending response to java Client

    Hi everyone,
    I am trying to make a java client that is solely used for the login verification, and if the user is granted access the server return a jnlp file as a response. For this I have use a JEditorPane that loads a existing html mask with a form. My questin is :
    How could I send this response to java client so that I can process it and give it to webstart as a parameter.
    How can I capture the events occuring on elements inside the HTML form.
    waiting for any kind of help :)
    Nikhil

    this subforum is about Kerberos and GSS and not about NTLM. Why are you hasseling with NTLM? Take Kerberos.

  • How to send response back to db adapter

    Hi,
    I have a requirement where I need to update a status field and last activity time field ( time of instance completed) in a database table. I used Polling option in database adapter, but it is updating the status field immediately once it is read. I don't want like that, I want to update the status field after completion of instance. Also, how to update the last activity time field ( i mean the field has to update at what time the instance got completed successfully). Actually, i am using
    1. A database adapter for polling followed by receive activity, assign activity, invoke activity and this invoke activity invokes one more database adapter ( the adapter selects a table row with the ID given by database adapter 1).
    2. Followed by transform activity, and again a invoke activity which invokes a webservice ( I am passing output values of 2nd database adapter as a input to webservice).
    Let me explain clearly, I have a base table and duplicate table. When ever values gets inserted or updated in base table it needs to be reflected in duplicate table ( wrote a trigger for this and it is working fine). Apart from this I added two more fields in duplicate table ( with column names status, and instance completion time). I am using two database adapters one is for polling from duplicate table and other one for selection of values from base table based on ID provided by duplicate table. Further, the invoke activity receives the output from database adapter and again i am passing the output values as a input to external webservice. My question is how can I update the status field and instance completion time in duplicate table. Someone please help me.
    Thanks,

    Hi,
    If I understand your requirement, you have few options:
    1.     Build your process in a way that it will act as a synch process. That way you will have the option to rollback the transactions
    and allow to poll the table again.
    (see explanation: Re: Reading 5K records from DB
    2.     You can go with your solution. Create a table that acts only as a trigger table.
    If something happens in you process and you want to poll from it again, just insert new record in it, in the end of the process.
    Arik

  • Post response back to html page

    How to send response back to html page which sent request to my jsp page.
    please reply me b'coz I have sent two problems already,but there is no response for any of them.
    Please reply as soon as possible.
    --Thanks in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Yes I know all these implicit objects,but all these are in JSP.
    I want reply from JSP in HTML means at client side.
    See my steps:
    1.creating HTML page.
    2.creating form in that html page
    3.Then Accessing Database(some data which is required at client side for further processing like mapping in Google map) through JSP
    So here how do I get data from JSP page.
    help me with code if u can?
    thanks

  • Can I get a response back when I use HTTP adapter

    Hi ,
    I am doing a integration between SAP and ThirdParty Product using PI 7.1.
    The scenario is ThirdParty -> PI -> SAP ,using HTTP adapter between ThirdParty and PI , and IDoc adapter between SAP and PI.
    So,its a HTTP sender and IDoc receiver.
    So I was just curious to know if the IDoc posting failed in SAP ,can I send a response from SAP to Thirdparty regarding the failure along with some error message.
    Thanks for your responses.
    Venu

    Hi,
         It may lead to some timeout problems if you design your scenario as synchronous i.e sending response back to HTTP..
    as SAP may take time to process idoc and need to provide response back to PI ..by that time the connection may become invalid and thirdparty may receive response as timeout error...
    As anyway PI has the option of Alert managements..you can trigger the error mail to the third party recipients for letting them the status...
    HTH
    Rajesh

  • Webservice to proxy - response back to webservice

    Hello expert,
    I am working on webservice to proxy scenario. When request to create purchase order received by PI thru webservice, PI will do proxy call to create purchase order in ECC and send response back.
    We don't want to send ECC response back to Webservice, but we would like to send positive response back as soon as PI recieve the message irrespective of what happens in ECC.
    Need some advise.
    thanks.

    >We don't want to send ECC response back to Webservice, but we would like to send positive response back as soon as PI recieve the message irrespective of what happens in ECC.
    One way of doing is after sending request to ecc, you can code in proxy as response in the same interface with single field element like mesg receiveed and map that response to soap response on the sender side. (in this case you dont really process the soap request in ecc directly. you do it at later or convenient time or after sending success transfer message).  Basically you handle logic in abap proxy side.
    Mapping 1 soap request to proxy request (Per business requirement)
    Mapping 2  proxy response (status : messg received ) to soap response
    Rest are all same. Basically you do SOAP (sender) to PRoxy (receiver)   synchronous mode
    If you dont want to pass the soap request message directly to ECC and within that timeframe want to send successful mesg from pI itself then you have to design to store the mesg temporarily. What will happen if your ecc is down? How do you handle that situation.

  • UDF to send Response to RFC

    Hi Experts,
    We have a scenario where we have to send a response back to RFC from UDF .
    How can we do this without using RFC lookups ?
    Regards,
    Syed

    Hi,
    I think UDF don't have nature to send response back to RFC meanwhile RFC request and response are different mapping windows, better to go for RFC lookup, we can fulfill your requirement easily.

  • In OUT Bound of a Jaxws provider, how can we stop the provider invoking its endpoint and send a response back?

    Hi One & All
    While we are working on Delegate(provider) for JAXWS client handler in Weblogic10 , we have some technical issues and need some assistance.
    Problem Description
    In OUTBound of a provider, how can we stop the provider invoking its endpoint and send a response back?
    Example:
    I have a provider with some handlers configured for both IN and OUT flows. When the Jaxws provider is making a request, the OUTBound Handler gets invoked and in this Handler I would like to stop invoking actual endpoint and send back my own response. That means I should be able to tell the Handler chain to stop further processing of this flow, set a response message into message exchange and invoke the IN flow. How do I do that?
    This kind of mediation/interception is possible in standard specifications like JAX-WS, Servlets etc… wondering if Weblogic10 JAXWS provides any sort of this kind.
    Also we would like to know who is invoking a provider endpo     int in JAXWS stack in weblogic10? Is it an OUTBound handler at the end of handler chain or some other transport component after the handler chain?
    Thanks in Advance
    Suresh
    Edited by: user12494412 on Jan 22, 2010 7:06 AM

    I completely agree with this....I have used Windows and Skype for many years. I recently installed an older version of Skype to run on Windows 8.1 because the new version is SO AWFUL. As much as I prefer the older version (6.14), the daily number of SPAM CONTACT requests is rediculous and most are just variations of the same spammer. Maybe it is time to look for a replacement for both?

  • HELP plz..How to send response from server to client

    Hi..plz help me out of this problem..i am sending request from client side to servlet..lets say i am sendin "Bechkam"..now my servlet fetches this request.n finds out that BECHKAM is a football player..now i dont want to print this on the client side..i simply want to sent this response back to the client..after client receives this response the client should print bechkam is a football player..i have done coding of sending request from client(javascript code)to server but dont kno how to send response to client..do i have to use cookies or sessions..
    Any help will be greatly appreciated
    THANX

    I'm not sure how well versed you're with HTTP and servlets.
    What you term as 'printing on the client side' is in fact the response you're looking for. The response you send from a servlet is 'printed' into the response stream. The client receives this data and interprets is according to some headers. Usually, this data is HTML/ plain text which is interpreted by the browser and rendered as required. It could very well be displayed as is.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • Java Server/Client Applicaton - problem with sending data back

    Hello!
    I'm trying to write a small server/client chat application in Java. It's server with availability to accept connections from many clients and it's app just for fun... However, I've come up against a huge problem: everything what clients send, arrives to server (I'm sure about that because it is displayed on the Server Application screen) and then server should send it back to all clients but it doesn't work. I have no faintest idea what causes this problem. Maybe you can help me?
    Here is my server app code:
    import java.net.*;
    import java.util.*;
    import java.io.*;
    * @author Robin
    public class Server {
        ServerSocket serw = null;
        Socket socket = null;
        String line = null;
        Vector<ClientThread> Watki = new Vector();
        ClientThread watek = null;
        public Server(int port) {
            try {
                serw = new ServerSocket(port);           
                line = "";
                while(true) {
                    System.out.println("Running. Waiting for client to connect...");
                    socket = serw.accept();
                    System.out.println("Connected with:\n" + socket.getInetAddress() + "\n");
                    watek = new ClientThread(socket);
                    Watki.addElement(watek);
                    Watki.firstElement().Send("doszlo?");
            }catch (IOException e) {
                System.out.println("BLAD: " + e);
        public void sendToAll(String s) {
            for(int i = 0; i < Watki.size(); i++) {
                Watki.elementAt(i).Send(s);
        public class ClientThread extends Thread {
            Socket socket;
            DataInputStream in = null;
            DataOutputStream out = null;
            String line = null;
            public ClientThread(Socket s) {
                try {
                    this.socket = s;
                    in = new DataInputStream(s.getInputStream());
                    out = new DataOutputStream(s.getOutputStream());
                    start();
                }catch (IOException e) {
                    System.out.println("BLAD: " + e);
            public void Send(String s) {
                try {
                    out.writeUTF(s);
                }catch (IOException e) {
                    System.out.println("BLAD: " + e);
            public void run() {
                try {
                    line = "";
                    while (true) {
                        line = in.readUTF();
                        System.out.println(line);
                        sendToAll(line);
                }catch (IOException e) {
                    System.out.println("BLAD: " + e);
        public static void main(String[] args) {
            Server serwer = new Server(5000);
    }And here is client app code:
    import java.net.*;
    import java.util.*;
    import java.io.*;
    * @author Robin
    public class Client implements Runnable {
        Socket socket = null;
        BufferedReader keyIn = new BufferedReader(new InputStreamReader(System.in));
        DataInputStream in = null;
        DataOutputStream out = null;
        String line = null;
        public Client(String host, int port) {
            try {
                System.out.println("Connecting to " + host + ":" + port);
                socket = new Socket(host, port);
                System.out.println("Connected\nTALK:");
                out = new DataOutputStream(socket.getOutputStream());
                in = new DataInputStream(socket.getInputStream());
                line = "";
                while(!line.toLowerCase().equals(".bye")) {
                    line = keyIn.readLine();
                    Send(line);
            }catch (UnknownHostException e) {
                System.out.println("BLAD: " + e);
            }catch (IOException e) {
                System.out.println("BLAD: " + e);
        public void Send(String s) {
            try {
                out.writeUTF(s);
            }catch (IOException e) {
                System.out.println("BLAD: " + e);
        public void run() {
            String loaded = "";
            try {
                while(true) {
                    loaded = in.readUTF();
                    System.out.println(loaded);
            }catch (IOException e) {
                System.out.println("BLAD: " + e);
        public static void main(String[] args) {
            Client client = new Client("localhost", 5000);
    }By the way, this app is mainly written in English language (text that appears on the screen) however in functions I used Polish language (for example: BLAD - it means ERROR in English). Sorry for that :)

    Yeap, I will change those exceptions later, thanks for advice.
    You asked what's going on with it: both applications start with no errors, but when I write something in client side it should be sent to the server and then forwarded to all connected clients but it stops somewhere. However, I added a one line to the server code
    line = in.readUTF();
    System.out.println(line);
    sendToAll(line); and after it reads message from client (no matter which one) it shows that message on the server side screen, then it should send this message to all clients but it doesn't work in this moment. What's confusing: no errors occurs, so it's rather a mistake in my code, but where?
    Edited by: Robin3D on Sep 30, 2009 9:07 AM

  • Sending xml file from client to servlet

    Hi,
    I am writing the server component of an applcation, such that it will receive xml files from the clients(standalone application similar to javaSwing stuff but it's coded in C#), and the servlet will have to extract the data from the xml file and update the mySql database. it will also fulfill the client's request for xmlFiles (and extract data from DB, format to xml file and send back to client)
    I'm new to implementing the servlet receiving files from clients so would need some help.
    I've got 3 questions to ask:
    1) How does the servlet receive/returns the xml file from the client as a series of httpPost request/response. Do i send a File or the file's contents as a String to/from the client?
    2) Is it also a must to use socket for the file transfers? I have read in other posts about sockets as well as HttpURLConnection but i don't quite understand.
    3) When I send a file back to the client(client is standalone application written in C# whereas server is coded in java), what do i specify for the HttpResponse.setContentType() in my servlet? (i'm returning the xml file to client)
    Would really appreciate for any help rendered. If you have any useful links, would appreciate them too. Thanks a lot.
    Karen

    I've got 3 questions to ask:
    1) How does the servlet receive/returns the xml file
    from the client as a series of httpPost
    request/response. Do i send a File or the file's
    contents as a String to/from the client?The server will listen on some port for requests. The client has to open a socket to this server to send the file as string to the server.
    see http://java.sun.com/docs/books/tutorial/networking/index.html
    >
    2) Is it also a must to use socket for the file
    transfers? I have read in other posts about sockets as
    well as HttpURLConnection but i don't quite
    understand.You use HttpURLConnection to make a request using the http protocol, instead of opening a socket and then writing the html headers yourself.
    3) When I send a file back to the client(client is
    standalone application written in C# whereas server is
    coded in java), what do i specify for the
    HttpResponse.setContentType() in my servlet? (i'm
    returning the xml file to client)Its up to your receiving program how to interpret this though, so you probably dont need this.

Maybe you are looking for