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
 

Wednesday 29 February 2012

JDeveloper 11.1.1.6 not to be installed with SOA Suite 11g PS5

With the actual release of JDeveloper PS 5 aka 11.1.1.6 it is not possible to install it in the same FMW home as the SOA Suite PS 5. If you try to do so you receive an error :

 

There is also a statement in the docs mentioning that it is recommended to install jdeveloper in a new Middleware Home.



Installing the Oracle JDeveloper Studio Edition (Oracle Docs)