Tuesday, November 6, 2012

Looping In XSL

XSL is a functional language and not a programming language !! XSL variables are not actually variables, once set you cannot change their value !! Why is a for loop not working inside XSL !!

I hope many of us have encountered these questions while using XSL. I have come across many scenarios where I had to create a XSL to iterate through a XML and generate some output but looping is tricky inside XSL. Sure you can run a while loop inside BPEL and get your values assigned but that's clumsy.

Below is some sample code snippet which can be extended based on your requirements and should come handy when trying to loop inside XSL.

  <xsl:template match="/">
  <root>
     <xsl:call-template name="loop">
         <xsl:with-param name="i" select="1" /> 
         <xsl:with-param name="count" select="//code to find the counter for loop" /> 
     </xsl:call-template>
  </root>
  </xsl:template>

  <xsl:template name="loop">
     <xsl:param name="i" /> 
     <xsl:param name="count" /> 
     <xsl:if test="$i <= $count">
        //your code here.You can use the predicate [position() = $i] for correct assignments.
           <xsl:call-template name="loop">
           <xsl:with-param name="i" select="$i + 1" /> 
           <xsl:with-param name="count" select="$count" /> 
           </xsl:call-template>
     </xsl:if>
  </xsl:template>
Hope this helps..

Wednesday, September 19, 2012

Capturing SOAP Headers/Envelope in SOA 11g

In order to manipulate SOAP Headers in SOA composites you can make use of the bpelx:inputHeaderVariable and bpelx:outputHeaderVariable attributes in invoke activity. However if you want to see the whole SOAP message (envelope with header, body and other parts) its not available out-of-the-box on the EM Console or in logs. In order to log/audit these web service conversations by a SOA composite you can follow below steps:

1. Attach a management policy to your webservice binding named oracle/log_policy

















2. Redeploy your code and now when a webservice call is made, navigate to the below log directory to check for the SOAP messages
MW_HOME/user_projects/domains/domain_name/servers/managed_server_name/logs/owsm/msglogging/diagnostic.log
This log would contain both the SOAP request as well as response and you can view the entire SOAP envelope.

Monday, August 27, 2012

Creating Read Only User In Weblogic(SOA 11g)

In production environments, usually requirement is to change the default Weblogic password (to restrict it just to System Administrators) and create some kind of Read Only user for the Weblogic console. A colleague of mine documented these steps recently and hope these help anyone trying to perform this in QA/PROD environments.

1. Guest User Creation
Login to console as weblogic user and click on Security Realms -> myrealm ->Users and Groups










Click on New, enter Name & Password and then OK.










Click on the user which was created (guestuser) and below step ensures that we provide read only access
 to same. Click on Groups tab, choose Monitors group from left pane to right pane. Click on save. Once
    done logout from console (as weblogic) and login with new user to check access.

















2. Weblogic Password Change
Login to console as weblogic user and click on Security Realms -> myrealm ->Users and Groups. Click on Weblogic and click on Passwords tab and update the new password and Save.












3. Node Manager Password Change
Login to console and click on Domain, click on Security ->  Advanced.








Update the password for the Node Manager user (weblogic) and click on Save.







4. Updating Weblogic and Node Manager passwords in Linux

     Login to fusion server using putty and navigate to the below directory.
·     Go to %domain_home%/config/nodemanager
·     Open nmpassword_properties
·     The file will hold encrypted values, replace all content with:
                  username=weblogic
                  password=new password
·     Restart the NodeManager
·     Check nmpassword_properties file for encrypted values
   Repeat same steps in its a multi node cluster environment.

 Changing the weblogic security file :
 Go to: %domain_home%/servers/{Managed Server}/security
 Open the boot.properties file
 Change the values to
              username=weblogic
              password=new password
  Perform same steps on other nodes and Restart Managed Servers.


Friday, August 10, 2012

Error while starting cluster: java.lang.RuntimeException: Failed to start Service "Cluster"

Can't start managed servers in a SOA cluster correctly, SOAInfra is in a failed state and see below errors in log file

