« March 2005 | Main | June 2006 »

January 19, 2006

Oracle + Java + SOAP + PHP = headache

Well, I promised some stuff about my most recent project; here's the first installment.
I am just completing writing a Web Service in Java that's deployed on Oracle's Application Server. The actual Java code to implement the basic Web Service was very simple to write. I use Oracle's JDeveloper (probably the nicest all-around Java IDE I've used. Not w/out its drawbacks, but overall the best one I've tried), so I just wrote a class with some public methods, used JDeveloper's deployment tools, and I had a Web Service. That was the easy part.

The difficulties reared their ugly heads up when I started getting grand ideas about the WSDL. There are two ways to approach WSDL creation: Write it first, then use it to generate both the server-side and client-side skeleton code, or you can write the server-side skeleton and use a tool to generate a WSDL, from which client code can be generated. I elected to do the latter: writing my Java server-side code and using first AXIS, then JDeveloper to generate a WSDL from the classes. Oracle's Application Server also has the ability to generate a WSDL from a Web Service on the fly, but that WSDL is ugly and not very useful, so I never really considered it as an option.
One of the first ways I wanted to improve upon the WSDL was to remove the Java class package names. For example, if my classes were in the package peter.webservices, then whenever one of my classes appeared in the WSDL, it was referred to as peter_webservices_. Not wanting any consumers of my web service to have to refer to any objects with the package name prepended, I spent a bit of time removing those package names from the WSDL. I first tried creating packageless classes, which looked good in the WSDL, but then I had to use the "tempuri.org" namespace (see tempuri.org for more info about that namespace) in order for the server to recognize the objects.
Cutting through hours of research and testing, I finally figured out that I could add to the web.xml file included in the deployment "war" file, a "custom-bean-qname" parameter that mapped WSDL complex type names to my Java class names. I got the idea here, then extended it to multiple mappings by separating mappings with semi-colons. I never found any mention of using a semi-colon to declare multiple mappings; found that through trial and error (mainly error).
My next battle was saving the actual request for auditing purposes. by the time my Java code had access to the request, it was parsed into parameters and classes. More on that later.

Posted by Peter at 09:21 PM

Another year, another, uh, dollar?

Well, it's another year.
Doh.
Anyway, I'm mainly writing this entry so that this page isn't blank.
I changed the template; added links to the PHP install guide and the colormatch page on the side. Well, that's cool, but in order to display them, I had to rebuild the page. I accidentally rebuilt the whole site, resulting in my previous posts being relegated to the archives, with the front page left blank.
You can check out the new links over there ------------------------>
Rather than having a blank front page, I figured I'd post some inane dribble to fill space.

I should actually post some more useful content based on some of the work I've been doing recently.
I'm just wrapping up a web service written in Java, hosted on an Oracle Application Server. I wrote an SDK for client-side use, and one of our clients is writing a PHP-based client using PHP 5's new SOAP implementation. The project has been much longer than anticipated, mainly because of unforseen bugs and glitches with both the Oracle SOAP server platform and the PHP client-side SOAP implementation.
I'll work up another post related to that...

Posted by Peter at 08:58 PM