Thursday, March 29, 2007

The Firefox is a Panda!

pencil icon, that"s clickable to start editing the post

I was really surprised to read the Mozilla Firefox - Brand Name FAQ since it turns out that a Firefox is not a fox but a Red panda (Ailurus fulgens). I guess it means that Foxes and Pandas are closer in the evolution than I have thought prior.

Read more

Monday, March 26, 2007

WS-RX, WS-SX and WS-TX - what's the status?

pencil icon, that"s clickable to start editing the post

In the current version of the WSRM from the WS-RX TC, it says:

Many errors can interrupt a conversation. Messages can be lost, duplicated or reordered. Further the host systems can experience failures and lose volatile state.

This got me thinking that why has it to be a conversation and even though I haven't read it yet I guess it doesn't have to, but ex. there is no need for in-order if there is just one message, so it could just be this way to have an advanced use case/scenario. Any way this and the stuff about setting up a context made me recall that I once looked at the WS-Secure Conversation proposal at some time - how does that fit in? I went on a search and discovered that there actually three exchange TC's in Oasis:

So what specifications are they working on and what's the status?

OASIS Web Services Reliable Exchange (WS-RX) TC

The following specification sets produced by this TC underwent the first Public Review cycle from Aug 24, 2006 to Oct 21, 2006:

Doesn't say when they expect it to be final.

OASIS Web Services Secure Exchange (WS-SX) TC

There has been a public review for the WS-Trust and WS-SecureConversation specifications, as described in the Public Review Announcement, and it was from the 5 September 2006 to the 14 November 2006:

Here again I haven't found any time estimate for the final standards.

OASIS Web Services Transaction (WS-TX) TC

This is the most actual with the 3 specifications listed below in Technical Work Produced by the Committee are the approved Committee Specifications that the OASIS membership is considering (throughout March 2007) adopting as an OASIS Standard.

SO these could soon become final and real standards.

Read more

Saturday, March 24, 2007

What kind of reliability do I get with Web Services Reliable Exchange (WS-RX)?

pencil icon, that"s clickable to start editing the post

A unified standard for reliable exchange of web service messages has been missing in the WS-* family for some time, but is soon to be done (last time I heard was in mid 2006 that it was expected in December 2006). Thinking of when and where got me back to some old thoughts about what it's all about. That is do I need it? and when do I need it?, as well as the opposite answers when can i discard it? Here's my (non expert) thought on that.

On the one hand it seems obvious that it should always be reliable, because why should I make something that doesn't always work? On the other hand so much has been running nicely for so long without these painful thoughts (based on a risk assessment or simply being optimistic and pragmatic. That's taken that I even know what I mean when i write reliable and even more what others mean by it. The term has meaning all through the architecture layer, from the business level of an reliable business partner, to the process level with reliable processes (sub and super processes), down to the reliable messaging and protocols that ensure that. The decision as to the need for reliability has to come from the business needs, but I guess that there are aspects or facets that could make the different layers realize this in different ways, with the proper decoupling between the layers.

It seems natural that the baseline does not involve reliability and to get reliability an effort has to put into it. How big an effort and what measures does it account for, that is what potential problems and error cases does it resist?

Taken a top down approach the Wiktionary has the following definition of Reliability:

  1. The quality of being reliable, dependable, or trustworthy.
  2. A quality of a measurement indicating the degree to which the measure is consistent, that is, over repeated measurements would give the same result.

and the Wikipedia definition of reliability contains:

In general, reliability (systemic def.) is the ability of a system to perform and maintain its functions in routine circumstances, as well as hostile or unexpected circumstances.

The IEEE defines it as ". . . the ability of a system or component to perform its required functions under stated conditions for a specified period of time."

and defines a reliable protocol as:

In computer networking, a reliable protocol is one that ensures reliability properties with respect to the delivery of data to the intended recipient(s), as opposed to an unreliable protocol, which does not guarantee that data will be delivered intact, or that it will be delivered at all.

Java Message Service (JMS)

The first thing i think of when associating on reliable messaging is JMS. A quick googling lead to the Novel JMS FAQ the question is messaging reliable?
While the quality-of-service guarantees offered in Message Oriented Middleware solutions can vary greatly, and while real-world reliability often depends on administrative issues (such as cluster size and available resources), all JMS-based messaging services are required to offer assured, once-only delivery of messages as an option for applications where reliability is paramount. JMS also allows for configurations that provide a less robust quality of service, so that in cases where speed of delivery might be more important than assured, once-only delivery, a tailored solution can be built. The reliability of JMS-based messaging solutions is thus configurable.

so reliable for JMS means assured, once-only delivery of messages. The JMS standard (Version 1.1 April 12, 2002) can be picked up at Suns JMS documentation. This is an API and not a wire protocol The JMS API is an API for accessing enterprise messaging systems from Java programs:

Enterprise messaging products (or as they are sometimes called, Message Oriented Middleware products) are becoming an essential component for integrating intra-company operations. They allow separate business components to be combined into a reliable, yet flexible, system.

Yep, it's reliable, but it doesn't say much more about it except in the FAQ 10.1.6 Should JMS Provide End-to-end Synchronous Message Delivery and Notification of Delivery?:

Some messaging systems provide synchronous delivery to destinations as a mechanism for implementing reliable applications. Some systems provide clients with various forms of delivery notification so that the clients can detect dropped or ignored messages. This is not the model defined by JMS.

JMS messaging provides guaranteed delivery via the once-and-only-once delivery semantics of PERSISTENT messages. In addition, message consumers can insure reliable processing of messages by using either CLIENT_ACKNOWLEDGE mode or transacted sessions.

This achieves reliable delivery with minimum synchronization and is the enterprise messaging model most vendors and developers prefer.

JMS does not define a schema of systems messages (such as delivery notifications). If an application requires acknowledgment of message receipt, it can define an application-level acknowledgment message.

These issues are more clearly understood when they are examined in the context of Pub/Sub applications. In this context, synchronous delivery and/or system acknowledgment of receipt are not an effective mechanism for implementing reliable applications (because producers by definition are not, and don’t want to be, responsible for end-to-end message delivery).

so it's up to the application level if further receipts are needed.

OASIS Web Services Reliable Exchange (WS-RX)

On the homepage for the TC, there are a link to the overview RDDL page with a link to the current WS-RX specification

A look in here gives a definition of what WS-RX is all about (could be an easier read and a FAQ would also be nice). In the start it says:

Many errors can interrupt a conversation. Messages can be lost, duplicated or reordered. Further the host systems can experience failures and lose volatile state.

So it's the same thing as JMS, we want to avoid duplicated or 'wrong'-ordered messages and of course loosing messages.