Oracle Coherence GE 3.6.0.4  (thread=Cluster, member=n/a): Failure to join a cluster for 300 seconds; stopping cluster service.
Oracle Coherence GE 3.6.0.4  (thread=[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Error while starting cluster: java.lang.RuntimeException: Failed to start Service "Cluster" (ServiceState=SERVICE_STOPPED, STATE_ANNOUNCE)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.Service.start(Service.CDB:38)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid.start(Grid.CDB:6)
        at com.tangosol.coherence.component.net.Cluster.onStart(Cluster.CDB:637)
        at com.tangosol.coherence.component.net.Cluster.start(Cluster.CDB:11)

This maybe caused because of another cluster in same subnet having the same cluster name. To fix this error and start servers correctly go to admin console and click on Managed Server->Server Startup tab. Under arguments field set the below for each server of the cluster.

Let's say the 2 node names are host1.com, host2.com respectively.
On server startup on Node1 set

-Dtangosol.coherence.wka1=host1.com -Dtangosol.coherence.wka2=host2.com -Dtangosol.coherence.localhost=host1.com -Xmanagement:ssl=false,authenticate=false,autodiscovery=true

On server startup of Node2 set

-Dtangosol.coherence.wka1=host1.com -Dtangosol.coherence.wka2=host2.com -Dtangosol.coherence.localhost=host2.com -Xmanagement:ssl=false,authenticate=false,autodiscovery=true

Once done, save changes and restart the managed servers. Now the error should be gone.

Tuesday, May 8, 2012

Session Management/Pooling While Integrating SOA With Siebel

Oracle SOA Integrations with Siebel require some kind of session management/pooling to be taken care of. In most common scenarios you maintain Siebel sessions from SOA layer by opening session, making subsequent calls to Siebel webservices and closing the session explicitly. There are other cases also where you may want do some session pool management within SOA by storing the session details (say custom DB table) and maintaining a count of the number of open sessions.

In this post I will cover the common approach of handling siebel sessions in Integration, it follows 3 basic steps:

1. Call a Siebel Session WSDL which supports some kind of ping method/operation and pass username, password and session type ("stateless") in SOAP Header to open a session on Siebel side. Siebel will respond back with a Session Token.
2. Use the session token along with session type ("stateless") while making subsequent call to Siebel wsdl for successfully connecting to the opened session.
3. Finally to close the session explicitly, send session token along with session type as "None".

A sample SOAP Header for request sent to Siebel is as below:
 <soap:header xmlns:wsa="http://www.w3.org/2005/08/addressing">
          <usernametoken>xxxxx</usernametoken>
          <passwordtext>xxxx</passwordtext>
          <sessiontype>Stateless</sessiontype>
 </soap:header>
A sample SOAP Header for response received from Siebel is as below:
<soap:header>
  <sessiontoken>xxxxxx</sessiontoken>
</soap:header>
Incase Siebel SessionToken expires before making subsequent calls, Siebel will respond back with some error message like Invalid Session Token or Session Timed Out or Session Token has expired. In these cases just reconnect to Siebel by making another call to the Ping method to generate a new session token. The Old session generated on Siebel side will eventually timeout and won't waste any resources as such.

That's it ! You should be good to create sessions and make successful calls to Siebel now.

Monday, March 19, 2012

Webcasts On SOA Integration Options for Oracle Ebusiness Suite

Came across these webcasts from Oracle Applications Technology Group regarding the various SOA Integration Options for Oracle Ebusiness Suite. I had already covered most of these options in an earlier post here http://myexperienceswithsoa.blogspot.com/2010/06/soa-integrations-with-oracle-ebusiness.html

These webcasts provide in-depth sight into the topic along with some demos. Check them out if you are pondering over how to integrate with Oracle Ebusiness Suite.

E-Business Suite R12 Service Oriented Architectures (SOA) Using the E-Business Suite Adapter
SOA Integration Options for E-Business Suite

NOTE: You will require OTN userid/password to login and access the content of the webcast.

Monday, March 12, 2012

Receiving Multiple IDocs Using Single Channel/Program ID In SAP Adapter

This is a very common problem with Oracle SAP Adapter. For receiving iDocs from SAP, we need to create a channel on the Application adapter tool and each channel is associated with a corresponding program id in SAP system. When we have multiple Integrations with SAP system, it becomes a maintenance overhead for SAP BASIS administrators to create multiple program ids for each of these integrations/idoc_types.

To overcome this situation and make sure we can receive multiple iDocs via same channel/program id, an elegant solution has been explained in the attached link.
https://blogs.oracle.com/ateamsoab2b/entry/soa_11g_sap_single_channel