Monday, April 8, 2013

ADF Password management with WebLogic

Many times we have needed to include password management for our customers which for a portal is generally viewed as "standard functionality". This usually includes... forgot my password, reset my password and hey, register me, I want to be a new user.

Of course, just for fun, this functionality is not "standard" or even provided for WebCenter Portal projects or for ADF custom applications, so we generally have to build the functionality from scratch for the customer. Well not from scratch all the time, as if you follow this post, you will be able to create reusable (configurable) password management components for your next application.

So for now, this post will lead you through the wiring of ADF and the OOTB WebLogic LDAP credential store together. For production or semi-serious deployments you would not use the WebLogic defaultAuthenticator from myRealm, instead sensibly wiring up your corporate LDAP (AD, OID, whatever) to WebLogic.

So lets get started, and thanks must also go to Aaron Rapp for his Java super class code. You will need to go grab that before you start this tutorial. http://adf-lessons-learnt.blogspot.com.au/

1. Create a new ADF application


2. Create a new Java Class from the View Controller



3. Name the new class, leave all other options as is.




4. Paste in Aarons code after the super class closing } from http://adf-lessons-learnt.blogspot.com.au/

Use ctl-enter to resolve any dependencies (which adds items to the import list)


 5. Create the datacontrol from the java bean


6. Create a new ADF task flow for each password activity; change password, reset password and register new user.


7. Name it

8. Add a view to the page and name it

9.Double click to create a JSFF, name it etc. Then drag and drop the data control item onto the jsff. Create an ADF Parameter form.


10. Edit the form fields labels as shown, or type what you want.



11. Your form should look like this.


12. We need to add security now. Right click on the JSFF and add view level security to the application roles.


13. Save everything

Now we need to deploy the ADF application as an ADF Jar file for inclusion by other ADF or WebCenter application.

Create an ADF Jar by selecting the project Properties > deployment, and then create a new deployment profile. Make sure it is of type: ADF library JAR file


14. Select ViewController > Deploy to deploy as the ADF Jar file



15. Create or open your target application.
Create a new File System Connection to a shared folder where you copied the deployed ADF JAR file to.



16. Create a new ADF Libs folder. Project properties > Libraries & Classpath > Add Library > New



17. Give it a name eg ADF_Libs and add the shared libs dir from before. You may want to select the "deployed by default" checkbox, as this will package the ADF JAR in with your parent project and deploy them as a single item to WebLogic. leave them unchecked if you use a separate runtime library reference



18. Create a new parent page. eg changePassword.jspx
Open up the file system connect so you can see your task flows



19. Drag and drop one onto the page. Select region as the drop type. Choose to add the library to the project.



20. Add security to your page and remember to add it to your taskflow. You need to make sure your resource Type = task Flow and show task flows imported... is also selected.



21. Also remember that if this is a WebCenter application you need to add security entries to your pages.xml file to make the page visible.



22. Deploy and enjoy.

If you run your app you can now create a new WebLogic scoped user, change the users password and reset the users password.
A colleague of mine extended the last feature by including a CAPTCHA component in the ADF form as well to weed out the bots from the humans.

Tuesday, September 4, 2012

Some useful WCP and ADF web.xml entries

I have had to add a couple of change to the web.xml file for 2 WebCenter Portal customers now so I thought I should share what changes I regularly have to make.

  1. The annoying session warning and expiry dialog popups.
    We don't want to tell our anonymous page viewers that their session will expire. Ever. Anonymous folk don't expect to have a session established in the first place and will displeased to be told that their session will expire really soon. Now you can set a timeout period in the web.xml file but I prefer to disable this feature once and for all and here is how. Set the warning to the value of -1.

        <context-param>
        <param-name>oracle.adf.view.rich.sessionHandling.WARNING_BEFORE_TIMEOUT</param-name>
        <param-value>-1</param-value>
      </context-param> 

  2. The spinning "O" splash screen logo gets on my nerves. Nice to see which websites are ADF or WebCenter based but web customers do not consider they are using an "app" merely they are browsing your site. Get rid of it. How? Easy. Turn the splash screen value off.


      <context-param>
        <description>Determines if the Splash screen is shown</description>
        <param-name>oracle.adf.view.rich.SPLASH_SCREEN</param-name>
        <param-value>off</param-value>
      </context-param> 

