WaveCalender 3: RatingBot

Rating Bot is a simpel robot which helps with creating voting in best Web 2.0 style where you can vote on each blip. The robot is made by Przemysław Gajda.

You can add the robot using the address: rating-bot@appspot.com

An example on where the robot has been used is on the picture bellow.

ratingbot

The idea of being able to rate each blip is rather smart. It will make it to vote for ideas described in a full blip. So this links a lot to the polling gadget from yesterday. It does thou vote for different blips. So this will be use full when you have more to choose from.

It is possible for a person only to cast one vote for each blip. The way this has been implemented is by using annotation to store each persons vote. I have always used the Cache storage for handling metadata and then linked it to the wave or blip. But using annotations can make it easier to persist data. Then everything is stored in just one place. It would also be possible for other robots to interact with the data created.

You can have a look at the Java code behind the gadget at code.google.com. I could learn a little from the way this code is structured.

Bookmark and Share

WordPress robot updated

I have updated the WordPress robot (WP-BOT@appspot.com) to publish to your own blog. This feature has been requested by many users, so I thought it was time to give it a try. The usage of the robot is fairly simple. The original version of the robot was described in this post, where I just proved the concept was possible.

Simply add the robot to a Wave. You don’t have any credentials connected with your Wave your you will get a link, where you can enter information about your WordPress. Next time you add the robot to a wave, the new Wave will be published to a new Wave.

To use the plugin simply add Wavr to your blog and in Setting -> Writing Settings make sure XML-RPC is activate.

The usage is also showed on this video.

Do you have any suggestion on how I can make the service even better?

Bookmark and Share

WordPress publisher bot

Inspired by offlineblog’s blog about Live blogging and the WordPress plugins like described on my blog, and at offlineblog and the bloggy robot which can publish to blogger.com. I thought this could also be possible to perform the same with a WordPress robot.

The solution simply works by adding the robot wp-bot@appspot.com to a Wave. Then it publishes your wave to the site as an embedded wave to WordPress. With this you get a permalink to the blog, where the content is hosted. I was unable to using the API’s that Google is using for displaying that the content is shared. If you know how to use please let me know.

I found the wordpress-java library to help with creating the XMLRPC code, which I was unable to use. With this library it is pretty simple to create a blog with some content. And since the content I’m posting just is wave id=’waveID’ bgcolor=’#ffffff’, it is pretty easy to craft.

The robot in action works the following way.

 

The code looks like the following.

public class WPRobotServlet extends AbstractRobotServlet {
      private String ownname = "wp-bot@appspot.com";
 
    @Override
    public void processEvents(RobotMessageBundle bundle) {
        Wavelet wavelet = bundle.getWavelet();
       
        // when the Robot is added publish to the robot
        if (bundle.wasSelfAdded()) {

            Blip blip = wavelet.appendBlip();
            TextView textView = blip.getDocument();
            textView.append(ownname+ " added version " +this.getVersion() +" \n");
            textView.appendMarkup("\n <a href=\"http://masteringwave.com/\">MasteringWave</a> <br />");
            textView.append("\n");
            String rootText = wavelet.getRootBlip().getDocument().getText();
            // find the first line, which will be the title to the blog
            String firstLine ;
            if(rootText.indexOf("\n")>0){
                firstLine =     rootText.substring(0,rootText.indexOf("\n"));
            }else{
                firstLine = rootText;
            }
            textView.append( uploadWave(firstLine, wavelet.getWaveId()));
        }
         

    }
   
    private String uploadWave(String title, String waveID){
           String sXmlRpcURL = "http://wp-bot.masteringwave.com/xmlrpc.php";
              String sUsername = "wave";
              String sPassword = "<SECRET>";
         
              // Hard-coded blog_ID
              String blog_ID = "1";

              // XML-RPC method
              String sXmlRpcMethod = "metaWeblog.newPost";
              // the content of the blog
              String sContent = "[wave id=\""+waveID+"\" bgcolor=\"#ffffff\"]";

                  // Try block to create the upload
              try
              {
                Wordpress wp = new Wordpress(sUsername, sPassword, sXmlRpcURL);
                  Page newPost = new Page();
                  newPost.setTitle(title);
                  newPost.setDescription(sContent);
                  newPost.setWp_author(sUsername);
                  String resultId = wp.newPost(newPost, "draft");
                  return wp.getPost(Integer.parseInt(resultId)).getPermaLink();
              }
              catch( Exception e )
              {
               return e.toString();
              }
    }
}

 

