9 Replies Latest reply: Apr 16, 2012 4:45 AM by paddys RSS

    Update/Add endpoints to OSB BusinessService using JMX/ WLST

      Hi All,

      My OSB project contains many business service , while migrating from e2e to prod ,I need to update the service end points of these business service. In some cases the number of end points in the e2e and production can differ for a business service . Conventional method of updating using CUstomization file is not feasible as for the current business services the file is of 4000 lines , hence manualling updating the file is getting tedious .
      I want to store all the business services and endpoint uri's for the production env. in a text file and update the business services deployed in production env using either jmx java or wlst scripts.

      I have been able to extract the list of business service and current end point uisng java , but during the updation code results in a null pointer exception. I have been able to pin point the cause of error to instance of ServiceConfigurationMBean which is null. I am trying to get the instance of ServiceConfigurationMBean using following code

      ServiceConfigurationMBean servConfMBean = (ServiceConfigurationMBean)domainService.findService(ServiceConfigurationMBean.NAME+"."+mySession,ServiceConfigurationMBean.TYPE, null);
      where mySession is name of session that I created.

      Any help appreciated


        • 1. Re: Update/Add endpoints to OSB BusinessService using JMX/ WLST
          Anuj Dwivedi--Oracle
          See if it helps -


          • 2. Re: Update/Add endpoints to OSB BusinessService using JMX/ WLST
            Thank Anuj !

            Been through this blog ..but it does not suit my requirement .
            I wish to add endpoints to business service and possibly update the load balancing algorithm using approach similar to one mentioned in following blog http://blogs.oracle.com/MarkSmith/2008/11/osb_and_jms_business_service_c.html
            • 3. Re: Update/Add endpoints to OSB BusinessService using JMX/ WLST
              Anuj Dwivedi--Oracle
              I pointed you to that URL to just verify your code. Anyways, which version of OSB are you using?

              • 5. Re: Update/Add endpoints to OSB BusinessService using JMX/ WLST
                So did you manage to find any way to get ServiceConfigurationMBean ?
                I'm stuck with the same problem.
                • 7. Re: Update/Add endpoints to OSB BusinessService using JMX/ WLST
                  You've probably got this sorted by now (as it's a year since you posted!) but for the benefit of any other readers, the way to do this is via the Customization framework. I've a WLST script that uses a properties file to specify Service URI endpoints etc and generate a customization file that can be applied at or after deployment. Let me know if you're interested and I'll post it.

                  • 8. Re: Update/Add endpoints to OSB BusinessService using JMX/ WLST
                    Pierluigi Vernetto
                    I am surely interested! Please share your knowledge....
                    • 9. Re: Update/Add endpoints to OSB BusinessService using JMX/ WLST
                      No problems.

                      To start with, I've environment-specific properties files, to enable different builds/settings for dev, cit, uat, etc. The relevant section for business service endpoints looks like:
                      cit.cust.bs.Service1.location=OSBProject1/Services/Business Services
                      cit.cust.bs.Service2.location=OSBProject2/Services/Business Services
                      (here Service1 is a BPEL process running in a separate WLS instance, Service2 is a Java WS)

                      The WLST code that generates the customizations looks like this:
                      # Parse the customization properties & construct EV customization 
                      def constructBSCustomization(props, env):
                          bsList = props.getProperty(env + '.cust.bs.list')
                          customizations = []
                          for bs in bsList.split(','):
                              # print 'Constructing %s EnvValueCustomization'%bs
                              key = '%s.cust.bs.%s.name'%(env, bs)
                              name = props.getProperty(key)
                              key = '%s.cust.bs.%s.location'%(env, bs)
                              bsnames = '%s/%s'%(props.getProperty(key), name) 
                              # string.split() returns a list of strings
                              owner = Ref('BusinessService', bsnames.split('/'))
                              # need three types of env values: Service URI, Service URI Weight and Service URI Table
                              # there'll be as many of the first two as servers in the properties and only one of the last
                              # the last also takes None as the location
                              uritable = '<xml-fragment xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:cus="http://www.bea.com/wli/config/customizations" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.bea.com/wli/config/xmltypes">'
                              key = '%s.cust.bs.%s.servers'%(env, bs)
                              servers = props.getProperty(key)
                              key = '%s.cust.bs.%s.uri'%(env, bs)
                              uri = props.getProperty(key)
                              evList = ArrayList()
                              location = 0
                              for server in servers.split(',') :
                                  value = '%s%s'%(server, uri)
                                  evList.add(QualifiedEnvValue(owner, EnvValueTypes.SERVICE_URI, Integer.toString(location), value))
                                  evList.add(QualifiedEnvValue(owner, EnvValueTypes.SERVICE_URI_WEIGHT, Integer.toString(location), '0'))
                                  uritable += '<tran:tableElement>'
                                  uritable += '<tran:URI>%s</tran:URI>'%value
                                  uritable += '<tran:weight>0</tran:weight>'
                                  uritable += '</tran:tableElement>'
                                  location += 1
                              uritable += '</xml-fragment>'
                              uriXML = XmlObject.Factory.parse(uritable)
                              evList.add(QualifiedEnvValue(owner, EnvValueTypes.SERVICE_URI_TABLE, None, uriXML))
                              evcustomization = EnvValueCustomization('Clustered BusinessService URI', evList)
                              #print evcustomization.toXML()
                          return customizations
                      The returned customizations are placed in an ArrayList and printed out:
                      printer = PrintWriter(_outputFile)
                      Took me a while to get to this point but it seems to work ok.