Thursday, April 20, 2006

Mapping the Websphere Portlet Wiring Jungle

While great for inter portlet communication, IBM's concept of inter portlet comms by "wiring" using WSDL is a complicated one and easy to screw up. Here's some notes I've made as I've made my way through getting it working:

Types: Describes data types (using XML schema) that can be emitted by the source portlet.
Messages: Describes messages that can be produced or consumed by the portlet.
Port Type: Describes the abstract interface of the portlet, as seen by the property broker.
Binding: Describes how the abstract interface (port type) is implemented.

Portlet HTTP Request Parameter Name (the wire action to call) ="XXXXX" ->
that portlets wsdl <binding... <operation... <portlet:action name="XXXXX"

Portlet HTTP Request Parameter Name (the value to pass) ="AAAAA" ->
that portlets wsdl <binding... <operation... <output... <portlet:param name="AAAAA"

that portlets wsdl <binding... <operation... <output... <portlet:param part-name="BBBBB" ->
that portlets wsdl <message... <part... name="BBBBB"

that portlets wsdl <binding... <operation... name="CCCCC" ->
that portlets wsdl <portType... <operation... name="CCCCC"

that portlets wsdl <binding type="tns:DDDDD" ->
that portlets wsdl <portType name="DDDDD"

that portlets wsdl <portType... <operation... <output message="tns:EEEEE" ->
that portlets wsdl <message... name="EEEEE"

that portlets wsdl <message... <part... type="tns:FFFFF" ->
that portlets wsdl <types... <xsd:schema... <xsd:simpleType name="FFFFF"

that portlets wsdl <types... <xsd:schema... <xsd:simpleType name="GGGGG" ->
that portlets wsdl <message... <part... type="tns:GGGGG"
NOTE: These datatypes must be the same as those in the output portlet wsdl

that portlets wsdl <message... name="HHHHH" ->
that portlets wsdl <portType... <operation... <input message="tns:HHHHH"

that portlets wsdl <portType name="IIIII" ->
that portlets wsdl <binding type="tns:IIIII" ->

that portlets wsdl <portType... <operation... name="JJJJJ" ->
that portlets wsdl <binding... <operation... name="JJJJJ"

that portlets wsdl <message... <part... name="KKKKK" ->
<binding... <operation... <input... <portlet:param part-name="KKKKK"

that portlets wsdl <binding... <operation... <input... <portlet:param name="LLLLL" ->
Portlet code request.getParameter("LLLLL"); // the passed value

that portlets wsdl <binding... <operation... <portlet:action name="MMMMM" ->
Portlet code request.getParameter("MMMMM"); // the called action


Friday, April 14, 2006

Setting the Default Goal in Maven 1.0.2

To set the default goal in a maven 1.0.2 project, add it to the 'project' tag in maven xml as an attribute. E.g.:


Wednesday, April 12, 2006

Another Stupid JSP Mistake
If you want to directly embed the output of a Java bean property in your jsp you need to surround the call to the getter with '<%= %>' and not '<% %>' as I initially was doing...
Another JSTL EL Gotcha

I just spent agfes banging my head against a JSP null pointer exception.

It turned out that the reason I was getting it was because I was using JSTL 1.0 but had tried to use '[n]' notation to access a list. Something which seems only to be available in JSTL 1.1...

For more info check out: The JSTL Expression Language > Operators
The Significance and Importance of Quotes in JSTL EL

I just spent a few hours debuggung a null pointer in a Portlet JSP I'm writing. It's notoriously difficult as you need to deploy to see if you've cocked up and if the error is in your jsp, even decompiling the result can be of no use as this loses the comments and consequently the error of the line number is meaningless. I was reduced to cutting the page down to the barest minimum and then putting the bits back, one at a time to see where my mistake lay... (Ignore the wierd tags, that's there to get this to display properly)

As it turned out, the error was a particulary few-pixelled one. I had:

...c:when test="${not empty sessionBean.myProtoSubscription.mySubscribedEntityId}">
...c:when test="{sessionBean.myProtoSubscription.mySubscribedEntityId" > 0}">

Where mySubscribedEntityId was a Long. I thought this would be the problem as the error was about a "null" and feared the Long > long transition would be the cluprit. How wrong was I. I'd just missed out two tiny quotes round the '0'. This now works:

...c:when test="${not empty sessionBean.myProtoSubscription.mySubscribedEntityId}">
....c:when test="sessionBean.myProtoSubscription.mySubscribedEntityId"> '0'}">

Read more about JSTL EL "not empty" tags here

Tuesday, April 04, 2006

More SQL...

We wanted to change a field in every one of our defendants so that they had a "PrisonerID" based on their defendant id (which was the primary key) with a prefix of 'PR00'. We did the following (on MySQL 5):

mysql_prompt> update defendants set prisonerId=concat('PR00', defendantId);
MySQL Database Dumping Command Quickie

I try and avoid using databases so much that I can never remember any commands, but I've had to look this up more than once:

DOS_PROMPT> mysqldump --user=[UID] --host=[server] --password --opt [database] > [filenameForDump.sql]

Lots more info is in the manual at:

MySQL 5.0 Reference Manual :: 8.10 mysqldump — A Database Backup Program

It alows you to dump the schema creation sql as well as sql to load the current data.

BTW, remember there's also
to enable / disable foreign key constraint checking for the duration of any upload