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

AW: [soaplite] newbie.

Expand Messages
  • Martin Busik
    Hi Jared, ... here comes it: # Debug options: see the request actually being generated # use SOAP::Lite (+trace = [qw(transport debug parameters)]); my
    Message 1 of 2 , Nov 30, 2009
    • 0 Attachment
      Hi Jared,

      > bit of code to tell me
      > how to create the following soap request:
      >
      > <?xml version="1.0" encoding="utf-8"?>
      > <soap:Envelope
      > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      > <soap:Body>
      > <login
      > xmlns="http://www.betfair.com/publicapi/v3/BFGlobalService/">
      > <request>
      > <locationId xmlns="">0</locationId>
      > <password xmlns="">bfpassword</password>
      > <productId xmlns="">82</productId>
      > <username xmlns="">bfusername</username>
      > <vendorSoftwareId xmlns="">0</vendorSoftwareId>
      > </request>
      > </login>
      > </soap:Body>
      > </soap:Envelope>

      here comes it:

      # Debug options: see the request actually being generated
      #
      use SOAP::Lite (+trace => [qw(transport debug parameters)]);

      my $proxy = SOAP::Lite->proxy('http:/localhost');
      $proxy->readable(1);
      $proxy->autotype(0); # disable generation of "xsi:type" attribute

      $proxy->uri("http://www.betfair.com/publicapi/v3/BFGlobalService/"); #
      namespace of your method

      my $response = $proxy->call(
      "login",
      SOAP::Data->name('request')->value(
      \SOAP::Data->value(
      SOAP::Data->name('locationId')->value(0)->attr( { xmlns =>
      "" }),
      SOAP::Data->name('password')->value('bfpassword')->attr( {
      xmlns => "" }),
      SOAP::Data->name('productId')->value(82)->attr( { xmlns =>
      "" }),
      SOAP::Data->name('username')->value('bfusername')->attr( {
      xmlns => "" }),
      SOAP::Data->name('vendorSoftwareId')->value(0)->attr( {
      xmlns => "" }),
      )
      )
      );

      the weird about your request is, that the elements inside "request" do have
      a null namespace, this needs to be
      generated using ->attr( {xmlns => ""} ). The rest is just a
      straight-forward.

      Cheers,
      Martin
    Your message has been successfully submitted and would be delivered to recipients shortly.