• Operational Research Web Services
    • LIMOS 2012 : Webservices' Development
    • LOGO LIMOS

    •    Homepage   
    •    Svg2Png   
    •    Job shop   
    •    GPS for pedestrian   
    •    Job shop time lags   
    •    VRP   
    •    Community-based GPS    
    •    Bin packing    
    •    NFC android    
    •    Sudoku PPC    
  • Tranform svg2png   |   Try it   |   Team (contact)   |   Active link JAVA   |   Active link C#   |   Descriptions

    • Web services to transform SVG to PNG 
    • Limitations:
                 The maximum number of client with the same IP adress is 8.
                 The maximum number of file for each client is 12.
                 The maximum time your files are saved in the server is 10 minutes
                 (it means that if you do not get your file back in time, your file will be delete).
    • Try it now !  

    • This web service is temporarily unavailable until July 8th 2016, if you need earlier an access you can contact Maxime Chassaing at this address: maxime.chassaing[@]gmail[dot]com
      Click on the button "Launch the demo" to try the web service :



    •  
      • Demostration of the Web Service SVG2PNG
    • Dream team's members  
    • photo de Pierre
      Pierre

      Email : villeche@poste.isima.fr
      ISIMA student
      Blaise Pascal University
      1 Rue de la Chebarde, 63178 Aubière CEDEX
    • photo de maxime
      Maxime

      Email : maxime63@free.fr
      Polytech'Clermont Ferrand student
      Blaise Pascal University
      1 Rue de la Chebarde, 63178 Aubière CEDEX
     
    • Java implementation of the web service
     

    • Java Web Service link :

    • This web service is temporarily unavailable until July 8th 2016, if you need an earlier access you can contact Maxime Chassaing at this address: maxime.chassaing[@]gmail[dot]com
      http://orws2.isima.fr:80/WebServiceRO/WebServiceROSoap?WSDL


    • Example of client in java using the web services (C# & J2EE) :
    •  
      Download Java client

    • Web Service :
    • Download Java Web Service

    • How to create a client in Java :
    • Download tutorial
    • Example of Java Program using the web service (plateform independant)
     


    • Start the programme using : java -jar WebServiceClient.rar


      Executable jar file available here : Download
      photo_creation

     
    • C# implementation of the web service


    • Web Service link :


    • This web service is temporarily unavailable until July 8th 2016, if you need earlier an access you can contact Maxime Chassaing at this address: maxime.chassaing[@]gmail[dot]com
      http://orws.isima.fr/WebServiceRO/WebServiceROSoap?WSDL


    • Example of client in C# using the web services (C# & J2EE) :
    •  
      Download C# client

    • Web Service :
    • Download C# Web Service

    • How to create a client in C# :
    • Download tutorial
     
    • How to create a C# client in 5 minutes ?

    • Start Visual Studio and create a new Windows form application
      photo_creation

      Take one minute to achieve a main window which could be similar to the next window :
      photo_creation

      Since we have to use a web service for file transformation from svg to png, the data flow between your client program and the server could exceed the maximal size assign to the project by Visual Studio. If you expect some trouble with the following code, please edit the file app.conf and examine the value maxBufferSize... and so on as stressed in the following example.
      photo_creation

      Add to the projet a reference to the web service. Use for example the following address :

      This web service is temporarily unavailable until July 8th 2016, if you need earlier an access you can contact Maxime Chassaing at this address: maxime.chassaing[@]gmail[dot]com
      http://orws.isima.fr/WebServiceRO/WebServiceROSoap?WSDL

      which is the C# web service.
      photo_creation

      The code C# implementation is divided into 5 steps :

      Step 1
      Create a reference to the Soap server :

      	ServiceReference1.WebServiceROSoapClient client = new ServiceReference1.WebServiceROSoapClient();
      


      Step 2
      Read a svg file and transform it into a array of byte. Note we assume the file is euro.svg.

      	string filename = "c:\\euro.svg";
      	FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
      	int taille = (int)fs.Length;
      	byte[] ImageData = new byte[fs.Length];
      	fs.Read(ImageData, 0, (int)fs.Length);
      	fs.Close();
      



      Step 3
      Upload the file to the server and start the transformation... Let us note, the procedure send a secret_key which is the identification of the job.

      	string secret_key = client.startThread_SVGtoPNG(ImageData, ref codeErreur, ref erreur);
      


      Step 4
      Check if the transformation into a png file is achieved. The file availability is checked every 5 seconds. Note we check the availability using the secret_key of the file previously uploaded. The step 4 is finished when the file is available (response==1)

      	    int response;  // ==0 in progress but not finished, ==1 finished, ==-1 error 
      	    do
      	    {
      		System.Threading.Thread.Sleep(5000);
      		response = client.isCompleteThread(secret_key, ref codeErreur, ref erreur);
      	    } while (response == 0);
      

      Step 5
      First download the file using the methode readResult and second transform the array of byte into a file on the disk.

      	    byte[] dataResult = new byte[100000];
      	    dataResult = client.readResult(secret_key, ref codeErreur, ref erreur);
      	    string fileName2 = "c:\\fichier_recu.png";
      	    FileStream fileStream2 = new FileStream(fileName2, FileMode.Create);
      	    fileStream2.Write(dataResult, 0, dataResult.Length);
      	    fileStream2.Close();
      

      The full code to manage the clic on the button


              private void button1_Click(object sender, EventArgs e)
              {
      
                  int codeErreur = 0;
                  string erreur = "";
      
                  try
                  {
      
                      ServiceReference1.WebServiceROSoapClient client = new ServiceReference1.WebServiceROSoapClient();
      
                      // http://openclipart.org/
      
      
                      // part 1 : Submit a  file
                      // -----------------------
                      // read a file on SVG format
                      // and transform it into an array of bytes
                      string filename = "c:\\euro.svg";
                      FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);
                      int taille = (int)fs.Length;
                      byte[] ImageData = new byte[fs.Length];
                      fs.Read(ImageData, 0, (int)fs.Length);
      
                      fs.Close();
      
                      // upload the file on the server and required transformation
                      string secret_key = client.startThread_SVGtoPNG(ImageData, ref codeErreur, ref erreur);
                      // test if the 
                      
                      if (codeErreur == 0)
                      {
                          // part 2 : check if job finished
                          // ------------------------------
                          // the submission is OK
                          // we must wait until server has achieved the job
                          int response;  // ==0 in progress but not finished, ==1 finished, ==-1 error 
                          do
                          {
                              System.Threading.Thread.Sleep(5000);
                              response = client.isCompleteThread(secret_key, ref codeErreur, ref erreur);
                          } while (response == 0);
      
                          // part 3 : read the file into the format png
                          // ------------------------------------------
      
                          byte[] dataResult = new byte[100000];
                          dataResult = client.readResult(secret_key, ref codeErreur, ref erreur);
                          string fileName2 = "c:\\fichier_recu.png";
                          FileStream fileStream2 = new FileStream(fileName2, FileMode.Create);
                          fileStream2.Write(dataResult, 0, dataResult.Length);
                          fileStream2.Close();
                      }
                      else 
                          richTextBox1.AppendText("Submission result : " + erreur);
      
                      richTextBox1.AppendText("job ended \n");
      
                  }
                  catch (Exception E)
                  {
                    richTextBox1.AppendText("erreur : "+ E.ToString());
                    richTextBox1.AppendText(codeErreur.ToString());
                  }
      
              }
          }
      


      Source code available here : Download


     
    • How to create a Java client in 5 minutes ?

    • Start Netbeans and create a new Java application
      photo_creation

      Take one minute to achieve a main window which could be similar to the next window :
      photo_creation

      Add to the projet a reference to the web service. Use for example the following address :
      This web service is temporarily unavailable until July 8th 2016, if you need an earlier access you can contact Maxime Chassaing at this address: maxime.chassaing[@]gmail[dot]com
      http://orws2.isima.fr:80/WebServiceRO/WebServiceROSoap?WSDL

      The web service reference must be visible now in the project.
      photo_creation

      which is the Java web service.
      photo_creation

      The code Java implementation is divided into 5 steps :

      Step 1
      Create a reference to the Soap server :

              webservices.WebServiceRO client = new webservices.WebServiceRO();
              webservices.WebServiceROSoap portJava;
              portJava = client.getWebServiceROSoapPort();
      


      Step 2
      Read a svg file and transform it into a array of byte. Note we assume the file is euro.svg.

              File filename  = new File("c:\\euro.svg");
              InputStream fs = new FileInputStream(filename );
              int taille = fs.available();
              byte[] ImageData  = new byte[taille];
              fs.read(ImageData);
              fs.close();
      



      Step 3
      Upload the file to the server and start the transformation... Let us note, the procedure send a secret_key which is the identification of the job.

              javax.xml.ws.Holder‹java.lang.Integer› error = new javax.xml.ws.Holder‹java.lang.Integer› ();
              javax.xml.ws.Holder‹java.lang.String› stringError = new javax.xml.ws.Holder‹java.lang.String› ();
              String secret_key;
      
              secret_key = portJava.startThreadSVGtoPNG(ImageData,error,stringError);
      	
      


      Step 4
      Check if the transformation into a png file is achieved. The file availability is checked every 5 seconds. Note we check the availability using the secret_key of the file previously uploaded. The step 4 is finished when the file is available (response==1)

              int response;  // ==0 in progress but not finished, ==1 finished, ==-1 error
              do
              {
                  Thread.sleep(5000);
                  response = portJava.isCompleteThread(secret_key, error, stringError);
              } while (response == 0);
      

      Step 5
      First download the file using the methode readResult and second transform the array of byte into a file on the disk.

              byte[] res = null;
              res = portJava.readResult(secret_key, error, stringError);
              String fileName2 = "c:\\fichier_recu.png";
              File imagefile = new File(fileName2);
              FileOutputStream fileStream2 = new FileOutputStream(imagefile,false);
              fileStream2.write(res);
              fileStream2.close();
      


      Source code available here : Download


    • Description 
    • This is the list of the avalaible functions on both web services, if you have no idea of how to use them, you can download the client codes and go here.

    • Function 1 :  [string id] startThread_SVGtoPNG ( byte[] inputfile, ref int error, ref string stringError);
      description : 
      output :
      string id : it's very important to remenber this id, because without it you can't received your png file
      input :
      byte [] input : the .SVG file you want to convert into the .PNG picture format, take care it's a byte array and not a stream or another File format
      int error : in this integer there is a number which correspond to an error
      string stringError : this string contains an explanation of the error
    • Error code :
      "0"   : Execution ok
      "-1" : Server Busy, too many clients
      "-2" : Too many files in progress for the same time and the same IP 
      "-3" : The byte array is null (in other words : the byte array is a null pointer)
    • Function 2 :  [int Result] IsCompleteThread ( string id, ref int error, ref string stringError);
      output :
      int Result : an integer which tell you if the convertion is finished or not
      input :
      string id : the id obtained after calling the first function
      int error : in this integer there is a number which correspond to an error
      string stringError : this string contains an explanation of the error
    • Error code :
      "0"   : Execution in progress but not finished yet
      "1"   : Execution finished : you can call the next function (ReadResult) to get your png file back
      "-1" :   Id unknow
    • Function 3:  [byte[] file] ReadResult ( string id, ref int error, ref string stringError);
      output :
      byte[] file : It's the picture matching with your SVG file in a PNG format, take care here again it's a byte array and not a stream or another File format
      input :
      string id : the id obtained after calling the first function
      int error : in this integer there is a number which correspond to an error
      string stringError : this string contains an explanation of the error
    • Error code :
      "0"   : Execution ok
      "-1" :  Id unknow
      "-2" : Execution still in progress
      "-3" : Your file is corrupted

    • Number of visitors : 3612
    |
      Last update : 15 december 2015