The full code can be found at http://code.google.com/p/masteringwave/source/browse/#svn/trunk/WP-BOT.

If you just want to check it out, just add the robot wp-bot@appspot.com to your Wave and the wave will be published.

Bookmark and Share

New SAP ES Demo: Creating Service Requests

Some weeks ago I made a demo of how SAP ES could be reached from a Google Wave. This was just to show it was possible to call ES. That demo did not help in any workflow; it just showed some data to the user. I have now worked with getting a better idea for coming up with a demo, which shows how wave can be leveraged to implement a better solution. I need this demo for my Virtual Community Day presentation on Thursday the 24 of September at 16 CET.

This demo is about creating services requests for a customer. In the scenario the customer adds the robot, which displays all the equipment items the customer has. The customer then selects the item which is broken, and creates a service request on this item. When the request is created using another enterprise service, a technician is added to the wave to help the customer solve the problem. This will allow the participants to write to each other showing how things work out.

An extension of this demo, would obvious be a place where the two participants could change the status. So the task would be completed, when they have solved the problem.

This demo is also created by SAP as a Composite application (CE), but using CE will only create the request. It will not allow the participants to help fix the problem in just one place. I believe it is in this place the Wave Robots has something value adding compared to normal web applications. There still need to be some development to get a more compelling look and feel. I’m not sure what is possible to do with styling and creating tables but the view should be styled before an Enterprise ready application is created.

How this was done

As with the last demo, I have not been able to run Axis2 on Google App-engine, where robots currently have to be implemented. It seems like Axis2 is using raw sockets, which is not allowed on Appengine. I have therefore created SOAP-XML in hand and just submitted them via the URL connection. This XML I got by using SOAPUI, which is an excellent SOAP client for testing services. By using SOAPUI I could craft and test XML calls before spending time on implementing them in Java. It is also possible to use the Webservice test tool in connected to the Enterprise Repository. For some of the request it is possible to get some basic test data delivered.

When I got a response back I have used a SAX parser to handle the requests. This works great to store the information for later retrieval by the robot. It would have saved some time on this front also if the Axis2 would work. For the three calls I perform, I use three different parsing strategies. I though learned something from this, so I’m happy.

Output to the wave was pretty straight forward using the Robot apis. I only had some problems with some of the used keys between the different blips. To remember the item name, I store the item in the Memcache. That way it is easy to store data between different requests. I did have a problem with the robot, which believed that it should react to its own requests. That was not a good idea, and it created a lot of blips in the wave. So when developing robots, do not react to events performed by the robot itself or any of the robots at the @gwave.com domain.

The code for the robot can be found in the sap-wave repository.

Before deploying this code you self you need to change the WebserviceHelper class, and add you own username and password to the SAP ES demo systems as Basic authentication parameters.

Notice this blog is cross posted to SAP SCN.

Bookmark and Share

New Robot API

Just found that a new JAVA API of the robots is available on the download site. The difference in the code can be seen on the changes page.

One interesting concept is the AbstractRobot which has been added. From my look at it this class gives is able to create the capabilities XML and the profile information. So you only need to implement one class and then you can have all the information you need one place. This will make it much easier to program robots. The Rave Ruby frameworks has something like this, you just implement the methods for each event you want to have. Then the framework can manage to create the capabilities XML file. The AbstractRobotServlet and ProfileServlet was not changed, this could lead to thoughts about deprecation of these classes.

Of other changes the Annotations and Range has better toString functions, which was missing when you needed to debug applications.

I hope there will be posted a change to the tutorial, so we can start using the AbstractRobot instead.

Bookmark and Share