Tuesday, 8 April 2014

First steps with Oracle Storage Cloud Service

The Oracle Storage Cloud Service is based on OpenStack which is very obvious as the Oracle documentation is linked to OpenStack.

For the first steps I have requested a trial service, which is 30 days-free trial, through https://cloud.oracle.com/storage.





The service is provisioned after some minutes and the stage ist set for the first "Hello, World"

The data is stored in the form of objects, which must reside in a container. Containers could also be stored in other containers. The objects and containers have default metadata and could be extended by custom metadata. For more details on the archtecture and backgrounds see here.

Steps to be performed
  1. Request a token for the communication
  2. Create a container
  3. Create an object
  4. List the objects in a container
  5. Show the content of an object


1. Request a token for the communication

The URL is from standard Oracle Storage Cloud Service URL "https://storage.us2.oraclecloud.com/auth/v1.0" the X-Storage_user is combined from here service-instance-name "storagetrial4937" and the identity-domain-name here "deoraclegermatrial48847". Both is to be found in the information sent during creation of the account.

To access any of the APIs, a token has to be requested as a first step. This token is used/mandatory for subsequent steps:

curl -v -X GET -H 'X-Storage-User: storagetrial4937-deoraclegermatrial48847:steffen.miller@oracle.com' -H 'X-Storage-Pass: MySecret' https://storage.us2.oraclecloud.com/auth/v1.0

This returns beside much more information:

X-Auth-Token: AUTH_tkb7b10c1b7720a8b677d88a63a005ddd9


2. Create a container through the REST API

The URL is combined from standard Oracle Storage Cloud Service URL "https://storage.us2.oraclecloud.com/v1/" the service-instance-name here "
storagetrial4937" and the identity-domain-name here "deoraclegermatrial48847". Both is to be found in the information sent during creation of the account.

The above "X-Auth-Token" token is used to create the container "myContainer":

curl -v -X PUT -H 'X-Auth-Token: AUTH_tkb7b10c1b7720a8b677d88a63a005ddd9' https://storage.us2.oraclecloud.com/v1/storagetrial4937-deoraclegermatrial48847/myContainer

The return reponse contains
HTTP/1.1 201 Created

3. Create an object

Now we are able to store an object "myObject" in the container:

curl -v -X PUT -H 'X-Auth-Token:  AUTH_tkb7b10c1b7720a8b677d88a63a005ddd9' -d 'Hello, World!' https://storage.us2.oraclecloud.com/v1/storagetrial4937-deoraclegermatrial48847/myContainer/myObject

The response contains 

upload completely sent off: 13 out of 13 bytes
< HTTP/1.1 201 Created

After this step we have created an object "myObject" in the container "myContainer" with the contents "Hello, World!"

4. List the objects in a container

To verify that the object is where we suspect it to be:

curl -X GET -H 'X-Auth-Token: AUTH_tkb7b10c1b7720a8b677d88a63a005ddd9' https://storage.us2.oraclecloud.com/v1/storagetrial4937-deoraclegermatrial48847/myContainer

The response is

myObject
5. Show the content of an object

To read out the contents of myObject we need the following command :

curl -X GET -H 'X-Auth-Token: AUTH_tkb7b77d88a63a005ddd9' https://storage.us2.oraclecloud.com/v1/storagetrial4937-deoraclegermatrial48847/myContainer/myObject

The response is

Hello, World!

So much for now.

Thursday, 5 July 2012

Found blog entry for Siebel Connection Pool in Oracle Service Bus 11g

Today I found another great blog entry about the storage of Tokens during communication with backend systems. This time the author explained his solution for the Siebel to OSB communication which is way more sophisticated than my solution blogged for the salesforce.com integration. The bottom line is the same approach, but Gilberto has put much more work in the realization. Great job. Find the blog here Siebel Connection Pool in Oracle Service Bus 11g

Monday, 19 March 2012

OSB access to salesforce.com

Some time ago I had a request to connect a file with salesforce.com. The tool of choice was Oracle Service Bus, first without any special adapter. So I had to investigate into the salesforce.com way of using web services and how I can approach this challenge.

First of all we need an account with salesforce.com. With this account we can access the Web Services API through Profile -> Setup -> API. Here we need to download the Enterprise WSDL


You can find more details to this here salesforce.com Documentation.

