Labs SEI >

Table of Contents


Sub-orchestrations

  1. In Oracle SOA it is possible to create BPEL processes that are usable by other BPEL processes. This allows to create service compositions.
  2. screenshot
  3. Connect the two processes as depicted in the image.
  4. screenshot
  5. Think if compositing services may be helpful for the project.

SAUDE 365

  1. SAUDE 365 report format (xsd, xml)
  2. Report files are output to input folder (e.g. /tmp/input) to simulate patient arrival
  3. Example Java application to generate random names
  4. Can be extended to generate patient reports
    /** Generate a random name */
    public String nextName() {
        int i = random.nextInt(names.size());
        int j = random.nextInt(surnames.size());

        return names.get(i) + " " + surnames.get(j);
    }

CTT Addresses Validation

  1. CTT has a REST interface. This means that we can use it using the HTTP protocol.
  2. In your browser make a HTTP request to the following URL:
    http://www.ctt.pt/pdcp/xml_pdcp?indistrito=viana+castelo&inlocal=lisboa
  3. Observe the result. Note you can obtain more information at:
    http://www.ctt.pt/fectt/wcmservlet/system/galleries/download/servicosonline/conteudosextra/man_util_xml_v15.pdf
  4. Create a web service to validate the address using the CTT online services.

Infarmed

  1. Web site address: http://www.infarmed.pt/infomed/pesquisa.php
  2. Please do not overload the server. Make a 5 second pause between each access.
  3. Web scraping consists in download the HTML page and extracting the desired information by parsing the web page and relying on existing structure
  4. The parsing can be done with custom code or using a helper library
  5. Create a web service to validate the information, encapsulating the web scraping .

JDeveloper Java Web Services tutorial

Example code: HTTP Post

import java.io.*;
import java.net.*;

class HttpPost {

    public static void main(String args[]) throws Exception {

        if(args.length < 1) {
            System.err.println("Please specify an address like http://hostname:80/cgi");
            return;
        }
        final String address = args[0];
        System.out.println("Posting to " + address);

        // Construct data
        String data = URLEncoder.encode("name", "UTF-8") + "=" + URLEncoder.encode("friend", "UTF-8");
        //data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8");

        // Send data
        URL url = new URL(address);
        URLConnection conn = url.openConnection();
        conn.setDoOutput(true);
        // No caching
        conn.setUseCaches (false);

        OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
        wr.write(data);
        wr.flush();

        // Get the response
        int responseCode = ((HttpURLConnection)conn).getResponseCode();
        System.out.println("Response code is " + responseCode);

        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line;
        System.out.println("Response:");
        while ((line = rd.readLine()) != null) {
            System.out.println(line);
            if(args.length > 1) {
                FileWriter fw = new FileWriter(responseCode + "-" + args[1], true);
                fw.write(line);
                fw.write(System.getProperty("line.separator"));
                fw.close();
            }
        }
        wr.close();
        rd.close();
    }
}

Example helpful library: jsoup