2 Replies Latest reply: Jan 16, 2014 4:56 AM by Marcelinho RSS

Calling a webservice from CEP

ac50c8c2-e0c9-4c9d-b42e-7d6d17df8579 Newbie
Currently Being Moderated

hi,

 

My requirement is to call a web service from CEP. Anybody help please.

 

Thanks in advance.

  • 1. Re: Calling a webservice from CEP
    895482 Newbie
    Currently Being Moderated

    Hello,

     

    Please refer this document Configuring Web Services - 11g Release 1 (11.1.1.6.3) on how to call web service from CEP.

     

    Thanks,

    Ezhilan R.

  • 2. Re: Calling a webservice from CEP
    Marcelinho Newbie
    Currently Being Moderated

    Hi,

     

    if it's a very simple/restful sevice and/or you don't want to import a bunch of libs, you could do a simple http post, kind of "manually".

    Did e.g. this to call the quite simple BAM web service with just BASIC auth.:

     

    private String post(String content){

      URL url;

      try {

        url = new URL(URL);

        String userpass = username+":"+password;

        URLConnection uc = url.openConnection();

        uc.setDoOutput(true);

        String basicAuth = "Basic " + new String(Base64.encode(userpass.getBytes()));

        uc.setRequestProperty ("Authorization", basicAuth);

        uc.setRequestProperty ("Content-Type", "text/xml;charset=UTF-8");

        uc.connect();

        OutputStream os = uc.getOutputStream();

        os.write(content.getBytes());

        os.flush();

        os.close();

        InputStream is = uc.getInputStream();

        InputStreamReader isr = new InputStreamReader(is);

        int numCharsRead;

        char[] charArray = new char[1024];

        StringBuffer sb = new StringBuffer();

        while ((numCharsRead = isr.read(charArray)) > 0) {

            sb.append(charArray, 0, numCharsRead);

        }

        String result = sb.toString();

        return result;

      } catch (Exception e) {

        e.printStackTrace();

        return e.getMessage();

      }

    }

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points