The WS-ReliableMessaging specification defines an interoperable protocol that enables a Reliable Messaging (RM) Source to accurately determine the disposition of each message it Transmits as perceived by the RM Destination, so as to allow it to resolve any in-doubt status regarding receipt of the message Transmitted. The protocol also enables an RM Destination to efficiently determine which of those messages it Receives have been previously Received, enabling it to filter out duplicate message transmissions caused by the retransmission, by the RM Source, of unacknowledged message. It also enables an RM Destination to Deliver the messages it Receives to the Application Destination in the order in which they were sent by an Application Source, in the event that they are Received out of order. Note that this specification places no restriction on the scope of the RM Source or RM Destination entities. For example, either can span multiple WSDL Ports or Endpoints.

The same story with more words and som abstract source and destination semantics.

The protocol enables the implementation of a broad range of reliability features which include ordered Delivery, duplicate elimination, and guaranteed receipt. The protocol can also be implemented with a range of robustness characteristics ranging from in-memory persistence that is scoped to a single process lifetime, to replicated durable storage that is recoverable in all but the most extreme circumstances. It is expected that the Endpoints will implement as many or as few of these reliability characteristics as necessary for the correct operation of the application using the protocol. Regardless of which of the reliability features is enabled, the wire protocol does not change.

I'm not really sure if the guaranteed receipt is an addition comparing with JMS, since I guess it's implicit in the specific JMS implementations.

In an Interview with the OASIS WSRX Co-chair - Paul Fremantle he answers the question How does WSRM compare to existing reliable messaging systems such as JMS? with:

The Java Messaging Service API (JMS) is widely adopted, but this doesn't offer an interoperable wire protocol. So you can't talk from one vendor's JMS implementation to another without some kind of bridging in the middle. The other key difference is that WSRM doesn't require you to change your programming model. Because SOAP is already a message based model, you can add reliability in without having to think about concepts such as queues and topics. The result is that WSRM can be very easy to implement if you already have a SOAP or XML based architecture.

This is more an overall architecture answer, but i guess the meaning in terms of reliability is that they are very much alike.

Read more

Friday, March 23, 2007

Layouts data tags in blog post

pencil icon, that"s clickable to start editing the post
After having worked with the blogger templates for some time I got the idea that it might be possible to use the template tags in the blog posts and not just in the template. What happens if I insert:
<data:blog.pageTitle xmlns:data='http://www.google.com/2005/gml/data' />
that's right - nothing happens!, which must be because the blog posts are inserted after the pass by the template engine.

Read more

Thursday, March 22, 2007

Valid XHTML - the layout tags

pencil icon, that"s clickable to start editing the post

A problem with the layout tags are that some of the scalars (attributes or functions) that produces URL's and some of these af not valid XHTML because of the Ampersands (&'s) in URLs, an example is in the BlogArchive widget:

<a class='post-count-link' expr:href='data:i.url'>
   <data:i.name />
</a>
which produces URL's like
http://blog.sweetxml.org/search?updated-min=2007-01-01T00%3A00%3A00%2B01%3A00&updated-max=2008-01-01T00%3A00%3A00%2B01%3A00&max-results=12
URL: http://blog.sweetxml.org/
PATH: /search PARAMTER:
  • updated-min=2007-01-01T00%3A00%3A00%2B01%3A00
  • updated-max=2008-01-01T00%3A00%3A00%2B01%3A00
  • max-results=12
the variable i comes from this loop:
<b:loop values='data:intervalData' var='i'>
so the intervalData is of a collection or array type. This loop is part of an includable template component where the intervalData is defined:
<b:includable id='interval' var='intervalData'>
described in Widget Tags for Layouts. This is included when using HIERARCHY for blog archive
<b:if cond='data:style == "HIERARCHY"'>
   <b:include data='data' name='interval' />
</b:if>
so the variable data (used as intervalData) is transfered to the includable template component. This finally is part of the widget of type BlogArchive
<b:widget id='BlogArchive1'
          locked='false'
          title='Blog Archive'
          type='BlogArchive'>
So the data (confusing enough not prefixed) must be globally available in this widget. In the Layouts Data Tags has a description of the data available to the Blog Archive:

The different styles provided here are for the different default options on the Page Elements tab. If you're designing a new version, it's easiest to use 'FLAT' as the style, and then manipulate the rest of the data as desired.

  • title: The title of the widget.
  • style: One of 'MENU', 'FLAT', or 'HIERARCHY'.
  • data: A list of each archive unit, each of which contains:
    • name: The name of this archive interval, e.g. "August 2006."
    • url: The link to the page containing posts from this interval.
    • post-count: How many posts there are in this interval.
I hope it's possible to access the start og end date (year or month).
ecmanaut - Blogger beta templates

Read more

Wednesday, March 21, 2007

My favorite Firefox add-ons

pencil icon, that"s clickable to start editing the post

One of the great features of Firefox is the openness for add-on's. I've picked up some of these over time and I think it's time to sum up:

I've just upgraded to Firefox2 (Danish version) by following a hint on how to upgrade by yum over at www.linuxquestions.org which was surprisingly easy, glad that I did that search prior to just going for the tarball.

Read more

Valid XHTML - hacking the template

pencil icon, that"s clickable to start editing the post
Work in progress

Certain changes has to be done to the template to ensure that the it resolves to valid XHTML 1.0.

Namespace declarations

The template default has all the namespace declarations in the root <html> element which in principle is clean and simple:
<html xmlns='http://www.w3.org/1999/xhtml' 
      xmlns:b='http://www.google.com/2005/gml/b' 
      xmlns:data='http://www.google.com/2005/gml/data'
      xmlns:expr='http://www.google.com/2005/gml/expr'>
The problem is that the stay there even after the trip through the template engine, where the layout tags are resolved, and results in invalid XHTML (W3C validator) - extra namespace declarations shouldn't really be a problem, but the (stupid) DTD's that define XHTML 1.0 are NOT namespace aware and these declarations are seen as extra and invalid attributes. The solution is to move these declarations to the elements where they are needed, like ex. changing:
<b:include data='blog' 
           name='all-head-content'/>
to
<b:include xmlns:b='http://www.google.com/2005/gml/b' 
           data='blog' 
           name='all-head-content'/>

Resolved entities

Maybe the biggest problem with the transition from the SGML-ish HTML to the XML-ish XHTML is the collision between defined entities and the parameter splitter in URL's, as described in the article Ampersands (&'s) in URL's. To make bad worse the template engine resolves these entities, so that ex. and &amp; ends up like & (missing the 'amp;'). To get around this problem and extra 'amp;' has to be inserted, so that:
'"http://www2.blogger.com/email-post.g?blogID=59174493096083971&amp;postID=" + data:post.id'
is changed to
'"http://www2.blogger.com/email-post.g?blogID=59174493096083971&amp;amp;postID=" + data:post.id'
and this will end up like:
http://www2.blogger.com/email-post.g?blogID=59174493096083971&postID=7652344227457000560
for this post.

