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