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

newbie.

Expand Messages
  • jared.pohl
    Hi Guys I ve been fiddling around with SOAP::Lite and think its great so far, but am really struggling to get a result. I was wondering if anyone could give
    Message 1 of 2 , Nov 30, 2009
    • 0 Attachment
      Hi Guys

      I've been fiddling around with SOAP::Lite and think its great so far, but am really struggling to get a result. I was wondering if anyone could give me a 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>

      I've even gone as far as creating a stub and trying to call the login method, but i trip up trying to put the keys and values into the soap request (im guessing this is what im doing wrong).

      Any help would be appreciated - it will probably mean a lightbulb moment and then i can move on ;) thanks guys!~
    • 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 2 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.