Custom elements in style comments

    <style id='page-skin-1' type='text/css'>
/*
-----------------------------------------------
Blogger Template Style
Name:     Minima Stretch
Designer: Douglas Bowman / Darren Delaye
URL:      www.stopdesign.com
Date:     26 Feb 2004
----------------------------------------------- */

/* Variable definitions
   ====================
   <Variable name="bgcolor" description="Page Background Color"
             type="color" default="#fff">
   <Variable name="textcolor" description="Text Color"
             type="color" default="#333">
   <Variable name="linkcolor" description="Link Color"
             type="color" default="#58a">
   <Variable name="pagetitlecolor" description="Blog Title Color"
             type="color" default="#666">
   <Variable name="descriptioncolor" description="Blog Description Color"
             type="color" default="#999">
   <Variable name="titlecolor" description="Post Title Color"
             type="color" default="#c60">
   <Variable name="bordercolor" description="Border Color"
             type="color" default="#ccc">
   <Variable name="sidebarcolor" description="Sidebar Title Color"
             type="color" default="#999">
   <Variable name="sidebartextcolor" description="Sidebar Text Color"
             type="color" default="#666">
   <Variable name="visitedlinkcolor" description="Visited Link Color"
             type="color" default="#999">
   <Variable name="bodyfont" description="Text Font"
             type="font" default="normal normal 100% Georgia, Serif">
   <Variable name="headerfont" description="Sidebar Title Font"
             type="font"
             default="normal normal 78% 'Trebuchet MS',Trebuchet,Arial,Verdana,Sans-serif">
   <Variable name="pagetitlefont" description="Blog Title Font"
             type="font"
             default="normal normal 200% Georgia, Serif">
   <Variable name="descriptionfont" description="Blog Description Font"
             type="font"
             default="normal normal 78% 'Trebuchet MS', Trebuchet, Arial, Verdana, Sans-serif">
   <Variable name="postfooterfont" description="Post Footer Font"
             type="font"
             default="normal normal 78% 'Trebuchet MS', Trebuchet, Arial, Verdana, Sans-serif">
*/
This problem does partly come from the template engine again since it removes CDATA declaration as the recommendation says in 4.8. Script and Style elements. In fact in C.4. Embedded Style Sheets and Scripts it says:
Use external style sheets if your style sheet uses < or & or ]]> or --.
which is the case here, but since the template stays as one file this ends up invalid (blogger should just split it into a custom css-file (there are plenty of them already). To eliminate this problem I have two options, one is to embed it in a comment section.
Therefore, the historical practice of "hiding" scripts and style sheets within "comments" to make the documents backward compatible is likely to not work as expected in XML-based user agents.
since these variables are only needed on the server side and not in the final web page, so ignoring it doesn't do any harm. The other options is to try to create a CDATA section

The lang attribute

A minor change to follow the recommendation is in C.7. The lang and xml:lang Attributes

Read more

Tuesday, March 20, 2007

Valid XHTML - blog post revisited

pencil icon, that"s clickable to start editing the post
In my former post called Valid XHTML - blog post I wrote about the trouble I had with creating (XHTML) valid posts. After having thought some more about it and worked with ajusting the template I realized that maybe there is a much simpler and obvious solution - fixing the template!
In the <b:includable id='post' var='post'> that is a child element of <b:widget id='Blog1' .. it simply says:

<div class='post-body'> <p> <data:post.body /> </p> <div style='clear: both;' /><!-- clear for photos floats --> </div>
Uhmm, that's real easy to change and I can't understand why the template is like that. This leads to another question that I've been thinking about Are all the template markup the same?, which can be rephrased as are all the customization done with CSS and the related variables?
This template is Minima Blue and changing template to Minima Stretch didn't change this but that's not a real good testcase since part of the template magic is that the widget's and their configuration stays eventhough the template is changed. I had to try another blog so i picked the next one which turned out to be Eric Hill's who's using Rounders 3 and it's just the same, so I'll conclude that it's a general configuration and a general bad idea :-).
I'll try changing it another day, but not right now when I've rewritte the post markup of several of my postings. I will then change permanently to Minima Stretc because it's simpler and easier to read black on white and not the least because it stretches to screenwidth.

Read more

Valid XHTML @ blogger.com

pencil icon, that"s clickable to start editing the post
When I looked at support for XPointer in Firefox I ended up using quite some time trying to get my blog pages (through blogger.com) to become clean and valid XHTML, as the template states. That was by far no easy, and the three main problem areas was:
* The template with markup
* The code thats included automatically by blogger.com (the navigation bar)
* The markup generated by the custom layout tags
* The markup used in the posts

I googled for some help but didn't find much and most of my findings were either for the old version of blogger.com or regrets that it still wasn't valid XHTML we are in the year 2007, more than 7 years after the first recommendation for XHTML.

Read more

Sunday, March 18, 2007

Inline favicon

pencil icon, that"s clickable to start editing the post
I another post Customize blog with favicon I added my custom favicon (at least for firefox users) and then I came to think that I could actually remove the dependency on my own server to hold the favicon by using the data uri scheme as shown in the post Inline image with data URI scheme. It's real easy and the image (replacing the the mimetype image/x-icon with the official image/vnd.microsoft.icon to better support the ico format, eventhough it doesn't make much sense since IE doesn't support the data uri scheme. Anyway here is the image:
Favorites Icon for Sweetxml, which is 'SX' in red on a white background
and it works nicely in firefox also when it's inserted in the header for a shortcut icon.

Read more

Monday, March 12, 2007

Valid XHTML - the blogger navigation bar

pencil icon, that"s clickable to start editing the post

After having used blogger.com for some time i wrote a post on XPointer and tried some of the syntax out in Firefox I discovered that the markup blogger.com produces is NOT valid XHTML, for a number of reasons. This post will dive into the navigation bar

The navigation bar is not part of the template but is inserted serverside. When i started validating the navigationbar (navbar) gave some of the errors. I don'y not mind the navigation bar since it's sort of fair that the blogger.com brand is on the page and it has some practical links - I just wanted it be valid XHTML 1.0, and frankly I was very surprised that it wasn't, since it's quite easy to fix and affects all blogs, and not the least the rumor has it that the search engine Google loves wellformed and maybe also valid documents ;-).

With a standard template I got this right after the <body> tag (my formatting):

