Loading ...
Sorry, an error occurred while loading the content.

Calling a Perl Webservice Using CF

Expand Messages
  • hillmw2000
    If I have a Perl web service like: **************************************************** #!/usr/bin/perl -w use SOAP::Transport::HTTP;
    Message 1 of 2 , Apr 7, 2004
    • 0 Attachment
      If I have a Perl web service like:
      ****************************************************
      #!/usr/bin/perl -w
      use SOAP::Transport::HTTP;
      SOAP::Transport::HTTP::CGI
      -> dispatch_to('Temperatures')
      -> handle;
      package Temperatures;
      sub new
      {
      my $self = shift;
      my $class = ref($self) || $self;
      bless {_temperature => shift} => $class;
      }
      sub as_celsius
      {
      my $self = shift;
      return $self->f2c( $self->{_temperature} );
      }
      ****************************************************

      and I am calling it like:

      ****************************************************
      #!/usr/bin/perl -w
      use SOAP::Lite;
      my $soap = SOAP::Lite
      -> uri('http://blah.blah.com/Temperatures')
      -> proxy('http://blah.blah.com/cgi-bin/temper.cgi');
      # accept Fahrenheit
      my $temperatures = $soap
      -> call(new => 99)
      -> result;
      print $soap
      -> as_celsius($temperatures)
      -> result;

      How would I call this same web service using Coldfusion?

      Any help is appreciated.

      Mike
    • Byrne Reese
      One of the challenging this with SOAP::Lite is that SOAP encoding is used to encode requests and responses. This makes it easy for other SOAP::Lite clients to
      Message 2 of 2 , Oct 19, 2004
      • 0 Attachment
        One of the challenging this with SOAP::Lite is that SOAP encoding is
        used to encode requests and responses. This makes it easy for other
        SOAP::Lite clients to talk to a SOAP::Lite service, but sometimes
        difficult otherwise. This is compounded by the fact that SOAP::Lite
        cannot currently generate a WSDL for a service written in Perl making it
        difficult when using other toolkits.

        How is this mitigated - well, I would strongly suggest implementing your
        service such that it extends SOAP::Server::Parameters - this makes it
        easier to extract input by XPath, and/or element name.

        I suggest the following articles to help you write your first SOAP::Lite
        service:

        Part 1: http://builder.com.com/5100-6389_14-1046624.html
        Part 2: http://builder.com.com/5100-6389_14-1052448.html

        That should get you started. The next step is for you to write a WSDL
        for the service. I recommend using a tool like XML Spy, or CapeScience's
        WSDL Editing tool.

        It is not ideal, but it is all we got right now. Soon however we will
        find a solution to this. Probably by using some form of POD comments
        that can be serialized into proper WSDL.

        Byrne

        hillmw2000 wrote:

        > If I have a Perl web service like:
        > ****************************************************
        > #!/usr/bin/perl -w
        > use SOAP::Transport::HTTP;
        > SOAP::Transport::HTTP::CGI
        > -> dispatch_to('Temperatures')
        > -> handle;
        > package Temperatures;
        > sub new
        > {
        > my $self = shift;
        > my $class = ref($self) || $self;
        > bless {_temperature => shift} => $class;
        > }
        > sub as_celsius
        > {
        > my $self = shift;
        > return $self->f2c( $self->{_temperature} );
        > }
        > ****************************************************
        >
        > and I am calling it like:
        >
        > ****************************************************
        > #!/usr/bin/perl -w
        > use SOAP::Lite;
        > my $soap = SOAP::Lite
        > -> uri('http://blah.blah.com/Temperatures')
        > <http://blah.blah.com/Temperatures%27%29>
        > -> proxy('http://blah.blah.com/cgi-bin/temper.cgi');
        > <http://blah.blah.com/cgi-bin/temper.cgi%27%29;>
        > # accept Fahrenheit
        > my $temperatures = $soap
        > -> call(new => 99)
        > -> result;
        > print $soap
        > -> as_celsius($temperatures)
        > -> result;
        >
        > How would I call this same web service using Coldfusion?
        >
        > Any help is appreciated.
        >
        > Mike
      Your message has been successfully submitted and would be delivered to recipients shortly.