Now we import the WSDL into the Oracle Service Bus. As written in the docs
Before invoking any other calls, a client application must first invoke the login() call to establish a session with the login server, set the returned server URL as the target server for subsequent API requests, and set the returned session ID in the SOAP header to provide server authorization for subsequent API requests.
This means for Oracle Service Bus that we have to use an additional "Service Callout" before calling any other operation. With this in mind, it might be a good idea to store the session information for subsequent calls. As the Oracle Service Bus is stateless, this job could be achieved by using a java callout with a class variable storing the SF session ID.

 package client;  
 public class LoginStore {  
  private static String sessionID = null;  
  private static String serverURI = null;  
  public LoginStore() {  
   super();  
  }  
  public LoginStore(String sessionID ,String serverURI) {  
   super();  
   this.sessionID = sessionID;  
   this.serverURI = sessionID;  
  }  
  public static void setSessionID(String sessionID) {  
   LoginStore.sessionID = sessionID;  
  }  
  public static String getSessionID() {  
   return sessionID;  
  }  
  public static void setServerURI(String serverURI) {  
   LoginStore.serverURI = serverURI;  
  }  
  public static String getServerURI() {  
   return serverURI;  
  }  
 }  

I am also storing the Server URI for the subsequent calls.

Lets have a look into a Proxy Service to Update data on salesforce.com.



Before calling the API function we have a stage (login) with a publish action to the Login function proxy (loginPS).
The two Java callouts read the values from the "LoginStore"into OSB variables.

The LoginPS first checks if we already have a sessionID, or if it is necessary to first login and then store the results.


The assign action contains the login data in the following form

 <urn:login>  
    <urn:username>steffen.miller@oracle.com</urn:username>  
    <urn:password>SecretPassword8jlSMFQ41MjeNmIv84BZEkfpO</urn:password>  
 </urn:login>  

The password consists of two parts, the password itself, here "SecretPassword" and a security token which was defined by salesforce.com and is found in the mail after user creation, or could be regenerated by changing the password, or invalidating the security token "Reset My Security Token". Than a new token is send by mail.

Now putting it all together, I need a Business Service offering the Operations available through the Enterprise Web service enterprise.wsdl, doing the connection work to salesforce.com. This Business Service is called in the above
CallSF_PS in the "route 2 salesforce.com" routing node.

With the above Insert statement the $header object is amended with the following element

 <urn:SessionHeader>  
     <urn:sessionId>{ $sessionID }</urn:sessionId>  
 </urn:SessionHeader>  

And the Routing Options action changes the Server URI to the dynamic URI returned from the login process.

Finally, the service can be tested with test console.

The complete OSB project can be downloaded here

Monday, 5 March 2012

Coherence*Web Configuraiton changed 3.6 to 3.7

Moving from Coherence 3.6 to 3.7 the configuration to start a "Cache Server"  for Oracle Coherence*Web has changed in some points.

The configuration to start a default Coherence*Web CacheServer instance was in 3.6

 java -server -Xms512m -Xmx512m   
 -cp <Coherence_home>/lib/coherence.jar:<Coherence_home>/lib/coherence-web-spi.war   
 -Dtangosol.coherence.management.remote=true   
 -Dtangosol.coherence.cacheconfig=WEB-INF/classes/session-cache-config.xml   
 -Dtangosol.coherence.session.localstorage=true com.tangosol.net.DefaultCacheServer  
If you use the above setup with Coherence 3.7, there is an error thrown

 Exception in thread "main" (Wrapped: Failed to load the factory)   
 (Wrapped: Missing or inaccessible constructor   
 "com.tangosol.net.DefaultConfigurableCacheFactory(String)"  
 <configurable-cache-factory-config>  
  <class-name>com.tangosol.net.DefaultConfigurableCacheFactory</class-name>  
  <init-params>  
   <init-param>  
    <param-type>java.lang.String</param-type>  
    <param-value>session-cache-config.xml</param-value>  
   </init-param>  
  </init-params>  
 </configurable-cache-factory-config>) java.lang.reflect.InvocationTargetException  
  at com.tangosol.util.Base.ensureRuntimeException(Base.java:288)   
The location of the default session-cache-config.xml file has changed from coherence-web-spi.war to coherence-web.jar instead in .

The configuration for Coherence*Web CacheServer for coherence 3.7 reads

 java -server -Xms512m -Xmx512m   
 -cp <Coherence_home>/lib/coherence-web.jar:<Coherence_home>/lib/coherence.jar   
 -Dtangosol.coherence.management.remote=true   
 -Dtangosol.coherence.cacheconfig=session-cache-config.xml  
 -Dtangosol.coherence.session.localstorage=true com.tangosol.net.DefaultCacheServer  
See for more details Start a Cache Server