Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jjohn (22)

jjohn
  (email not shown publicly)
http://taskboy.com/
AOL IM: taskboy3000 (Add Buddy, Send Message)

Perl hack/Linux buff/OSS junkie.

Journal of jjohn (22)

Friday November 14, 2003
06:02 AM

Hello, MIDlet

[ #15767 ]

As sometimes happens in the life of a consultant, I was asked to investigate how to write some utility for mobile phones. After some brief research, it appears that most widely supported tool for this kind of development is java. So I downloaded many, many megabytes of SDKs from Sun, including the Sun ONE studio (which is an insane IDE. Why the heck do I "mount" a "local directory" instead of simply opening files and directories? Is it because the network is the computer? Sun, your terminology can bite me). I also grabbed a copy of the SOAP library kSOAP from Enhydra.

After an hour of tweedling (and some small patches to Enhydra's stock quote demo), I got an existing cell phone java application (undeftly called a 'MIDlet') to run in the emulator. Joy!

I then worked up a mod_perl SOAP::Lite server with an 'echo' service. I recompiled the java MIDlet to use the new service. No joy.

It took me a couple hours, but the problem was in the URN bit of the SOAP envelop (you know, the useless bit). I wasn't able to code the URN in java in a way that was acceptable to SOAP::Lite's default on_action handler in SOAP::Transport::HTTP.pm. The solution for me turned out to be this:

  use strict;
  use SOAP::Transport::HTTP "+trace" => "debug";
  SOAP::Transport::HTTP::CGI
           ->on_action(\&on_action)
           ->dispatch_to("AB/WS" => "AB::WS",
                         SOAPAction => "AB::WS")
           ->handle;
  sub on_action {
    my ($urn1, $urn2, $method) = @_;
    warn("ws: ", join ", ", @_);
    unless (AB::WS->can($method)) {
      die "Don't know how to '$method' for AB::WS";
    }
    return "V2::WS::$method";
  }
  package AB::WS;
  sub echo {
    my ($self, @args) = @_;
    return SOAP::Data->name("echoResponse")
                   ->type("string")
                   ->uri(URI)
                   ->value("I got: " . join ", ", @args);
  }

Both Perl and Java clients seem to work with this set up. Joy!

Since I couldn't find docs on this Perl server/Java client SOAP combo, I thought I'd make the smallest effort to document this in case others get stuck on this bit of technical beaucracy.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I thought this was a Markov entry through the entire first paragraph. That explains part of Sun's strategy!

    • Perhaps all of the typos and mispellings fostered the illusion that this entry was programmatically generated. As I dive (back) into Java, I'm reminded once again that I loathe strong typing.