Hope that helps some of you out.
Enjoy.

Thursday, July 28, 2011

WebCenter Environment Dependencies


If you have ever installed a base WebCenter PS3 environment, you will know that missing from this install is a managed server specifically there as a deployment target for your new and beautiful custom WebCenter Application – Your WebCenter Portal.  

As part of the installation you get a shiny new Spaces managed server but nothing for the portal. I am lead to believe this will change in the future, so PS4 or PS5 – Oracle PM's please confirm if you read this, but until then you need to create your own managed server and MDS to target and deploy your WebCenter portal application to.

The problem with this is unless you magically or intuitively pick which libraries to associate with your new managed server when you create it you will find that your deployment will fail until you add those libraries.

No major biggie, but annoying. I thought I would record a list of the libraries I know that are required by your portal managed server. If I missed some out, well, please add them in comments, and obviously, the more services and things you add to your application then the more libraries you will need.

The following list is the most basic you will need just to install the base WebCenter Portal created from the standard jDeveloper template.

Usually you will receive the following error message

Error while processing library references. Unresolved application library references, defined in weblogic-application.xml”

Luckily this is one of the nicer error messages you will ever receive from jDev, WebLogic or WebCenter. Basically the weblogic-application.xml and/or weblogic.xml files reference dependent libraries, and these need to be present on the managed server your are deploying to.

This appears to be a comprehensive list.
  • oracle.webcenter.framework,
  • oracle.webcenter.skin,
  • oracle.sdp.client,
  • p13n-app-lib-base,
  • oracle.ucm.ridc.app-lib
  • wcps-util-app-lib,
  • content-app-lib,
  • oracle.webcenter.spaces.fwk,
  • oracle.webcenter.framework.core,
  • oracle.webcenter.activitygraph.lib,
  • oracle.webcenter.forum.dependency
  • oracle.webcenter.jive.dependency
  • oracle.webcenter.framework.view,
  • content-web-lib,
  • wcps-services-client-web-lib,
  • jaxrs-framework-web-lib,
  • jersey-web-lib

What to do.
  1. Open your WebLogic Console and navigate to the deployments list.
  2. Select each one of the libraries listed above one by one, navigate to the targets tab.
  3. Select your desired target from the list and hit save.
That's it
All done. Now your deployment will work wonderfully... unless you have not set up your MDS target, but that will be for another post.

Happy WebCenter-ing.

Wednesday, June 15, 2011

OSB with JMS Queues

I don't often get to play with Oracle Service Bus much anymore, but I always enjoy the chance when it comes along. Right now that need has indeed arrived in the form of JMS messaging.
OSB makes message management easy, queues or topics, messages to either can be enqueued or dequeued with simple services. Let me show you how.

Here is the use case
  1. Dequeue a message on a JMS queue
  2. Write message payload to a report
  3. Write out and queue new message on another queue, possibly after transformation for another service/system to collect, and,
  4. Make the write action call-able via a Web Service interface.
The only gotcha with OSB is this simple rule.

Business Services only Enqueue messages
Proxy Services only Dequeue messages

Understanding, remembering and applying this principal make's the whole thing easy.

I have created two WebLogic Server JMS queues which I will use in this example; andrewq1 and andrewq2.

Lets begin.
1. Login to the OSB console and create whatever folder structure you like.
2. Create a Business Service to write (enqueue) the message payload using the JMS transport adapter. Make sure you use the jms format; eg jms://192.168.13.136:8011/jms.andrewconnfactory/jms.andrewq2
I named mine writeQ.


3. Enable the Operational Settings for Monitoring and Tracing. Save and Submit.
4. Create a Proxy Service now to read (dequeue) the JMS messages.
5. Much the same as the Business Service configure the message payload to use the JMS transport adapter. Make sure you use the jms format; eg jms://192.168.13.136:8011/jms.andrewconnfactory/jms.andrewq1
I named mine readQ.




6. Enable the Operational Settings for Monitoring and Tracing. Save and Submit. 
7. Now we need to modify the Message Flow so the readQ Proxy Service knows what to do and writes out a message report so we can view the payload via the OSB operations dashboard.
8. Create a Pipeline pair and add a stage as shown.


9. Modify the stage actions to write out the dequeued payload to a report, and then route the payload to the queue andrewq2 using the writeQ business service. We could also handle some transformation etc here, but thats for another post :-)


10. That's it for OSB, Save and Submit your changes. Lets start testing!
11. We can cheat at the moment and use the WebLogic JMS message queue utility available from the Queue Monitoring Tab. We could also write a Business Service to write a message to this queue too, and we have created one already, but this way adds another option to this example.
12. Select show messages on the outbound queue from the monitoring tab.


13. Select the new button. You can also see the queued messages sitting here as well, not that there will be any as OSB is polling this queue for messages now and will act to dequeue as soon as one is written.


14. Create a new message and make sure you set the message type to be TextMessage.




15. That will create a message on the first queue, OSB will collect it, write out the payload to a report and write the message to the second queue. To view the report select Message Reports from the Operations Dashboard.




16. Selecting this message will show you the payload details and the transaction information.


17. When you select details you will see the xml payload.


18. Now we can go to the second queue (mine was called andrewq2) and you will see some messages queued awaiting collection.




19. And again you can select a message to see the contents. No surprise here, the payload shows what I typed in earlier.




And thats it. Well there is alot more that could and probably should be done, but this is just a taster, and you can extend what you have created now as you please.

Enjoy and don't forget to look in sometimes on WebCenter's very capable integration cousin - OSB.

Thursday, May 19, 2011

Creating Business Mashups using a webservice in Webcenter PS3

One key capability in WebCenter PS3 is the ability to create Data Controls and Taskflows at runtime. You can create a data control using SQL or a webservice, and wire this data control into a custom taskflow that can be created at run time which shall use a Mashup Style to render the data control. We could build different data controls and mash them up via taskflows by leveraging the underlying WebCenter schemas.

Let’s build a data control from a webservice and render that on a WebCenter Spaces page.

In this example we will create a simple currency converter task flow, consuming a web service and make a data control out of it. From there we will display it on the Spaces page.

The service url is: http://www.webservicex.net/CurrencyConvertor.asmx?WSDL

Here are the Steps :


1. Logon to your Space as an admin user.
2. From you Space navigate to Manage > All Settings



3. Go to the spaces resource Management tab and navigate to the Data Controls



4. Then create a Data Control by selecting the webservice option. Select Create > Web Service. Provide the details for the data control Name (Currency Converter), Description and provide the WSDL details. Ensure you provide Proxy details as well if needed and click connect.



5. Select the method to be consumed Click Create to finish



6. Click Edit and select the "show" attribute for the Data control to be visible from the Composer/Business Dictionary
7. Create a Taskflow with a Blank Mashup style



8. Edit the task flow by selecting Edit > Edit
9. Select Add Content and Select the Mash-Ups folder




10. Select Data Controls




11. Select Currency Converter




12. Select Add > ADF Button




13. Select Conversion Rate to drill into the Currency Converter Data Control

14. Select the Add > ADF Output Formatted w/Label




15. Select ToCurrency Add > ADF Input Text w/Label

16. Select FromCurrency Add > ADF Input Text w/Label

17. Then select Close

18. Select View and choose Source




19. Select the element InputText: ConversionRate_ToCurrency element and select Edit
20. Change the Input Text Label to “To Currency” then OK




21. Repeat the process again for the FromCurrency InputText element and change the Label to “From Currency” then OK

22. Now select the panelLabelandReturn text element and change the Label to “Exchange rate” then OK




23. Finally select the commandButton and change the Text to “Get Exchange Rate” then OK

24. Select the Box element then select Edit and order the “To Currency” Input text element to the top then OK




25. Save and Close the Task Flow editor

26. Select Edit > Show to display the Task Flow in the Business Catalogue

27. Now we need to create a new page to display this task flow

28. Select Pages > Create Page, name it MashUp select a blank template
29. Select Add Content > Mash-Ups > Task Flows and choose to Add the CurrencyConverterTF task flow to the page.

30. Select Save and Close

31. Run a test and Enter USD in the To Currency field and AUD in the From Currency field and press the Get Exchange Rate button




Gotta love the value of the Australian dollar right now. Time to go shopping :-)

That was a quick tutorial on how to add webservice capabilities to your WebCenter deployment.

Many thanks to Vijaykumar Yenne for his original viewlet.

Cheers
Andrew Rosson

Perth, Western Australia