- package com.oimacademy.personal;
- import java.util.HashMap;
- import java.util.Map;
- import javax.activation.DataHandler;
- import javax.mail.MessagingException;
- import javax.mail.internet.MimeBodyPart;
- import javax.mail.internet.MimeMultipart;
- import javax.xml.ws.BindingProvider;
- import oracle.ucs.messaging.ws.ClientConstants;
- import oracle.ucs.messaging.ws.MessagingFactory;
- import oracle.ucs.messaging.ws.types.Message;
- import oracle.ucs.messaging.ws.types.DeliveryType;
- import oracle.ucs.messaging.ws.MessagingClient;
- import oracle.sdp.messaging.util.StringDataSource;
- import oracle.wsm.security.util.SecurityConstants;
- /*
- <classpathentry kind="lib" path="D:/OIMAPIclients/ExternalJars/sdpmessagingcommon.jar"/>
- <classpathentry kind="lib" path="D:/OIMAPIclients/ExternalJars/sdpmessagingclient.jar"/>
- <classpathentry kind="lib" path="D:/OIMAPIclients/ExternalJars/wsclient_extended.jar"/>*/
- public class UMSEmailServiceTestUsingWS_URL {
- public UMSEmailServiceTestUsingWS_URL() {
- }
- private static Map configureUMSClient() {
- long lStartTime = System.currentTimeMillis();
- Map config = new HashMap();
- String ws_url = "http://localhost:8001/ucs/messaging/webservice";
- config.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ws_url);
- config.put(ClientConstants.POLICIES, new String[] {});
- config.put(SecurityConstants.Config.CLIENT_CREDS_LOCATION,
- SecurityConstants.Config.CLIENT_CREDS_LOC_SUBJECT);
- long lEndTime = System.currentTimeMillis();
- long difference = lEndTime - lStartTime;
- System.out.println("Elapsed milliseconds in configureUMSClient: "+ difference);
- return config;
- }
- private static void sendMessage(Message message, Map config) {
- long lStartTime = System.currentTimeMillis();
- MessagingClient mClient = null;
- try {
- mClient = new MessagingClient(config);
- } catch (Throwable t) {
- t.printStackTrace();
- }
- String id = null;
- try {
- id = mClient.send(message, null, null);
- System.out.println("Message id: " + id);
- } catch (Exception e) {
- e.printStackTrace();
- }
- long lEndTime = System.currentTimeMillis();
- long difference = lEndTime - lStartTime;
- System.out.println("Elapsed milliseconds in sendMessage: " + difference);
- }
- public static void main(String[] args) {
- long lStartTime = System.currentTimeMillis();
- try {
- Map config = configureUMSClient();
- Message message = MessagingFactory.createMessage();
- message.setSubject("UMS Test Client Subject");
- String messageContent = "We are Testing UMS Test Client";
- StringDataSource dataSource = new StringDataSource(messageContent, "text/html; charset=UTF-8");
- MimeMultipart mp = new MimeMultipart("mixed");
- MimeBodyPart mp_partRich = new MimeBodyPart();
- try {
- mp_partRich.setDataHandler(new DataHandler(dataSource));
- mp.addBodyPart(mp_partRich);
- } catch (MessagingException e) {
- e.printStackTrace();
- }
- message.setContent(new DataHandler(mp, mp.getContentType()));
- message.getRecipients().add( MessagingFactory.createAddress(DeliveryType.EMAIL + ":"+ "chvmadhusudhanrao@gmail.com"));
- message.getSenders().add(MessagingFactory.createAddress(DeliveryType.EMAIL + ":"+ "chvmadhusudhanrao@gmail.com"));
- message.getReplyTos().add(MessagingFactory.createAddress(DeliveryType.EMAIL + ":"+ "chvmadhusudhanrao@gmail.com"));
- sendMessage(message, config);
- } catch (Exception e) {
- e.printStackTrace();
- }
- long lEndTime = System.currentTimeMillis();
- long difference = lEndTime - lStartTime;
- System.out.println("Elapsed milliseconds in main: " + difference);
- }
- }
Oracle Identity Manager(OIM) is the Provisioning Solution from oracle. This page contains an index with references to all OIM related posts in the oracle identity manager Academy blog. The posts included herein are intended to provide oracle identity management customers and developers with technical information about best practices for implementing OIM based solutions.
OIM Notification/ UMS EmailService API
Subscribe to:
Post Comments (Atom)
-
Connection Related API's : OIM DB Connection/ Data Source connection OIMClient API / OIMConnection API OIM Platform API to getSer...
-
Error : Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframewor...
-
In this post, we set the middle name as “MiddleName” if user does not provide middle name during user create operation. Below are high...
No comments:
Post a Comment