<div
  class='navbar section'
  id='navbar'>
  <div
    class='widget Navbar'
    id='Navbar1'>
    <iframe
      src="http://www2.blogger.com/navbar.g?targetBlogID=591744930960839717&amp;blogName=Sweetxml&amp;publishMode=PUBLISH_MODE_HOSTED&amp;navbarType=BLUE&amp;layoutType=LAYOUTS&amp;homepageUrl=http%3A%2F%2Fblog.sweetxml.org%2Findex.html&amp;searchRoot=http%3A%2F%2Fblog.sweetxml.org%2Fsearch"
      height="30px"
      width="100%"
      marginwidth="0"
      marginheight="0"
      scrolling="no"
      id="navbar-iframe"
      frameborder="0">
    </iframe>
    <div id="space-for-ie"></div>
  </div>
</div>

The URL (http://www2.blogger.com/navbar.g) has the following paramters:

targetBlogID=591744930960839717
So each blog has it own identifier and mine is 591744930960839717
blogName=Sweetxml
The name of my blog is Sweetxml, but I don't see why it's needed as a paramter in the URL since it should be trivial to lookup based on the targetBlogID.
publishMode=PUBLISH_MODE_HOSTED
Don't knwo what this means but probably it beacause I use the online editor and not FTP?
navbarType=BLUE
The background color I think, haven't had time to experiment with it.
layoutType=LAYOUTS
Don't now what it means or if it's really needed.
homepageUrl=http%3A%2F%2Fblog.sweetxml.org%2Findex.html
The index page for my blog
searchRoot=http%3A%2F%2Fblog.sweetxml.org%2Fsearch
the root URL used when searching via Google

It gave me 9 errors:

Error  Line 409 column 100: there is no attribute "src".
Error  Line 409 column 390: there is no attribute "height".
Error  Line 409 column 403: there is no attribute "width".
Error  Line 409 column 422: there is no attribute "marginwidth".
Error  Line 409 column 439: there is no attribute "marginheight".
Error  Line 409 column 453: there is no attribute "scrolling".
Error  Line 409 column 461: there is no attribute "id".
Error  Line 409 column 489: there is no attribute "frameborder".
Error  Line 409 column 492: element "iframe" undefined.

And the last one does explain some - the iframe is not part of XHTML 1.0 Strict, that is iframe is not part of HTML 4.01 Strict which is the recommended version, as written in the DTD:

This is HTML 4.01 Strict DTD, which excludes the presentation attributes and elements that W3C expects to phase out as support for style sheets matures. Authors should use the Strict DTD when possible, but may use the Transitional DTD when support for presentation attribute and elements is required.

An alternative and valid XHTML implementation would be:

<div class='navbar section' id='navbar'>
   <div class='widget Navbar' id='Navbar1'>
      <object type="text/html"
          style="height: 30px; width: 100%; margin: 0px; overflow: hidden;"
          data="http://www2.blogger.com/navbar.g?targ......g%2Fsearch"
          id="navbar-iframe">
         Your browser could show this page as an object, click on this link to see the<a href="http://www2.blogger.com/navbar.g?t...h">navigationbar</a>.
      </object>
      <div id="space-for-ie"/>
   </div>
</div>

Now how do I replace the invalid version with the valid one? Since I can't change anything on ther serverside direct, it will have to be through the template. I did some googling, and ofcourse others have tried the same, one of the hits were from the forum. Most of the hits showed how to hide the navbar through css and with some considerations as to wheter is was okay or against the rules. As for the rules it's not clear since if yuo post though FTP it doesn't have to be there, as it say's on one of the help page about the navbar Unless you publish your blog via FTP, the Navbar cannot be disabled, not that i understand why.

It clear from the markup and the hacks that the navbar is inserted right after the body tag, and the ugly and invalid noembed tag was no acceptable for me, so I tried different things until i found a clean hack, that's inserted before the body tag in the template:

<script type="text/javascript">
<![CDATA[
<!--
/*<body>*/
function dummy () {
}
-->
]]>
</script>

I've probably gone overboard in the three levels of comments but that doesn't hurt. When updating the template if actually discovers that the template is about to be hidden (though I havent' figured out how it can be that clever), here a screendump:

here's what the pages ends containing:

<script type='text/javascript'>
<![CDATA[
<!--
/*<body>
  <b:section id="navbar" class="navbar" maxwidgets="1" showaddelement="no">
    <b:widget type="Navbar" id="Navbar1" locked="yes"/>
  </b:section>

*/
function dummy () {
}
-->
]]>
</script>

So the navbar is inserted as a template in part of a two step process.

The navigation bar markup

This makes a valid reference to the navbar but what about the markup in the navbar itself. I can't really understand why it's implemented as an iframe that reference another (X)HTML document since in my view it could easily have been implemented right in the page, instead of dereferencing i through an iframe, but there must be some architectural idea to it or maybe just an architecture decision at some point :-). Maybe I'll have a look at the actual markup in another posting.

Read more

Sunday, March 11, 2007

Valid XHTML - blog post

pencil icon, that"s clickable to start editing the post

One of the problem areas I had to address before I could produce valid XHTML was the contents of my posts. I thought I did it all right until i started validating just to discover that the structure was not what I had expected. I had expected that the posts would be embedded in a <div> tag but it isn't it's in a <p> tag, which limits that valid child elements, as can be seen from this overview of the paragraph tag. I produce my postings in the Edit Html mode but the problem would also be there if I used Compose mode, and in fact it's only with raw XHTML that I'll produce valid markup. In the compose mode one can make an ordered list with the normal <ul; and <li> tags but they are not allowed inside the <p> tag, so I've decided to drop them for now. Also <blockquote> and headlines with ex. <h2> are not allowed and not the lease <pre>. To overcome this I've added my own css classes to be used with <span>

/* custom classes due to limitation in markup allowed in 

tags*/ tiny { font-size:78%; } .small { font-size:85%; } .normal { font-size:100%; } .large { font-size:130%; } .huge { font-size:180%; } .h2 { font-size:130%; font-weight: bold; } .pre { color: black; white-space: pre; background-color:lightgrey; display: block; } .blockquote { margin:1em 20px; }

Here'a an example using the font sizes:
* This is Tiny text
* This is Small text
* This is Normal text
* This is Large text
* This is Huge text

Read more

Friday, March 9, 2007

Xpointer in firefox

pencil icon, that"s clickable to start editing the post

I haven't look at the Xpointer spec's for a long time, that's since the first one, but now I can see that there are now three recommendations since 25 March 2003:

It surprised me that the XPointer xpointer() scheme stranded as just a working draft. Before making this post i first tried out using this scheme because that was what I had used when I last used XPointer. The refence I used back then XML - in a Nutshell (first edition) is quite dated so it's about time I get an update :-).

I was pretty sure that firefox/mozilla would support XPointer, and it does support all three of them as stated on the XML in Mozilla page on Mozilla Developer Center, which is even outdated. It does not say why it's outdated and which version it relates to, but it's probably valid for FF1.5 and later. There are allso a testcase for XPointers, which I'll use for inspiration. I'll use one of my oven posts in the examples.

The testcase document is not a normal XHTML document, it start's with:

<!DOCTYPE doc [
<!ATTLIST mylink1 xlink:type CDATA "simple">
<!ATTLIST p id ID #IMPLIED>
<!ATTLIST div id ID #IMPLIED>
]>
<doc xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:html="http://www.w3.org/1999/xhtml">
  <html:style type="text/css">

It's also been a long time since I used DTD, so I had to look at the XML spec.

<!ATTLIST mylink1 xlink:type CDATA "simple">

Means that the mylink1 element can have an attribute named xlink:type (DTD's are not namespace aware so they are defined with prefix (QNAME)). This attribute is of CDATA (StringType) is also states in section 3.3.2 Attribute Defaults that the default value is simple:

In an attribute declaration, #REQUIRED means that the attribute MUST always be provided, #IMPLIED that no default value is provided. [Definition: If the declaration is neither #REQUIRED nor #IMPLIED, then the AttValue value contains the declared default value; the #FIXED keyword states that the attribute MUST always have the default value. When an XML processor encounters an element without a specification for an attribute for which it has read a default value declaration, it MUST report the attribute with the declared default value to the application.]

so if the element does not have an attribute the XML processor is to report it like it had one like xlink:type="simple". The other two attribute declarations says that the <p> and <dic> elements can have an attribute named id of the ID type. The #IMPLIED means that it's optional, and I have never realized why it's called implied (da: underforstået; stiltiende; implicit; (også) antydet; (jur.) indirekte.). These are defined as ID's since it's demanded by the XPointer spec where the definition of a DTD-determined ID (in section 3.2 Shorthand Pointer states:

[Definition: An attribute information item is a DTD-determined ID if and only if it has a [type definition] property whose value is equal to ID.]

and it's needed as stated in a note i en the end of that section:

A shorthand pointer provides, for resources with XML-based media types, a rough analog of HTML fragment identifier behavior. However, if ID typing information is not available because no DTD, schema, or application-specific information is available, the pointer will not identify any element. There are several ways to make element identification more reliable. For example, the creator of a resource can use an internal DTD subset to indicate the presence of ID-typed attributes, and the creator of a pointer can, instead of a shorthand pointer, use a scheme-based pointer or provide one or more schemes that address the desired element in other ways.

The post I'll be using as an example is Web traffic for the WSRP4J demo which should be a valid XHTML 1.0, but it isn't according to the W3C Validator service. The documents start like:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'
         xmlns:b='http://www.google.com/2005/gml/b'
         xmlns:data='http://www.google.com/2005/gml/data'
         xmlns:expr='http://www.google.com/2005/gml/expr'>

It states that it is a XHTML document following it strict in accordance with the XHTML 1.0 Strict DTD, but that's just not true (unfortunately).

The annotated DTD does show that the id attribute is defined and as of the ID type.

<!-- core attributes common to most elements
  id       document-wide unique id
  class    space separated list of classes
  style    associated style info
  title    advisory title/amplification
-->
<!ENTITY % coreattrs
 "id          ID             #IMPLIED
  class       CDATA          #IMPLIED
  style       %StyleSheet;   #IMPLIED
  title       %Text;         #IMPLIED"
  >

Read more

Customize blog with favicon

pencil icon, that"s clickable to start editing the post
On my old blog I had a favicon, which I somehow created with som hassel (foregotten now) and I wanted it on my new blog here at blogger.com. It turned out to be real easy because in Template -> Edit HTML it justed added the link in the HTML header like

<link href='http://www.sweetxml.org/favicon.ico' rel='shortcut icon' type='image/x-icon'/>
and voilá it's there. I had to google for the needed markup.
I would prefere to place the favicon external on ex. picasa, but since it only accepts jpeg and gif that's not an option. I don't think it's a real problem since it'll probably be cached by browsers and shown when my server is offline.

Wikipedia has a nice description of Favorites Icon.

Read more

Inline SVG in HTML

pencil icon, that"s clickable to start editing the post
Another way to define images inline in HTML would be with svg. Firefox does support part of the standard and more should come with the spring release of FF3. Let's see if this will work with the blogger editor:

Sweetxml

and it does, very nice. It even looks right in FF1.5 but IE7 only has the text I guess as the normal fallback and ignores the svg markup, that's IE without the Adobe plugin. What if i add it as an image using picasa? Nope, for some reason it only supports jpeg and gif, probably because it wants to manipulate the with thumbs etc, the error message looks like:

Read more

Thursday, March 8, 2007

Inline image with data URI scheme

pencil icon, that"s clickable to start editing the post
I just recalled that it is possible to inline an image and after som googling i (re)found that the trick is the data URI scheme. It's not because I need it for anything but it's a nice nerdy feature, because why should i fill my pages with binary content and avoid caching and also IE probably doesn't support it. Anyhow i used uuencode (my favorite commandline encoder) to generate the BASE64 string. But the blogeditor ruins it by inserting <br/> after each line in the BASE64 text so I will not show here, but fine from a local file on my harddrive. But then i found a hint that showed me how to disable these automatic line breaks and voilá:

I can add it as an image and the upload goes okay:

but in the blog post the line breaks are introduced again. I looks like it time to investigate some of the other options for posting.

Read more

Wednesday, March 7, 2007

Trying to be a consumer

pencil icon, that"s clickable to start editing the post
I my last post i looked at the SOAP on he wire between the WSRP4J producer and proxy portlet. After that I wanted to try it out for my self by writing a simple consumer (client) using axis2. I should be very simple since the standard contains the webservice interface (WSDL) which i nicely decomposed into seperate files for: the service definitions are like
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:oasis:names:tc:wsrp:v1:wsdl"
                  xmlns:bind="urn:oasis:names:tc:wsrp:v1:bind"
                  xmlns="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

  <import namespace="urn:oasis:names:tc:wsrp:v1:bind"
          location="wsrp_v1_bindings.wsdl"/>

  <wsdl:service name="WSRPService">
    <wsdl:port binding="bind:WSRP_v1_Markup_Binding_SOAP" name="WSRPBaseService">
      <soap:address location="http://my.service:8080/WSRPService"/>
    </wsdl:port>
    <wsdl:port binding="bind:WSRP_v1_ServiceDescription_Binding_SOAP" name="WSRPServiceDescriptionService">
      <soap:address location="http://my.service:8080/WSRPService"/>
    </wsdl:port>
    <wsdl:port binding="bind:WSRP_v1_Registration_Binding_SOAP" name="WSRPRegistrationService">
      <soap:address location="http://my.service:8080/WSRPService"/>
    </wsdl:port>
    <wsdl:port binding="bind:WSRP_v1_PortletManagement_Binding_SOAP" name="WSRPPortletManagementService">
      <soap:address location="http://my.service:8080/WSRPService"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
I first first tried to change the endpoints and run i through the Axis2 Codegen, but I only generates the Markup Binding, that is the others are generated by the can't overwrite it. I've therefore changed it to:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
  targetNamespace="urn:oasis:names:tc:wsrp:v1:wsdl"
  xmlns:bind="urn:oasis:names:tc:wsrp:v1:bind"
  xmlns="http://schemas.xmlsoap.org/wsdl/"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

  <import
    namespace="urn:oasis:names:tc:wsrp:v1:bind"
    location="wsrp_v1_bindings.wsdl" />

  <wsdl:service name="WSRPBaseService">
    <wsdl:port
      binding="bind:WSRP_v1_Markup_Binding_SOAP"
      name="WSRPBaseService">
      <soap:address location="http://localhost:8080/wsrp4j-producer/services/WSRPBaseService" />
    </wsdl:port>
  </wsdl:service>

  <wsdl:service name="WSRPServiceDescriptionService">
    <wsdl:port
      binding="bind:WSRP_v1_ServiceDescription_Binding_SOAP"
      name="WSRPServiceDescriptionService">
      <soap:address location="http://localhost:8080/wsrp4j-producer/services/WSRPServiceDescriptionService" />
    </wsdl:port>

  </wsdl:service>

  <wsdl:service name="WSRPRegistrationService">
    <wsdl:port
      binding="bind:WSRP_v1_Registration_Binding_SOAP"
      name="WSRPRegistrationService">
      <soap:address location="http://localhost:8080/wsrp4j-producer/services/WSRPRegistrationService" />
    </wsdl:port>
  </wsdl:service>

  <wsdl:service name="WSRPPortletManagementService">
    <wsdl:port
      binding="bind:WSRP_v1_PortletManagement_Binding_SOAP"
      name="WSRPPortletManagementService">
      <soap:address location="http://localhost:8080/wsrp4j-producer/services/WSRPPortletManagementService" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
So I've changed the ports to each have their own service (and runs Codegen four times, for each service name (@name). This works allright for me except that's I using four services instead of one, which does take an extra effort for ex. session handling that could have been clean out of the Axis2 box (dist). This is an example of the flexibility of WSDL, that seemingly the same can be done i several ways, even though I'm not sure what the semantic differences are. The W3C Note for WSDL 1.1 says the following about services: A service groups a set of related ports together, and that ports within a service have the following relationship:
  • None of the ports communicate with each other (e.g. the output of one port is not the input of another).
  • If a service has several ports that share a port type, but employ different bindings or addresses, the ports are alternatives. Each port provides semantically equivalent behavior (within the transport and message format limitations imposed by each binding). This allows a consumer of a WSDL document to choose particular port(s) to communicate with based on some criteria (protocol, distance, etc.).
  • By examining it's ports, we can determine a service's port types. This allows a consumer of a WSDL document to determine if it wishes to communicate to a particular service based whether or not it supports several port types. This is useful if there is some implied relationship between the operations of the port types, and that the entire set of port types must be present in order to accomplish a particular task.
Maybe the last bullet does imply that what I'm doing is not what should be done if I exposed it, but since I'm only consuming at therefore use to generate my stubs it doesn't really matter.

Read more

Thursday, March 1, 2007

Web traffic for the WSRP4J demo

pencil icon, that"s clickable to start editing the post
Work in slow progress Following the README with the WSRP4J dist I succeded in getting the demo running and heres a dump of the web traffic it generates as captured with the tcpmon tool. The traffic is between the wsrp4j proxy portlet and the wsrp4j-producer (forwarding the jsr168 testportlet that comes with wsrp4j). The portlet page that these (identical) portlets end up in looks like.

What do you have to offer

The first thing the proxyportlet does it to query the wsrp4j-producer about what portlets are available (done with axis 1.4 which the wsrp4j proxyportlet uses):
POST /wsrp4j-producer/services/WSRPServiceDescriptionService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:9101
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "urn:oasis:names:tc:wsrp:v1:getServiceDescription"
Content-Length: 386

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getServiceDescription xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <registrationContext xsi:nil="true" />
    </getServiceDescription>
  </soapenv:Body>
</soapenv:Envelope>

and the answer is
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Tue, 06 Mar 2007 09:25:03 GMT
Connection: close

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getServiceDescriptionResponse
      xsi:type="ns1:ServiceDescription"
      xmlns="urn:oasis:names:tc:wsrp:v1:types"
      xmlns:ns1="urn:oasis:names:tc:wsrp:v1:types">
      <ns1:requiresRegistration xsi:type="xsd:boolean">true</ns1:requiresRegistration>
      <ns1:requiresInitCookie xsi:type="ns1:CookieProtocol">perGroup</ns1:requiresInitCookie>
    </getServiceDescriptionResponse>
  </soapenv:Body>
</soapenv:Envelope>


which is kind of an no-answer since it just indicates the it requires registration prior to any thing (requiresRegistration), and that it requires that cookies are initialized per group (requiresInitCookie) more about that later.

All right I'll register
Since it requires registration there's only one thing to do:
POST /wsrp4j-producer/services/WSRPRegistrationService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:9101
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "urn:oasis:names:tc:wsrp:v1:register"
Content-Length: 469

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <register xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <consumerName>WSRP4J Proxy Portlet</consumerName>
      <consumerAgent>WSRP4J Proxy Portlet</consumerAgent>
      <methodGetSupported>false</methodGetSupported>
    </register>
  </soapenv:Body>
</soapenv:Envelope>
and the producer accepts with:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Tue, 06 Mar 2007 09:25:03 GMT
Connection: close

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <registerResponse xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <registrationHandle>0:0:0:0:0:0:0:1_1173173104036_0</registrationHandle>
    </registerResponse>
  </soapenv:Body>
</soapenv:Envelope>
so the registrationHandle is 0:0:0:0:0:0:0:1_1173173104036_0.

Okay now show me what you offer After having registred it's now possible to actually get the serviceDescription:
POST /wsrp4j-producer/services/WSRPServiceDescriptionService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:9101
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "urn:oasis:names:tc:wsrp:v1:getServiceDescription"
Content-Length: 464

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getServiceDescription xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <registrationContext>
        <registrationHandle>0:0:0:0:0:0:0:1_1173173104036_0</registrationHandle>
      </registrationContext>
    </getServiceDescription>
  </soapenv:Body>
</soapenv:Envelope>
and here goes the answer which is quite verbose since it contains a complete description of the portlet/service. One annoyiance is all the unnessesary xsi:type the Axis 1.* produces which I've never been able to remove not even with sendXsiTypes.
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Tue, 06 Mar 2007 09:25:03 GMT
Connection: close

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getServiceDescriptionResponse
      xsi:type="ns1:ServiceDescription"
      xmlns="urn:oasis:names:tc:wsrp:v1:types"
      xmlns:ns1="urn:oasis:names:tc:wsrp:v1:types">
      <ns1:requiresRegistration xsi:type="xsd:boolean">true</ns1:requiresRegistration>
      <ns1:offeredPortlets xsi:type="ns1:PortletDescription">
        <ns1:portletHandle xsi:type="xsd:string">wsrp4j-testportlet.WSRP4JTestPortletA</ns1:portletHandle>
        <ns1:markupTypes xsi:type="ns1:MarkupType">
          <ns1:mimeType xsi:type="xsd:string">text/html</ns1:mimeType>
          <ns1:modes xsi:type="xsd:string">wsrp:view</ns1:modes>
          <ns1:modes xsi:type="xsd:string">wsrp:edit</ns1:modes>
          <ns1:modes xsi:type="xsd:string">wsrp:help</ns1:modes>
          <ns1:windowStates xsi:type="xsd:string">wsrp:normal</ns1:windowStates>
          <ns1:windowStates xsi:type="xsd:string">wsrp:minimized</ns1:windowStates>
          <ns1:windowStates xsi:type="xsd:string">wsrp:maximized</ns1:windowStates>
          <ns1:locales xsi:type="xsd:string">en</ns1:locales>
        </ns1:markupTypes>
        <ns1:groupID xsi:type="xsd:string">wsrp4j-testportlet</ns1:groupID>
        <ns1:description
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J Test Portlet Description</ns1:value>
        </ns1:description>
        <ns1:shortTitle
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J Test</ns1:value>
        </ns1:shortTitle>
        <ns1:title
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J Test Portlet</ns1:value>
        </ns1:title>
        <ns1:keywords
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP</ns1:value>
        </ns1:keywords>
        <ns1:keywords
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J</ns1:value>
        </ns1:keywords>
        <ns1:keywords
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">Test</ns1:value>
        </ns1:keywords>
        <ns1:usesMethodGet xsi:type="xsd:boolean">false</ns1:usesMethodGet>
        <ns1:userContextStoredInSession xsi:type="xsd:boolean">false</ns1:userContextStoredInSession>
        <ns1:templatesStoredInSession xsi:type="xsd:boolean">false</ns1:templatesStoredInSession>
        <ns1:hasUserSpecificState xsi:type="xsd:boolean">true</ns1:hasUserSpecificState>
        <ns1:doesUrlTemplateProcessing xsi:type="xsd:boolean">false</ns1:doesUrlTemplateProcessing>
      </ns1:offeredPortlets>
      <ns1:offeredPortlets xsi:type="ns1:PortletDescription">
        <ns1:portletHandle xsi:type="xsd:string">wsrp4j-testportlet.WSRP4JTestPortletB</ns1:portletHandle>
        <ns1:markupTypes xsi:type="ns1:MarkupType">
          <ns1:mimeType xsi:type="xsd:string">text/html</ns1:mimeType>
          <ns1:modes xsi:type="xsd:string">wsrp:view</ns1:modes>
          <ns1:modes xsi:type="xsd:string">wsrp:edit</ns1:modes>
          <ns1:modes xsi:type="xsd:string">wsrp:help</ns1:modes>
          <ns1:windowStates xsi:type="xsd:string">wsrp:normal</ns1:windowStates>
          <ns1:windowStates xsi:type="xsd:string">wsrp:minimized</ns1:windowStates>
          <ns1:windowStates xsi:type="xsd:string">wsrp:maximized</ns1:windowStates>
          <ns1:locales xsi:type="xsd:string">en</ns1:locales>
        </ns1:markupTypes>
        <ns1:groupID xsi:type="xsd:string">wsrp4j-testportlet</ns1:groupID>
        <ns1:description
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J Test Portlet Description</ns1:value>
        </ns1:description>
        <ns1:shortTitle
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J Test</ns1:value>
        </ns1:shortTitle>
        <ns1:title
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J Test Portlet</ns1:value>
        </ns1:title>
        <ns1:keywords
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP</ns1:value>
        </ns1:keywords>
        <ns1:keywords
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">WSRP4J</ns1:value>
        </ns1:keywords>
        <ns1:keywords
          lang="en"
          xsi:type="ns1:LocalizedString">
          <ns1:value xsi:type="xsd:string">Test</ns1:value>
        </ns1:keywords>
        <ns1:usesMethodGet xsi:type="xsd:boolean">false</ns1:usesMethodGet>
        <ns1:userContextStoredInSession xsi:type="xsd:boolean">false</ns1:userContextStoredInSession>
        <ns1:templatesStoredInSession xsi:type="xsd:boolean">false</ns1:templatesStoredInSession>
        <ns1:hasUserSpecificState xsi:type="xsd:boolean">true</ns1:hasUserSpecificState>
        <ns1:doesUrlTemplateProcessing xsi:type="xsd:boolean">false</ns1:doesUrlTemplateProcessing>
      </ns1:offeredPortlets>
      <ns1:requiresInitCookie xsi:type="ns1:CookieProtocol">perGroup</ns1:requiresInitCookie>
    </getServiceDescriptionResponse>
  </soapenv:Body>
</soapenv:Envelope>

So there two portlets availeble and they are identified by:

  • wsrp4j-testportlet.WSRP4JTestPortletA
  • wsrp4j-testportlet.WSRP4JTestPortletB

and the are actually the same portlet, that is portlet code but exposed twice to show of som IPC (Inter Portlet Communication) within a portlet group (portletapplication).



Initializing cookie Next the cookie is initialized
POST /wsrp4j-producer/services/WSRPBaseService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:9101
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "urn:oasis:names:tc:wsrp:v1:initCookie"
Content-Length: 442

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <initCookie xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <registrationContext>
        <registrationHandle>0:0:0:0:0:0:0:1_1173173104036_0</registrationHandle>
      </registrationContext>
    </initCookie>
  </soapenv:Body>
</soapenv:Envelope>
The response body is basicly empty since the cookie comes as a normal HTTP header
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=CD75D795F9463373DD7A0919DF0680E0; Path=/
Content-Type: text/xml;charset=utf-8
Date: Tue, 06 Mar 2007 09:25:03 GMT
Connection: close

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <initCookieResponse xmlns="urn:oasis:names:tc:wsrp:v1:types" />
  </soapenv:Body>
</soapenv:Envelope>
I don't understand why it's done this way since it's all webservice and not (legacy) browsers, so all clients will be WSRP aware, but I guess the spec writers wanted to stick with known protocols where possible, so the session handling between the consumer and producer uses normal HTTP cookies. Now discovery and initialization is done and the markup can be exchanged.

Give the markup for the portlet

POST /wsrp4j-producer/services/WSRPBaseService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: localhost:9101
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "urn:oasis:names:tc:wsrp:v1:getMarkup"
Content-Length: 1483
Cookie: JSESSIONID=CD75D795F9463373DD7A0919DF0680E0

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getMarkup xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <registrationContext>
        <registrationHandle>0:0:0:0:0:0:0:1_1173173104036_0</registrationHandle>
      </registrationContext>
      <portletContext>
        <portletHandle>wsrp4j-testportlet.WSRP4JTestPortletA</portletHandle>
      </portletContext>
      <runtimeContext>
        <userAuthentication>wsrp:none</userAuthentication>
        <portletInstanceKey>wsrp4j-proxyportlet_row2_col3_p3</portletInstanceKey>
        <namespacePrefix>Pluto_wsrp4j_proxyportlet_row2_col3_p3_</namespacePrefix>
      </runtimeContext>
      <userContext>
        <userContextKey>dummyUserContextKey</userContextKey>
      </userContext>
      <markupParams>
        <secureClientCommunication>false</secureClientCommunication>
        <locales>en</locales>
        <locales>de</locales>
        <mimeTypes>text/html</mimeTypes>
        <mode>wsrp:view</mode>
        <windowState>wsrp:normal</windowState>
        <clientData>
          <userAgent>WSRP4J Proxy Portlet</userAgent>
        </clientData>
        <markupCharacterSets>UTF-8</markupCharacterSets>
        <validNewModes>wsrp:view</validNewModes>
        <validNewModes>wsrp:help</validNewModes>
        <validNewModes>wsrp:edit</validNewModes>
        <validNewWindowStates>wsrp:normal</validNewWindowStates>
        <validNewWindowStates>wsrp:maximized</validNewWindowStates>
        <validNewWindowStates>wsrp:minimized</validNewWindowStates>
      </markupParams>
    </getMarkup>
  </soapenv:Body>
</soapenv:Envelope>

And here it comes (my not so pretty print)
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Tue, 06 Mar 2007 09:25:03 GMT
Connection: close

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <getMarkupResponse xmlns="urn:oasis:names:tc:wsrp:v1:types">
      <markupContext>
        <mimeType>text/html; charset=UTF-8</mimeType>
        <markupString>
          &lt;h2&gt;URL Types Test&lt;/h2&gt;Time:Tue Mar 06 10:25:04 CET 2007&lt;BR/&gt;Current
          Mode:view&lt;BR/&gt;Current Window State:normal&lt;P/&gt;&lt;FONT
          SIZE=&quot;-1&quot;&gt;&lt;BR/&gt;&lt;B&gt;Render: &lt;/B&gt;Click here on &lt;A
          HREF=&quot;wsrp_rewrite?wsrp-urlType=render&amp;amp;wsrp-navigationalState=rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAAAeA**&amp;amp;wsrp-secureURL=false/wsrp_rewrite&quot;&gt;Render&lt;/A&gt;
          URL.&lt;BR/&gt;&lt;BR/&gt;&lt;B&gt;Action: &lt;/B&gt;Click here on &lt;A
          HREF=&quot;wsrp_rewrite?wsrp-urlType=blockingAction&amp;amp;wsrp-interactionState=rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAABdAAGQUNUSU9OdXIAE1tMamF2YS5sYW5nLlN0cmluZzut0lbn6R17RwIAAHhwAAAAAXQAATF4&amp;amp;wsrp-secureURL=false/wsrp_rewrite&quot;&gt;Action&lt;/A&gt;
          URL.&lt;BR/&gt;&lt;I&gt;Group Scope :0&lt;/I&gt;&lt;BR/&gt;&lt;I&gt;Portlet Scope
          :0&lt;/I&gt;&lt;BR/&gt;&lt;BR/&gt;&lt;B&gt;Resource: &lt;/B&gt;&lt;BR/&gt;&lt;IMG
          SRC=&quot;wsrp_rewrite?wsrp-urlType=resource&amp;amp;wsrp-url=http%3A%2F%2Flocalhost%3A9101%2Fwsrp4j-testportlet%2Fimages%2Fproject-logo.jpg&amp;amp;wsrp-requiresRewrite=false&amp;amp;wsrp-secureURL=false/wsrp_rewrite&quot;
          align=&quot;TOP&quot;/&gt;&lt;BR/&gt;&lt;BR/&gt;&lt;B&gt;Namespace:
          &lt;/B&gt;Pluto_wsrp4j_proxyportlet_row2_col3_p3_someFunctionHere()&lt;BR/&gt;&lt;HR/&gt;&lt;B&gt;Navigation&lt;/B&gt;&lt;BR/&gt;Page
          1&lt;BR/&gt;&lt;A
          HREF=&quot;wsrp_rewrite?wsrp-urlType=render&amp;amp;wsrp-navigationalState=rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcAUH2sHDFmDRAwACRgAKbG9hZEZhY3RvckkACXRocmVzaG9sZHhwP0AAAAAAAAx3CAAAABAAAAABdAAHanNwTmFtZXVyABNbTGphdmEubGFuZy5TdHJpbmc7rdJW5-kde0cCAAB4cAAAAAF0AAl0ZXN0Mi5qc3B4&amp;amp;wsrp-secureURL=false/wsrp_rewrite&quot;&gt;Next
          &amp;gt;&amp;gt;&lt;/A&gt;&lt;/FONT&gt;
        </markupString>
        <locale>en</locale>
        <requiresUrlRewriting>true</requiresUrlRewriting>
      </markupContext>
    </getMarkupResponse>
  </soapenv:Body>
</soapenv:Envelope>


and the same for the other portlet (ending with B).

please send the image

The portlet has an image resource that's fetched and cached for the second portlet. The request is a simple HTTP GET request (without a body)

GET /wsrp4j-testportlet/images/project-logo.jpg HTTP/1.1
User-Agent: Java/1.5.0_10
Host: localhost:9101
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive


and the answer is the jpeg image in binary so I'll not show that:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
ETag: W/"12241-1171550282000"
Last-Modified: Thu, 15 Feb 2007 14:38:02 GMT
Content-Type: image/jpeg
Content-Length: 12241
Date: Tue, 06 Mar 2007 09:25:04 GMT


and that completes the portlet page that the user sees.

Read more