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

Creating WSDL for SOAP::Lite

Expand Messages
  • redgrittybrick
    I am trying to create a WSDL file for the temperature examples in the quick start quide to SOAP::Lite. However when I run a client that uses the WSDL,
    Message 1 of 1 , Mar 16 9:38 AM
    • 0 Attachment
      I am trying to create a WSDL file for the temperature examples in the
      quick start quide to SOAP::Lite.

      However when I run a client that uses the WSDL, Soap::Lite complains
      ...
      SOAP::Deserializer::deserialize: ()
      SOAP::Parser::decode: ()
      not well-formed (invalid token) at line 62, column 9, byte 1899 at
      /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/XML/Parser.pm
      line 185

      What am I doing wrong?

      (n.b. clients that access the service without using the WSDL work ok)

      ------- Temperature.wsdl ----------
      <?xml version="1.0" ?>
      <definitions name="Temperature"
      targetNamespace="urn:Temperature"
      xmlns:tns="urn:Temperature"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap"
      xmlns:enc="http://schemas.xmlsoap.org/soap/encoding"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns="http://schemas.xmlsoap.org/wsdl/">


      <types>
      <xsd:schema targetNamespace="urn:Temperature">
      </xsd:schema>
      </types>


      <message name="CentigradeRequest">
      <part name="fahrenheit" type="xsd:int" />
      </message>
      <message name="CentigradeResponse">
      <part name="centigrade" type="xsd:int" />
      </message>

      <message name="FahrenheitRequest">
      <part name="centigrade" type="xsd:int" />
      </message>
      <message name="FahrenheitResponse">
      <part name="fahrenheit" type="xsd:int" />
      </message>


      <portType name="TemperaturePort">
      <operation name="f2c">
      <input message="tns:CentigradeRequest" />
      <output message="tns:CentigradeResponse" />
      </operation>
      <operation name="c2f">
      <input message="tns:FahrenheitRequest" />
      <output message="tns:FahrenheitResponse" />
      </operation>
      </portType>


      <binding name="SOAP" type="tns:TemperaturePort">
      <soap:binding style="rpc"
      transport="http://schemas/xmlsoap.org/soap/http" />

      <operation name="c2f">
      <soap:operation soapAction="Temperature#c2f" />
      <input>
      <soap:body use="encoded"
      namespace="urn:Temperature"
      part="centigrade"
      encodingStyle=
      "http://schemas.xmlsoap.org/soap/encoding" />
      </input>
      <output>
      <soap:body use="encoded" />
      </output>
      </operation>

      <operation name="f2c">
      <soap:operation soapAction="Temperature#f2c" />
      <input>
      <soap:body use="encoded"
      namespace="urn:Temperature"
      part="fahrenheit"
      encodingStyle=
      "http://schemas.xmlsoap.org/soap/encoding" />
      </input>
      <output>
      <soap:body use="encoded" />
      </output>
      </operation>

      </binding>

      <service name="Temperature">
      <port name="Temperatureport"> binding="tns:SOAP">
      <soap:address
      location="http://localhost/cgi-bin/Temperature.server" />
      </port>
      </service>

      </definitions>


      ------- Temperature.client --------
      #!/usr/bin/perl
      use strict;
      use warnings;
      use SOAP::Lite +trace => 'all';

      my $soap = SOAP::Lite
      -> service ('http://localhost/Temperature.wsdl');

      print $soap
      -> c2f(37.5)
      -> result;

      ------- Temperature.server --------
      #!/usr/bin/perl
      use strict;
      use warnings;
      use SOAP::Transport::HTTP;

      SOAP::Transport::HTTP::CGI
      -> dispatch_to('Temperatures')
      -> handle;

      package Temperatures;

      sub f2c {
      my ($class, $f) = @_;
      return 5/9*($f-32);
      }

      sub c2f {
      my ($class, $c) = @_;
      return 32+$c*9/5;
      }
      -------------------------------
    Your message has been successfully submitted and would be delivered to recipients shortly.