Help: question on send XML file from java client to java server

Hi, I am now to Java, and now I am going to set up a simple network in the lab.
I have created a random array of data and transferred to XML file on my client. Now, I would like to send it to the server. I am wondering how I can put the XML file into my client, and do I need any parser to let the server show what random date it has received?
Anybody can give me any idea or some basic code? Thank you.
Now, I am referring the KnockKnock example in Java online tutorial. But, not clear how to deal with the XML File.
Fengyuan

There are several ways you can achieve this: one could be that you transfer data over HTTP, using Servlets for instance. Have a Servlet listening on the Server with content type 'text/xml', POST the XML data to the server and have the Servlet to receive the data and re-compose the XML file. This can be achieved with different libraries:
1) JAXB --> this is good because is the JDK standard, also for web services
2) Castor (http://www.castor.org/)

Similar Messages

  • 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.

  • How to refresh XML file  from my client machine

    Hai All
    I have temp.XML and temp.XSL template in our server machine.
    when i give a print from client machine first time it gives the record,and next time it did not get refresh.Always it shows the previous records in the browser.But when i go into the server machine and click on temp.xml,it shows the current record(correct records)
    How to refresh XML file  from my client machine?
    Regards
    Dhina

    You never delete a Time Machine backup by dragging it to the Trash. You are supposed to use the TM application to manage the backups. What you will need to do now is to simply erase the drive using Disk Utility.

  • Send xml file from sap to third party url through https

    Hi,
    I have a requirement to send the xml file from ecc to a 3rd party url through HTTPS. How can we achieve this using ABAP.
    Client doesn't have XI enviroment. The client has provided the 3rd party url where the file needs to be uploaded.
    Please help ! <removed by moderator>
    Thanks in advance.
    Regards,
    Chitra.K
    Edited by: Thomas Zloch on Sep 12, 2011 12:58 PM

    Hi Chitra,
    I had similar requirement and here is what I did: -
    REPORT  Z_HTTP_POST_TEST_AMEY.
    DATA: L_URL               TYPE                   STRING          ,
          L_PARAMS_STRING     TYPE                   STRING          ,
          L_HTTP_CLIENT       TYPE REF TO            IF_HTTP_CLIENT  ,
          L_RESULT            TYPE                   STRING          ,
          L_STATUS_TEXT       TYPE                   STRING          ,
          L_HTTP_STATUS_CODE  TYPE                   I               ,
          L_HTTP_LENGTH       TYPE                   I               ,
          L_PARAMS_XSTRING    TYPE                   XSTRING         ,
          L_XSTRING           TYPE                   XSTRING         ,
          L_IS_XML_TABLE      TYPE STANDARD TABLE OF SMUM_XMLTB      ,
          L_IS_RETURN         TYPE STANDARD TABLE OF BAPIRET2        ,
          L_OUT_TAB           TYPE STANDARD TABLE OF TBL1024
    MOVE 'https://<hostname>/xxx/yyy/zzz' TO L_URL.
    MOVE '<XML as string>' TO L_PARAMS_STRING.
    *STEP-1 : CREATE HTTP CLIENT
    CALL METHOD CL_HTTP_CLIENT=>CREATE_BY_URL
        EXPORTING
          URL                = L_URL
        IMPORTING
          CLIENT             = L_HTTP_CLIENT
        EXCEPTIONS
          ARGUMENT_NOT_FOUND = 1
          PLUGIN_NOT_ACTIVE  = 2
          INTERNAL_ERROR     = 3
          OTHERS             = 4 .
    "STEP-2 :  AUTHENTICATE HTTP CLIENT
    CALL METHOD L_HTTP_CLIENT->AUTHENTICATE
      EXPORTING
        USERNAME             = 'testUser'
        PASSWORD             = 'testPassword'.
    "STEP-3 :  SET HTTP HEADERS
    CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
          EXPORTING NAME  = 'Accept'
                    VALUE = 'text/xml'.
    CALL METHOD L_HTTP_CLIENT->REQUEST->SET_HEADER_FIELD
        EXPORTING NAME  = '~request_method'
                   VALUE = 'POST' .
    CALL METHOD L_HTTP_CLIENT->REQUEST->SET_CONTENT_TYPE
        EXPORTING CONTENT_TYPE  = 'text/xml' .
    "SETTING REQUEST DATA FOR 'POST' METHOD
    IF L_PARAMS_STRING IS NOT INITIAL.
       CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
         EXPORTING
             TEXT   = L_PARAMS_STRING
         IMPORTING
               BUFFER = L_PARAMS_XSTRING
         EXCEPTIONS
            FAILED = 1
            OTHERS = 2.
    CALL METHOD L_HTTP_CLIENT->REQUEST->SET_DATA
        EXPORTING DATA  = L_PARAMS_XSTRING  .
    ENDIF.
    "STEP-4 :  SEND HTTP REQUEST
      CALL METHOD L_HTTP_CLIENT->SEND
        EXCEPTIONS
          HTTP_COMMUNICATION_FAILURE = 1
          HTTP_INVALID_STATE         = 2.
    "STEP-5 :  GET HTTP RESPONSE
        CALL METHOD L_HTTP_CLIENT->RECEIVE
          EXCEPTIONS
            HTTP_COMMUNICATION_FAILURE = 1
            HTTP_INVALID_STATE         = 2
            HTTP_PROCESSING_FAILED     = 3.
    "STEP-6 : Read HTTP RETURN CODE
    CALL METHOD L_HTTP_CLIENT->RESPONSE->GET_STATUS
        IMPORTING
          CODE = L_HTTP_STATUS_CODE
          REASON = L_STATUS_TEXT  .
    WRITE: / 'HTTP_STATUS_CODE = ',
              L_HTTP_STATUS_CODE,
             / 'STATUS_TEXT = ',
             L_STATUS_TEXT .
    "STEP-7 :  READ RESPONSE DATA
    CALL METHOD L_HTTP_CLIENT->RESPONSE->GET_CDATA
            RECEIVING DATA = L_RESULT .
    "STEP-8 : CLOSE CONNECTION
    CALL METHOD L_HTTP_CLIENT->CLOSE
      EXCEPTIONS
        HTTP_INVALID_STATE = 1
        OTHERS             = 2   .
    "STEP-9 : PRINT OUTPUT TO FILE
    CLEAR : L_XSTRING, L_OUT_TAB[].
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          TEXT   = L_RESULT
        IMPORTING
          BUFFER = L_XSTRING
        EXCEPTIONS
          FAILED = 1
          OTHERS = 2.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        BUFFER                = L_XSTRING
      TABLES
        BINARY_TAB            = L_OUT_TAB .
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
       FILENAME                        = 'C:AMEYHTTP_POST_OUTPUT.xml'
      TABLES
        DATA_TAB                        = L_OUT_TAB .
    Also, following is the detailed link for use of HTTP_CLIENT class: -
    http://help.sap.com/saphelp_nw70ehp1/helpdata/EN/1f/93163f9959a808e10000000a114084/content.htm
    Also, in below link, you can ignore XI specific part and observe how its sending XML to external URL:-
    (I know it describes call to SAP XI server's URL, but it can be used to call any URL)
    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/ae388f45-0901-0010-0f99-a76d785e3ccc
    In addition to all above, following configs to be present at ABAP application server: -
    1. The hostname used to URL should be present in SAP ABAP application server's 'hosts' file.
    2. Security certificate (if available) for URL to be called must be installed in SAP ABAP application server.
    Let me know if you achieve any progress with it...

  • Can someone help me export a XML file from my project file?

    hey guys,
    I need someone to help me if possible, i was working at school with final cut pro and forgot to export it in xml format and only saved it in final cut pro format... i need to work on this at home and i have a pc.. because there are no lab hours and its due tommorrow, if anyone can help that would be great, thanks!!
    Winston

    i believe it was final cut pro 5, and i have premiere pro cs4 and it says itll read any xml file from final cut pro.
    if anyone wants to help me... here is my fcp file
    http://rapidshare.com/files/208267210/abstract.fcp.html
    you can just email me back the xml file to [email protected]
    i really appreciate it if someone can help me out!!
    Message was edited by: WinstonWong

  • How to send xml file from local folder to azure storage

    Hi,
    My plan is i have xml files which are under folders in my local.
    I want to use mobile service to send xml files to azure storage,
    how shall i do that, either by c# or mobile service.
    If internet stop, I will use my mobile service to transfer all xml files to azure storage and run web job to do to update azure
    sql by xml file.
    please advice.
    Superman

    Hi,
    You could refer the following link for assistance with uploading image files to Azure Blob Storage using Mobile Services:
    http://azure.microsoft.com/en-us/documentation/articles/mobile-services-windows-phone-upload-data-blob-storage/
    And for image files you could refer the following link:
    http://stackoverflow.com/questions/25977406/upload-a-text-file-with-azure-mobile-services
    Regards,
    Malar.

  • How to upload file from a client machine to server machine

    hei evryone!
    can anyone pls help me on how i can upload file from a client machine to another machine (or server). using jsp.Then later on, i can also retrieve the names of these files to place it as values for option tag in an html form.I have a seperate screen for uploading the file and the screen for displaying all the files that were uploaded on the server...
    any sample code/ ideas would be much appreciated.Thx!!!!

    hei evryone!
    can anyone pls help me on how i can upload file from a client machine to another machine (or server). using jsp.Then later on, i can also retrieve the names of these files to place it as values for option tag in an html form.I have a seperate screen for uploading the file and the screen for displaying all the files that were uploaded on the server...
    any sample code/ ideas would be much appreciated.Thx!!!!

  • Please help..question about sending pdf file from my ipad to another

    I have a pdf file in Kindle that shows up under documents. I am wanting to locate it and send it from my ipad to another..whether through email or even share through kindle. I contacted kindle and they said I have to contact apple with instructions to retreiving the pdf before I can send it. Anyone know how to do it. It shows up in docs on my kindle app but doesnt show up in itunes or on amazon. Help appreciated!!!!

    I copied this from another discussion - that ironically enough - James and I both participated in. The OP never responded to what I suggested, but I think that this may work.
    I think that the Kindle app uses file sharing so see if you can transfer the files to the computer via iTunes with file sharing.
    iOS: About File Sharing
    Then drag the pdf file from the file sharing window (or use the save to button) onto your desktop. Email it from there and you can even email it to yourself on the iPad and store it any other other PDF app that you may have.

  • [b]Urgent How to send XML file from forms 6.0 to a url to access database[/

    hi
    i need to create an XML with some values file from Oracle Forms 6.0 and then send this XML file To a URL to access the database,which in turn will send me XML file with new values.Can any body help me out as i don't have any ideas
    Regards
    Sunil

    Sunil,
    and this must be using a URL and can't be handled by a database stored procedure ?
    Anyway, your scenario can be achieved using teh Java Importer in Forms 6i and above. You woudl write a Java program that takes a String and loads it to an URL. It then checks the response URL for its content.
    Frank

  • Sending XML file from SAP to Windows Based file server with FTP function

    Hi Gurus,
    We are using SAP BW 3.0B version.
    I need to convert data in ODS to XML format and send this XML file to remote server which  is not a SAP application server, it is just a Window Based file server with FTP function..
    By writing some ABAP code I have converted ODS data into XML format (which gets saved in my local system)
    (Is that I need to put this file in Application Server to send it to the other servers? )
    Now the thing is how I can send this file to that Windows Based file server.
    plz suggest me.... what can be done......
    Thanks in Advance
    Madhusudhan
    Edited by: Madhusudhan Raju on Dec 3, 2009 4:25 AM

    I dont think the above code support windows OS. Because I always execute this script via UNIX.
    I think you can try this option, go to command prompt, goto the destination path where you have an XML file using cd....
    ftp (destination servername), specify the username and password.
    afterthat, use the command put and filename.
    check whether the file had reached destination successfully or not.
    For automation purpose, you can use the following script like
    ftp: -s: test.txt  (servername)
    In test.txt,
    UserName
    Password
    bin
    cd /files
    put file.xml
    bye
    Also, you can check in SM69, there will be some SAP external commands to automate the file transfer.
    Thanks
    Sat
    http://support.microsoft.com/?kbid=96269

  • Uploading Multiple Files from web client to web server

    Am using a Digitally signed applet to pickup files from a specific directory and only to pickup those of a specific type. Applet is called by a HTML converted page and uses the JAVA 1.3.1 plug-in. Client side is ok, but the server side does not work - cannot see how to drop the files down onto the web server.
    code
    URL url = null ;
    FileInputStream filReader = null ;
    DataOutputStream dosOutfile = null ;
    HttpURLConnection httpUrlConn = null ;
    int bytes = 0 ;
    //read local file on client's hd with signed applet
    try
    filReader = new FileInputStream( new File( fromFile ) );
    catch ( java.io.FileNotFoundException eNotFound )
    DisplayStatus ( fromFile + " Not found");
    eNotFound.printStackTrace();
    // start setup to server-side copy of in file
    try
    url = new URL ( toFile ) ;
    catch ( java.net.MalformedURLException eMalFormedUrl )
    DisplayStatus ( url + " url mal formed");
    eMalFormedUrl.printStackTrace();
    // create a HttpUrl connection for POSTING
    try
    httpUrlConn = (HttpURLConnection) url.openConnection(); // do not remove this casting, as needed
    catch ( java.io.IOException eIoException )
    DisplayStatus ( url + " IO not possible");
    eIoException.printStackTrace();
    // set preferences
    httpUrlConn.setDoInput(true); // default value, but best make sure
    httpUrlConn.setDoOutput(true); // default value, but best make sure
    httpUrlConn.setUseCaches(false); // enable write straight through
    try
    httpUrlConn.setRequestMethod("POST") ;
    // httpUrlConn.setRequestMethod("PUT") ;
    } catch ( java.net.ProtocolException eProtEx )
    DisplayStatus ( "Protocol Exception on setting up POST") ;
    eProtEx.printStackTrace();
    httpUrlConn.setRequestProperty("Content-Type", "multipart/form-data");
    // permissions?
    try
    java.security.Permission permission = httpUrlConn.getPermission() ;
    if ( iDebug == true )
    DisplayStatus ("Permission = " + permission.toString() ) ;
    DisplayStatus ( "Actions = " + permission.getActions() ) ;
    DisplayStatus ( "Name = " + permission.getName() ) ;
    catch ( java.io.IOException eUrlIOConnException )
    DisplayStatus ( "httpUrl " + httpUrlConn + " IO not possible");
    DisplayStatus ( eUrlIOConnException.toString() ) ;
    eUrlIOConnException.printStackTrace();
    // connect
    try
    this.VerifyHttpResponseCode ( httpUrlConn.getResponseCode() ) ;
    DisplayStatus ("About to connect") ;
    httpUrlConn.connect() ;
    DisplayStatus ("Connected") ;
    if ( iDebug == true )
    DisplayStatus ("Connected Content Encoding = " + httpUrlConn.getContentEncoding() ) ;
    DisplayStatus ("Connected Content Length = " + httpUrlConn.getContentLength() ) ;
    DisplayStatus ("Connected Content Type = " + httpUrlConn.getContentType() ) ;
    DisplayStatus ("Connected default allow user interaction = " + httpUrlConn.getDefaultAllowUserInteraction() ) ;
    DisplayStatus ("Connected File Map = " + httpUrlConn.getFileNameMap() ) ;
    DisplayStatus ("Connected request method = " + httpUrlConn.getRequestMethod() ) ;
    DisplayStatus ("Connected response code = " + httpUrlConn.getResponseCode() ) ;
    DisplayStatus ("Connected response message = " + httpUrlConn.getResponseMessage() ) ;
    DisplayStatus ("Connected = " + httpUrlConn.getURL() ) ;
    } // end of debug print out status
    catch ( java.net.ConnectException eConnEx )
    this.DisplayStatus ( "Connection error - no server listening or incorrect port " ) ;
    this.DisplayStatus ( "Connection error - http = " + httpUrlConn) ;
    eConnEx.printStackTrace();
    catch ( java.io.IOException eUrlConnException )
    DisplayStatus ( "url " + url + " connection not possible");
    DisplayStatus ( eUrlConnException.toString() ) ;
    eUrlConnException.printStackTrace();
    // create file on server
    try
    dosOutfile = new DataOutputStream ( new BufferedOutputStream( httpUrlConn.getOutputStream () ) ) ;
    catch ( java.io.IOException eNewFileIO )
    DisplayStatus ("Unable to create file on server / buffer output stream " + toFile ) ;
    // copy files char by char for the moment, till testing complete
    try
    bytes = filReader.read();
    while(bytes != -1)
    dosOutfile.writeByte(bytes);
    bytes = filReader.read();
    // close both files
    dosOutfile.flush ();
    dosOutfile.close ();
    filReader.close();
    catch (java.io.IOException eCpyIo )
    DisplayStatus ("Error copying files") ;
    connection of the HttpURLConnection
    gives 'Fobbiden' response for 'PUT'
    and
    'method not allowed' for 'POST'
    trying to create the file on the server than causes IOException at the create DataStream line
    What am I doing wrong?
    Is this philosphy correct?
    Should the HttpURLConnection be to the target folder
    and then create the file in it?

    hello,
    first here is my interpretation of your prob.
    You have a client.From this client you are trying to upload files onto a server.
    Finding the files and reading them on the client side is not a prob. The prob is storing them on the server side.
    right?
    If the above stated prob is right, here is a solution.
    1. You have to first inform the server that you are sending the file. Unless you do so the server will not understand when you have started sending the file.
    So, initially, the applet which you have written need to communicate with a servlet on the server side.
    This can be done using reqs.. .get or post.In the req itself you can even send the name of the folder wherein you want to store the file you are going to transfer later on.
    Next, after receiving the folder name, the servlet can now understand that next file data is going to be received.
    The applet now sends the file which is received by the servlet and stored appropriately.
    You need to explicitly write a servlet to receive a data into the file and then store the file into appropriate folder.
    for any further probs email me at [email protected]

  • Moving .csv file from windows(client) to linux server

    Hi All,
    I have a .csv file in "D:\Datafiles\Test.csv". I need to move this file to server top "$XXLS_TOP/admin/import/US/" using shell scripting.
    Server : XYZ
    Login : test_user
    Password : password
    Can anyone help me on this.I am new to shell scripting..
    thanks

    Hi,
    As already mentioned above, you have 2 major options:
    1.samba (lots of docs on the net)
    2. ftp (even more docs on the net)
    If you decide to use ftp, then here's a starting point:
    -install ftp server on your Win machine-
    -you can use lftp , which has the ability to read a set of commands from a file
    For instance:
    [kido@kido ~]$ pwd
    /home/kido
    [kido@kido ~]$ ls
    cacti_backup.tar.gz                    Desktop     ftp       j2re-1_4_1_02-solaris-sparc.sh  out   test
    cacti_data_query_ucdnet_device_io.xml  diskio.tar  help.txt  net-snmp_devio.xml              perl
    [kido@kido ~]$ cd ftp
    [kido@kido ftp]$ ls
    ftpscript
    [kido@kido ftp]$ cat ftpscript
    open localhost -u kido,123kido$
    ls
    get help.txt
    bye
    [kido@kido ftp]$ lftp -f ftpscript
    drwxrwxrwx    2 501      501          4096 Feb 25  2009 Desktop
    -rw-r--r--    1 501      501      13137873 Mar 30 19:54 cacti_backup.tar.gz
    -rw-rw-r--    1 500      500         34216 Feb 03  2007 cacti_data_query_ucdnet_device_io.xml
    -rw-r--r--    1 501      501          4950 Apr 07 08:46 diskio.tar
    drwxrwxr-x    2 501      501          4096 Sep 08 15:53 ftp
    -rw-rw-r--    1 501      501           144 Jul 30 19:27 help.txt
    -rw-r--r--    1 501      501      23023830 May 27 14:17 j2re-1_4_1_02-solaris-sparc.sh
    -rw-rw-r--    1 500      500          2568 Aug 18  2005 net-snmp_devio.xml
    -rw-rw-r--    1 501      501          8093 Aug 05 15:21 out
    drwxrwxr-x    2 501      501          4096 Jun 16 15:38 perl
    drwxrwxr-x    2 501      501          4096 Sep 02 13:10 test
    [kido@kido ftp]$ ls
    ftpscript  help.txt
    [kido@kido ftp]$ You can modify ftpscript and put any commands you need. Then you can run "lftp -f ftpscript" from cron (for instance). For more details: man lftp.
    kido

  • How to send a file from FTP to external server

    My requirement is to send a file from FTP to D3(External) server.
    Now I am able to store the file in Appln server.
    I want to send the file created by the program thru FTP to D3 server.
    I know the username,Password,HostID,RFC destination details.
    How to send the file from FTP to D3.
    If u have any program,Plz send it...
    I dont want the function modules name...I want the example code ....
    Thanks in advance.

    Hi Sumi,
    You could do it so that you create a .bat or .cmd script to your server which does your ftp transfer.
    To do this you must use sm69 to create a external operating system command which you can call from FM SXPG_COMMAND_EXECUTE. To SXPG_COMMAND_EXECUTE you the file you need to transfer as a parameter.
    What happens is that your abap program passes the file to windows batch script (.bat .cmd) which will then do the transfer for you.
    Here's a sample of ftp-script for windows:
    echo open IP_ADDRESS_TO_YOUR_SERVER > c:zftp_transfer.ftp
    echo USERNAME>> c:zftp_transfer.ftp
    echo PASSWORD>> c:zftp_transfer.ftp
    echo put YOUR_FILE>> c:zftp_transfer.ftp
    echo quit>> c:zftp_transfer.ftp
    ftp -s:c:zftp_transfer.ftp
    also take a look here for more details:
    http://support.microsoft.com/?kbid=96269
    Ok, this might be a bit trivial but if your server is unix/aix etc.. Instead of using batch script you must do a shell script.
    Regards,
    Ville

  • How to transfer file from one client to another client?

    hello,
    i have some questions and hope you all can help me..thanks a lot first..
    Here are the questions:
    i) How can i send a file from one client to another client using RMI?
    ii) Does the client(sender) need to send the file to server, then server save it and then send it to another client(receiver)?
    iii) If using RMI, a client can receive two files from same client(sender) or different client(sender) at a same time? how to do it? when both of the files come in from same port, how to differenciate them?
    iv) For your information, i am doing the File Transfer Server-client application which sender can send any file to other client. Can you give me any ideas? thanks..
    Last, thanks again..

    Your questions reflect some ambiguity in terms.
    "Client" and "server" are commonly used in two different senses:
    1. Technical sense: A client process makes requests, and a server process fulfills the request (provides a service).
    2. IT sense: A client computer (process) makes requests of a server (computer) process, and the server (computer) processes the request.
    In the first case, any computer might be a client, or a server, or both, depending on the processes being executed. In the second case, the computers are assigned some role.
    So: If you wanted to, you could implement client/server processes communicating between two peer computers, using RMI.
    This may not be what you wanted; if you really want to distinguish client and server computers, then the answer is that yes, you will probably put files into intermediate storage on the server computer.
    Finally, you probably do not have to worry about port conflicts if you use RMI; while the initial client server contact is established through a registry operating on a standard port, the actual RMI communications is established using random ports, one for each link.

  • Sending a certificate form the client to the server... how to ?

    how can I send a certificate from the client to the server trough a Java code ??

    Short answer: You specify a keyStore.
    Either via command line using the -Djavax.net.ssl.keyStore=keystorefile property,
    or in Java code:
    char[] passphrase = "password".toCharArray();
    SSLContext ctx = SSLContext.getInstance("TLS", "SunJSSE");
    // KeyStore for the SSL client certificate
    KeyStore keyStore = KeyStore.getInstance("PKCS12");
    keyStore.load(new FileInputStream("client-cert.p12"), passphrase);
    KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509", "SunJSSE");
    keyManagerFactory.init(keyStore, passphrase);
    // keyStore for trusted server certs or CAs
    KeyStore trustedKeyStore = KeyStore.getInstance("JKS");
    trustedKeyStore.load(new FileInputStream("verisign-test-cert"), passphrase);
    TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance("SunX509", "SunJSSE");
    trustManagerFactory.init(trustedKeyStore);
    ctx.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), null);
    SSLSocketFactory sslSocketFactory = ctx.getSocketFactory();
    HttpsURLConnection.setDefaultSSLSocketFactory(sslSocketFactory);
    // open the http connection to the party
    myConn = (HttpsURLConnection)myURL.openConnection();

Maybe you are looking for