|
Oracle Application Server Wireless Java API Reference B14043-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.panama.messaging.push.PushClientBase
oracle.panama.messaging.push.PushLite
Light weight push messaging client, which sends out messages and queries status of delivery to recipients.
Push Server may be configured in two ways:
1. Public Push gateway: Push gateway provides messaging services to Internet/intranet users. The communication between Push client and Push gateway is powered by SOAP technology. Push client must have the URL of Push gateway. It must provide a valid username/password combination to get services, if the gateway asks so.
For example: PushLite myPushClient = new PushLite("http://messenger.oracle.com/push/webservices", "user","passwd");
2. Private Local Push Server: Push client and Push server are running on the same machine. Push client calls Push server class through java methods call directly without using SOAP or RPC. No SOAP gateway or authentication is needed for local installation. Push Server provides services to that Push client only. When constructing Push client for local Push server, pass 'null' as Push gateway URL in the constructor. Access to Push Server is granted to local Push client automatically. It's a good idea to provide a user name for logging and reporting purpose, though it's not required.
For example: PushLite myPushClient = new PushLite(null, "user",null);
Only classes/types defined in JDK have been used. No self-defined Java types. Push.java provides richer functionalities than PushLite.
It only supports
text messaging, no binary data is allowed
all email recipients are sent as "To" mode. "CC" and "Bcc" are not supported.
Multipart message is NOT supported
It requires:
PushException class in the same package
No other classes in the same package are needed.
No special serializers are needed.
Sending messages to a HTTPS PushServer
PushAPI supports both Oracle SSL and SUN's JSSE. No code change is needed. The classpath is different in these two cases however.
Use Oracle SSL: Oracle SSL uses native code to get high performance.
1. Make sure jssl-1_2.jar and javax-ssl-1_2.jar are inside classpath and NONE of JSSE jars is in classpath.
2a. On Windows system, make sure njssl9.dll is in path.
2b. On Solaris system, make sure libnjssl9.so is in library path.
Use SUN's JSSE
JSSE is a pure Java implementation of SSL, which could be downloaded from SUN. (Not included in this release.)
Add jsse.jar, jcert.jar and jnet.jar into classpath. Make sure jssl-1_2.jar and javax-ssl-1_2.jar are NOT in classpath.
Following example sends out message to 2 recipients:
1. Mike of Oracle via SMS, Voice or Email. If fails, send a SMS or Voice message to phone number 1-650-5551234
2. Email good-guy@company.com, if fails, send SMS or Voice msg to alice of brandA. If still fails, send bob of brandB a voice message.
String to[] = new String[2]; to[0] = "SMS:oracle-mike,Voice:oracle-mike,Email:oracle-mike;SMS:1-650-5551234,Voice:1-650-5551234"; // Has the second recipient? to[1] = new String("Email:good-guy@company.com;SMS:brandA~alice,Voice:BrandA~alice;Voice:brandB~bob"); String senders[] = new String[1]; senders[0] = "brandC~jerry.lee"; String gatewayURL = "http://messenger.oracle.com/push/webservices; PushLite ml = new PushLite(gatewayURL,"user","password"); // proxy server to reach internet (optional) ml.setProxy("proxy.company.com",80); // get supported delivery types by the gateway String supportedTransports[] = ml.getSupportedTransports(); if(supportedTransports != null) { System.out.println("**** Supported transports ****"); for(int i=0;i<supportedTransports.length;i++) System.out.println(supportedTransports[i]); } else System.out.println("can't get supported transports"); String wo[] = null; try { wo = ml.sendMsg( senders, null, to, associatedKeys, "message subject", "hello world! (msg body)" ,"text/plain"); } catch(PushException e) { e.printStackTrace(); } if(wo != null) { for(int i=0;i<wo.length;i++) System.out.println(wo[i]); if(wo.length > 0) { String status = ml.getStatus(wo[0]); if(status != null) { System.out.println("[" + status + "]"); } } else { System.out.println("no msg id returned"); } } else { System.out.println("Send failed. No work order returned"); }
Push
Constructor Summary | |
PushLite(java.lang.String messagingGatewayURL, java.lang.String username, java.lang.String password) Construct a new push lite instance, which is a push client to an OracleMobile SOAP Push gateway or Push server locally. |
Method Summary | |
java.lang.String |
getStatus(java.lang.String messageID) Deprecated. Use XMSSimpleSender#getStatus instead |
java.lang.String[] |
getStatus(java.lang.String[] messageIDs) Deprecated. Use XMSSimpleSender#getStatus instead |
java.lang.String[] |
send(java.lang.String[] senders, java.lang.String[] recipients, java.lang.String message) Deprecated. Please use sendMsg() |
java.lang.String[] |
send(java.lang.String[] senders, java.lang.String[] replyTOs, java.lang.String[] recipients, java.lang.String[] associatedKeys, java.lang.String subject, java.lang.String message, java.lang.String contentType) Deprecated. Please use sendMsg() instead |
java.lang.String[] |
sendMsg(java.lang.String[] senders, java.lang.String[] recipients, java.lang.String message) This method is based on send() with supports of failover capability and username capability. |
java.lang.String[] |
sendMsg(java.lang.String[] senders, java.lang.String[] replyTOs, java.lang.String[] recipients, java.lang.String[] associatedKeys, java.lang.String subject, java.lang.String message, java.lang.String contentType) Deprecated. Use XMSSimpleSender#sendMsg instead |
Methods inherited from class oracle.panama.messaging.push.PushClientBase |
getServerVersion, getSupportedTransports, getVersion, removeStatusListener, setProxy, setProxy, setStatusListener, setStatusListener |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PushLite(java.lang.String messagingGatewayURL, java.lang.String username, java.lang.String password) throws PushException
messagingGatewayURL
- Complete URL of OracleMobile Push messaging gateway(SOAP). For example: http://messenger.oracle.com/push/webservicesusername
- username of OracleMobile messaging gateway(SOAP). null if no username is needed.password
- password of OracleMobile messaging gateway(SOAP). null if no password is needed.Method Detail |
public java.lang.String getStatus(java.lang.String messageID) throws PushException
PushException
public java.lang.String[] getStatus(java.lang.String[] messageIDs) throws PushException
PushException
public java.lang.String[] send(java.lang.String[] senders, java.lang.String[] recipients, java.lang.String message) throws PushException
senders
- an array of senders' addresses. A sender's address has a transport type, an address and they are separated by colon sign(:). One sender per transport type. Latest sender of the same transport type will override earlier senders of same transport type in the array. Example 1: "Email:myemail@company.com" Example 2: "SMS:1-650-5551234" transportType a type defined in oracle.panama.messaging.common.TransportTyperecipients
- recipients' addresses (i.e. email address or phone number) Format of recipient addresses: [transport]:[recipient address 1],[recipient address 2] ... Example: SMS:1-650-5551234, SMS:1-408-3456789 transportType a type defined in oracle.panama.messaging.common.TransportTypemessage
- body of messagePushException
Note: The formats of address in send() are quite different from address formats in sendMsg(), because sendMsg() supports failover and user features.
public java.lang.String[] send(java.lang.String[] senders, java.lang.String[] replyTOs, java.lang.String[] recipients, java.lang.String[] associatedKeys, java.lang.String subject, java.lang.String message, java.lang.String contentType) throws PushException
senders
- an array of senders' addresses. A sender's address has a transport type, an address and they are separated by colon sign(:). [transport]:[sender's address] One sender per transport type. Latest sender of the same transport type will override earlier senders with same transport type in the array. Example 1: "Email:myemail@company.com" Example 2: "SMS:1-650-5551234" [transport] is a type string defined in oracle.panama.messaging.common.TransportTypereplyTOs
- an array of reply to addresses or phone numbers (optional). Use null if no reply to address. [transport]:[reply to address] One reply to per transport type. Latest reply to of the same transport type will override earlier reply to of same transport type in the array. Example 1: "Email:myemail@company.com" Example 2: "SMS:1-650-5551234" [transport] is a type defined in oracle.panama.messaging.common.TransportTyperecipients
- recipients' addresses (i.e. email address or phone number) Format of recipient addresses: [transport]:[recipient address 1],[recipient address 2] ... Example: SMS:1-650-5551234,SMS:1-408-3456789 [transport] is a type defined in oracle.panama.messaging.common.TransportTypeassociatedKeys
- an array of text strings may be used by client application to do message tracking. one key per recipient. The length of the each key could be up to 64 bytes. The orders of the keys are the same as the orders of recipients. This field is optional, if no associated key is used, use null.subject
- subject of message (optional)message
- body of messagecontentType
- MIME type with optional charset encoding of message. For example: "text/plain", "text/plain; charset=us-ascii" and "text/html"PushException
send(String[] , String[] , String )
, sendMsg(String[], String[], String[], String[], String, String, String)
public java.lang.String[] sendMsg(java.lang.String[] senders, java.lang.String[] recipients, java.lang.String message) throws PushException
senders
- an array of senders' addresses. A sender's address has an address, transport type(s), and they are separated by colon sign(:). <sender's address>[:transports] [transport] is a type string defined in oracle.panama.messaging.common.TransportType One sender per transport type. Latest sender of the same transport type will override earlier senders with same transport type in the array.recipients
- recipients' addresses (i.e. email address, phone number or user name) Format of address:message
- body of messagePushException
send(String[] , String[] , String )
, send(String[], String[], String[], String[], String, String, String)
, sendMsg(String[], String[], String[], String[], String, String, String)
public java.lang.String[] sendMsg(java.lang.String[] senders, java.lang.String[] replyTOs, java.lang.String[] recipients, java.lang.String[] associatedKeys, java.lang.String subject, java.lang.String message, java.lang.String contentType) throws PushException
senders
- an array of senders' addresses. A sender's address has an address, transport type(s), and they are separated by colon sign(:). <sender's address>[:transports] [transport] is a type string defined in oracle.panama.messaging.common.TransportType One sender per transport type. Latest sender of the same transport type will override earlier senders with same transport type in the array.replyTOs
- an array of reply to addresses or phone numbers (optional). Use null if no reply to address. The format is exactly the same as senders' address described above.recipients
- recipients' addresses (i.e. email address, phone number or user name) Format of address:associatedKeys
- an array of text strings may be used by client application to do message tracking. one key per recipient. The length of the each key could be up to 64 bytes. The orders of the keys are the same as the orders of recipients. This field is optional, if no associated key is used, use null.subject
- subject of message (optional)message
- body of messagecontentType
- MIME type with optional charset encoding of message. For example: "text/plain", "text/plain; charset=us-ascii" and "text/html"PushException
send(String[] , String[] , String )
, send(String[], String[], String[], String[], String, String, String)
, sendMsg(String[] , String[] , String )
|
Oracle Application Server Wireless Java API Reference B14043-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |