Wednesday, October 24, 2007

Connecting to CVS/SVN thru JDeveloper

Here is how simple it is to set up your CVS repository to work in JDeveloper 11g. The first step is to select your Versioning system. SVN and CVS are shipped with JDeveloper 11g. Other supported version control system can be downloaded via Check for Updates.
Now you can view the SVN or CVS Navigator from the View menu. Use the context menu of the parent node in the open navigator to create a new repository connection.
For CVS enter the details of your CVS repository in the wizard; including your access method and authentication style and user id (set by your CVS repository administrator). Test the connection and Finish the wizard. You are now able to browse the repository and Check Out a module using the context menu to begin work. To add a new application to the repository select Import Module from the Versioning menu.



For SVN enter the URL to the repository, user name and password, again Test the connection and click OK to complete the connection. As well as being able to browse the repository you can do other things such as create new remote directories from the context menu of the connection in the navigator.

To add a new application to the repository using either CVS or SVN, select Import Module from the Versioning menu.
By returning to the Versoning menu and selecting another version control system you can invoke the navigator for that system - without losing any of the connections you have to other systems.

Tuesday, October 23, 2007

SVN Branching in JDeveloper 11g

The latest Technology Preview of JDeveloper 11g is now available and contains some great new functionality to support Subversion 1.4.3.


We've added the Incoming Changes tab to the Pending Changes window - so valuable if you want a sneak preview of what changes others are making to files you have in Working Copies in JDeveloper.
Also, you can now filter Pending Changes at the application or project level.

But best of all, we've added support for Branch/Tag, Switch and Merge. I've created an online demo that you can play from OTN. If you haven't already, download the 11g preview and try it out - I'd love to have your feedback

Friday, June 22, 2007

Synchronizing with CVS in JDeveloper

Whatever your mechanism for working with CVS during development one of the things that we all like to avoid is unresolveable conflicts. But when working in a team environment it's an ever present evil.

Using the Incoming Changes tab of JDeveloper's Pending Changes window can help in pre-empting conflicts and managing them.

Here is a very simple example. I have an application under CVS source control that contains a number of classes. I'm working with a team who are also working on these files. In the Pending Changes window I can see that 2 of the files have been modified and checked in since I checked out my copy. This is shown in the Incoming Changes tab:









My local change is reflected in the Outgoing pane (I haven't bothered to insert an image of the outgoing pane here, but in this view I can quickly see that there is only outgoing change - and I know this is the only file I am working on).

Greeting.java has been updated and checked-in by someone else but doesn't cause a conflict with my version.

NewGreeting.java appears to have an unresolveable conflict. Double-clicking on the file in the Incoming Changes window returns me to the file in the code editor (or opens it), moves the focus to the History Tab, selects the Head revision to compare my local version of the file with and highlights the first change.













From here I have a number of options. Knowing that there is a conflict I could make changes to my code. Or perhaps I want to run Update and then use JDeveloper's Merge feature to resolve the conflict or perhaps I just carry on with my coding and choose to deal with the conflict at some later date, whilst keeping it in the back of my mind (and in my Incoming Changes window!) Whatever route I take, I'm able to keep my local copy and the repository synchronized and view/act on any conflicts as I choose.

I've kept my example very simple and have used JDeveloper 10.1.3.2. In a future post I'll give you a taste of enhancements we've made to Pending Changes for the JDeveloper 11g

From Seoul to Shanghai with ODC

I can hardly believe it's been 8 months since I last posted here. In that time I've taken up a new role within the JDeveloper Produce Management Group and have been focused on different areas of the product than my previous SOA focus. I now work very closely with our development groups coming up with requirements for JDeveloper and support development.

This doesn't mean I don't get to meet with users any more, an important part of requirements gathering is to listen to what our customers are saying! This year I've been very lucky to have been involved with the Oracle Develop Conferences. I've 'done' Seoul and if you're in London next Tuesday and Wednesday be sure to get over to the Excel Centre for the London run of this conference designed specifically for developers. I'll be there talking web services, ADF and Fusion and would also love to talk to you about your complete application development lifecycle experiences - the what, why and how of your approach. I have a special interest in Source Control systems - so come and tell me how JDeveloper stacks up.

And Shanghai? Well that's where this year's ODC run closes at Oracle OpenWorld in Shanghai - and I'll be there too, maybe I'll see you?

Wednesday, October 18, 2006

No Time For Post-Vacation Blues

I'm back from the Delta and in San Francisco preparing and looking forward to Oracle OpenWorld next week and in particular the Oracle Develop event.

If you are in the San Francisco area during Oracle OpenWorld Oct 22-26, you have the opportunity to see Rod Johnson and Brian Behlendorf speak! Rod Johnson is one of the world's leading authorities on Java and J2EE development. Brian Behlendorf is the CTO and founder of CollabNet - the main sponsor of the Subversion project. He also cofounded and contributed heavily to the Apache Web Server Project.

And don't miss all the other great sessions and hands-on labs that my colleagues and I are presenting

See you there, come and say hello

Tuesday, October 03, 2006

Down in the Delta with the Blues

I wont be posting or answering comments for the next week as I'm down by the banks of the Mississippi for the Arkansas Blues and Heritage Festival. Anyone else going? See y'all there (must be said with an English accent tinged with Arkansas).
Otherwise, hope to see some of you at Oracle OpenWorld later in the month

Wednesday, September 20, 2006

Dealing with Complex Input Params in ADF Web Service Data Controls

A comment on a recent post prompts me to clarify how Web Service complex input parameters can be used in an ADF application

If the inputs are simple types or a single complex object (not an array of objects) then when you create the ADF Data Control for the service the data control palette gives you the structure of the parameters, enabling you to drag them on to a page as a parameter form or an action of some kind.

To illustrate consider the following method definition:

public Quote processOrderQuote(String productName, String itenType, String partnum, String quantity, String price)

Published as a web service, the complexTypes as seen in the WSDL file look like this:



The ADF Data Control created from the WSDL file uses OrderQuote elements as the String parameters. It wouldn't be my choice to name my parameters param0 - param4, not best practice, but that's the way this WSDL has been created. Dragging the OrderQuote service call onto a page will give you a choice of data bindings - perhaps you need a parameter form so that the input can be recorded directly, or perhaps just a command button or link where the input parameters will be existing data in your application


What about the more complex situation where the input parameter is an array of objects?

To illustrate consider the following method definition:

public Quote processPOItemsQuote(Item[] items)

Published as a web service, the complexTypes in the WSDL file look like this:



And the Data Control looks like this:



In this case the input parameter - the array of objects - is not dealt with directly by the data control. I'm working with JSF so I need to use a managed bean to populate the input parameter, the principle is the same in other UIs too. In my scenario, I need a parameter form for a user to enter the itemId and quantity of the item they want to get a quote on. To keep my example simple, just one item is going to be quoted on - but an array is still needed to fulfill the service's input requirement.

1. I've created a JSF JSP page (getPOQuote.jsp) with a backing bean (GetPOQuote.java). First I want to add my input paramaters to the bean. I've added 2 new variables to the GetPOQuote.java and using JDeveloper I can automatically generate the accessors:



2. Next I need to create a method to populate the array that my service is expecting as a parameter. I added the getItems method:



3. I add two ADF Faces Core: InputText components onto my page and use the Property Inspector(PI) to give them the labels I want




4. Now I want to bind the value of these input fields to my new backing bean attributes. I select the Quantity field and in the PI Value property type #{ and hit enter. This tells the framework that I want to use the Expression Builder(EB) and I can open the EB by clicking the ellipses button.



5. Now I can browse to my backing_getPOQuote managed bean and double-click the quantity attribute to create the expression #{backing_getPOQuote.quantity}. This ensures that the user input to the quantity field is bound to the quantity attribute of the managed bean. I need to repeat this for the Item Id field and bind that to itemId



6. Finally, back in my page I can drag the POItemsQuote(Object) service from the DC palette onto the page as a ADF Command Button. In the Action Binding Editor I can use the ellipses to the right of the Value column to browse to the items attribute of my managed bean (remember in Step2 I created the getItems method in my managed bean) to pass the input object to the service



7. Back in my page, if I open the Page Definition File I can see that the POItemQuote methodAction is now correctly populated with backing_getPOQuote.items being passed in as param0



And that's it, add a page to show the result of the service, add a navigation case to it and run!

Friday, September 15, 2006

SOA and the Database - Heresy?

It comes up a lot at conferences and seminars: Where should my business logic reside - the database or the middle-tier? In the SOA world you might think that using the database was the wrong choice, but why not leverage your existing DB-level validation from your Business Services?

I recently had some correspondence with Kent Graziano of ODTUG fame on just this topic. He says, "essentially we generate the TAPI and the associated DB triggers on all tables. The developers then write simple insert, update, and delete SQL against the tables to pass the required data elements. The triggers fire the TAPI procedures and fill in the auto generated stuff (sequence ids, date created, user created, etc). And voila you get referential integrity without coding in the middle tier. One of our apps is even generating the journal records automatically for audit trail. In addition all these applications rely on Oracle views or materialized views (from our read-only ODS) as the source for all the drop down lists. Seems that may be an SOA-type approach as well since we have abstracted the data one layer above the actual database tables (and we reuse the same view definitions for multiple applications to insure one-source of truth across the apps)."

I don't see anything wrong with this approach. Of course, from an SOA point of view you must ensure that your services are just that, and not too fine-grained, but that can be dealt with in or above the DB level in whatever technology or framework you choose to develop business services in.

Moving forward, it might be that Kent's application developers will take advantage of the benefits of middle-tier business logic and rules - for instance using the ESB and Rules Engine of Oracle's SOA Suite - but that's another discussion! So, am I an SOA-heretic to use database logic and services in the same sentence?

Thursday, June 22, 2006

Developing J2EE1.3 and 1.4 Web Services in tandem

Alan Gibson, one of our engineering gurus here in JDeveloperland, gave me this tip recently for developing both J2EE 1.3 and 1.4 services in the same application.

1. Add your base Java implementation to project1
2. Create project2 for your J2EE1.3 Web service
3. In the Dependencies tab of the Project Settings for project2, check project1 as a dependency
4. Publish your J2EE1.3 service in this project
5. Repeat steps 2-4 for a J2EE1.4 service

There is a bug in the J2EE1.3 service creation that means the node for the web service will show up in project1, but the crucial thing is that the J2EE1.3 web.xml file will go into project2, so this solution does work properly when you deploy or run it.

This is a good example of the way you can use project dependencies to separate your base logic from the service artifacts - even if you only have one kind of service implementation.

Friday, June 09, 2006

Watch a demo using BPEL in an ADF application

I've just published a demo on OTN that runs through integrating a BPEL process in an Oracle ADF application. It's so easy, so 4GL! Check it out and let me know what you think.

Tuesday, June 06, 2006

<any> Element can be mapped in a Web Service

Recently I was reading ecco's blog on Web Services and XML Documents and although he is correct saying don't use org.w3c.dom.Element in your method signature I realised that I'm often asked how to deal with just this scenario. What happens is that the infamous <any> is generated into your WSDL types and you need to be able to map that to the correct XSD. But help is at hand if you are using JDeveloper. Here are the simple steps to map Element to your XSD of choice - and you can do this pre or post generation using the Web Services Editor.

Take a really simple class as an example:

An extract of the WSDL generated for this class looks like:

But if you have the XSD that actually corresponds to your Element (and changing the Java method signature is not an option):

Then you can use the Web Services Editor to add a custom mapping between Element and blahType

You'll need a dummy serializer (even though Element is already serializable), here is a simple example:

And that's it, now your generated WSDL looks like this:

No ugly <any> in sight!

Thursday, June 01, 2006

So, you need a keystore?

I've just finished writing a tutorial on using JDeveloper to apply security, deploy and call secure J2EE, WS-Security web services.

JDeveloper provides a great environment for testing security. It allows you to add authentication, integrity and encryption settings and keystore to a service and then develop and secure a client proxy to test the security. And because JDeveloper comes with a J2EE container you can deploy and monitor the services too. But I digress.

In the course of developing the tutorial I did some research on Keystores and creating self-signed X509 certificates to use in a test environment. My tutorial uses Sun's Keytool utility to generate keys and a keystore. But what if you needed to use later versions of X509 certificates? Keytool generates V1 certificates only.

That's when you need something more powerful. And I found a couple of opensource products that fit the bill - especially as they both offer good GUIs.

First, Abylon SelfCert creates PKCS #12 (Personal Information Exchange Syntax Standard) format keys.



And to get those keys into a jks keystore I like Portecle (say "porte cle" with a French accent). Here it's simple to open the .pfx files, check the certificate version; change the keystore type to JKS, JCEKS, BKS, UBER; set passwords and many other things as well as import additional key pairs

Friday, May 26, 2006

Creating a PL/SQL Web Service from Oracle XE Database

If you want to use Oracle JDeveloper 10.1.3 to publish Web services from PL/SQL packages you will come across this gotcha'.
Oracle XE (Oracle 10g Express Edition) does not come with SQLJUTL. This is used by JDeveloper to publish the Java wrappers around a PL/SQL package for exposure as a Web service. But the workaround is simple.
In the <jdev_home>\sqlj\lib directory there is a copy of sqljutl.sql
Load the package in sys schema (the script contains 2 packages - you don't need the sqljutl2 package - it will not compile if you try and load it) and grant execute to public and carry on using the great PL/SQL Web Service Generation features that JDeveloper offers.

How to Publish an Oracle ADF Business Component as a Web Service in JDeveloper 10.1.3

It's a question that comes up regularly. You have a custom method in your Business Component Application Module and want to expose it as a web service. The way it's done has changed a little since 10.1.2.

First you want to expose the method to the client interface
  1. Open the Application Module Editor
  2. Select the Client Interface page and shuttle the method to the Selected list


Now you can generate a Web service from the methods in the client interface

  1. In the Application Module Editor, select the Remote page
  2. Select the Client Interface page and shuttle the method to the Selected list
When you click OK to close the application module editor, the Web service is generated using the <appmod name>Server.java class created by making the application module remoteable.

There is a bug in JDeveloper 10.1.3.0 that results in JDeveloper hanging if you re-enter the application module editor to make any changes after you have generated a Web service (it is clicking OK - and therefore trying to regenerate the web service, that causes the hanging). To avoid this, the workaround is to delete the Web service (File -> Erase from Disk with the Web service node selected) and then open the editor to make any application module changes .
I'm expecting this to be fixed in Service Update 4.

You can read more about Web Services and Oracle ADF Business Components in the
Oracle Developer's Guide for Forms/4GL Users.

Monday, May 08, 2006

RPC, Document, Bare, Wrapped, Literal- Get It Straight

It's something it's taken me time to fathom - just when, why and how do you
choose the SOAP Message format for your JAX-RPC web service?
The first choice is Document or RPC? For me, that's an easy one - if I'm using JAX-RPC then I probably care about standards, consistency, portability and interoperability. I'm probably going to use WS-I to check that services I create and use are WS-I Basic Profile compliant. I could use RPC/Literal but my SOAP message can't be entirely described by a schema so I'll discard that and stick to the Document style.
Now the more complicated part - made more so by the web services world changing the terms, finding better ways of expressing itself. Document style services send an XML document over SOAP. It's how they describe the <schema> that is a big differentiator.
Document/Bare (also know as Document/Literal) is considered by many to be the default and best method. It is simple, it takes a single method argument. Document/Wrapped wraps multiple arguments into one argument in the WSDL schema.
So consider the following method that adds a new address to an address book:

public boolean addEntry(Address address)

Using JDeveloper 10g to generate a Doc/Bare WSDL would give a <schema> element of:

<types>
<schema
...
<complexType name="Address">
<sequence>
<element name="streetName" type="string" nillable="true"/>
<element name="streetNum" type="int"/>
<element name="city" type="string" nillable="true"/>
</sequence>
</complexType>
<element name="addEntryElement" type="tns:Address" nillable="true"/>
<element name="addEntryResponseElement" type="boolean"/>
</schema>
</types>

A complexType Address has been created from the object type and is referenced in the addEntryElement. The addEntryResponseElement simply returns the method's boolean with no need to create a complexType to reference to.
Compare that with a Doc/Wrapped WSDL of the same method:

<types>
...
<complexType name="addEntry">
<sequence>
<element name="address" type="tns:Address" nillable="true"/>
</sequence>
</complexType>
<complexType name="Address">
<sequence>
<element name="streetName" type="string" nillable="true"/>
<element name="streetNum" type="int"/>
<element name="city" type="string" nillable="true"/>
</sequence>
</complexType>
<complexType name="addEntryResponse">
<sequence>
<element name="result" type="boolean"/>
</sequence>
</complexType>
<element name="addEntryElement" type="tns:addEntry"/>
<element name="addEntryResponseElement"type="tns:addEntryResponse"/>
</schema>
</types>

In this case there are 3 complexTypes: The complexType Address has been 'wrapped' inside a complexType addEntry. It is addEntry that is now referenced by addEntryElement. Plus a third complexType addEntryReponse has been created to hold the boolean response.
So it appears that the Doc/Wrapped form is more complicated - why do we need it? Well, it may be that you have existing code that you want to publish as a web service and these methods (or PL/SQL etc.) have multiple parameters. It may be that you don't want to go edit existing applications to create methods with a single argument or go to the bother of creating 'wrapper' methods with single arguments but want the web service to take care of that for you. This is a typical 'bottom-up' approach to web service development. Most tools use this as the default setting for creating services bottom-up
So continuing with the address theme, consider this method that creates an address object inside it:

public boolean addAddress(int sNum, String sName, String city)

This method could not be published as a Doc/Bare service but using the Doc/Wrapped approach you would finish up with:

<types>
...
<complexType name="addAddress">
<sequence>
<element name="sNum" type="int"/>
<element name="sName" type="string" nillable="true"/>
<element name="city" type="string" nillable="true"/>
</sequence>
</complexType>
<complexType name="addAddressResponse">
<sequence>
<element name="result" type="boolean"/>
</sequence>
</complexType>
<element name="addAddressElement" type="tns:addAddress"/>
<element name="addAddressResponseElement" type="tns:addAddressResponse"/>
</schema>
</types>

Although it might appear that this is very similar to the original Doc/Bare example (and it is!), except of course that it has a 2nd complexType for the boolean return, consider a method with arguments that were objects - each of those would be 'wrapped' in a complex type so the definition could get quite complicated.

So what's the conclusion? I wouldn't dream of saying that I had the definitive answer. But it certainly seems that Doc/Bare is preferable and simpler where practical. However, if a Java client proxy will be used to call your service then perhaps you might consider a Doc/Wrapped style as you can unpick the document of a doc/wrapped operation to get back the same parameter list easily. Confused? That's standards and choice for you.