Friday, March 8, 2013

#226 Creating a Fusion CRM Sales Lead via Oracle BPM

This is a very simple scenario - that I hope one can extrapolate from.
Here we need to create a new Sales Lead from within a BPM process.

The SalesLeadService wsdl is available at
https://yourFCRMHost/mklLeads/SalesLeadService?WSDL

It would be very tempting to simply address this directly in your BPM process.
i.e. By adding a Web Service reference to the composite.

There are some compelling reasons not to do this -

1. the service reference will include a list of all operations, which may be confuse
    the BPM developer.

2. Data mapping - one sees the full list of SalesLead attributes - which again may confuse the
BPM developer. All she wants to do is create a very basic sales lead for a particular customer.

3. tight coupling

4. one has to concern oneself with the relevant security policies.

So I adopted this approach -

Create a Web Service Proxy in JDeveloper based on the Sales Lead WSDL.

During creation, specify the following WSM policy "oracle/wss_username_token_over_ssl_client_policy"

The generated client will be called SalesLeadServiceSoapHttpPortClient
You can add some code to it to test the connection to Fusion CRM.

        MklLead lead = new MklLead();
       
        try{
            long leadId;

            leadId = 300000000123456L;
            System.out.println("Lead name " + salesLeadService.getSalesLead(leadId).getName());


        }

I see my lead -

corresponding to the 4th Lead in Fusion CRM -


Create a new class to expose createLead functionality and expose as a web service

I now create a new class based on SalesLeadServiceSoapHttpPortClient.
I essentially amend to include a method createLead()

the code to create the lead-

        Long customerId = new Long(custId);
             MklLead salesLead = new MklLead();
             JAXBElement newCustId = null;
           
             String newSalesLead = leadName;
             JAXBElement newSalesLeadDesc = null;
              ObjectFactory factory = new ObjectFactory();  
             try{
               
                 newSalesLeadDesc = factory.createMklLeadDescription(leadDesc);
                 newCustId = factory.createMklLeadCustomerId(customerId);
                
                 salesLead.setCustomerId(newCustId);
                 salesLead.setName(newSalesLead);
                 salesLead.setDescription(newSalesLeadDesc);
              
                 salesLeadService.createSalesLead(salesLead);
                    
             }
       

I now expose this class as a web service and deploy to WLS.
I imported the Fusion CRM security certificate into the WLS DemoIdentity.jks.



I validate in Fusion CRM -


So now I simply leverage this web service in BPM -


Simple data mappings -


No security setup required.
Deploy and test




We could, of course, leverage OSB for the brokering.

No comments:

Post a Comment