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

Re: [soaplite] Re: Help using SOAP::Lite

Expand Messages
  • gayathri athreya
    Hi, Here is a small sample code. This code was originally in Java and I had to rewrite it in perl. It takes a while to actually understand how SOAP works but
    Message 1 of 6 , Jul 3, 2006
    • 0 Attachment
      Hi,
           Here is a small sample code. This code was originally in Java and I had to rewrite it in perl. It takes a while to actually understand how SOAP works but once you do, the language is not a barrier, the perl module is just as efficient and easy as java or C#. It is done exactly like the way you do it in java, only the function names are different. Please refer to www.perl.com for articles on SOAP, they were of immense help to me. Hope this helps.

      ##########
      use SOAP::Lite;
      use SOAP::Lite +trace => [qw(debug)];

      my $ENDPOINT = 'http://your url';
          my $lucas = new SOAP::Lite(endpoint => $ENDPOINT, proxy => $ENDPOINT);
                  $lucas->transport->timeout(600);
                  my @params = (
                                 SOAP::Data->type('int')->name('numberTerms')->value(20),
                                 SOAP::Data->type('boolean')->name('showWeights')->value(0),
                                 SOAP::Data->type('int')->name('format')->value(0));
                  my $response = $lucas->call('yourFunction' => @params)->result;
      #############

      Octavian Rasnita <orasnita@...> wrote:
      From: "theorem21" <bryant.eadon@ csfb.com>

      --- In soaplite@yahoogroup s.com, "Octavian Rasnita" <orasnita@.. .> wrote:
      >
      > I need to create a SOAP::Lite client in perl and I don't have
      specifications for doing this in this language.
      >
      > I do have an example in C# though. Can you help me with the smallest
      code you can that can help me as a sample of making the following
      program in perl?
      ************ ********* *****

      I'll reword your question to what I think you're really asking ...

      "I don't know how to do this, here's my WSDL and code in C#, do it for
      me in Perl."

      Without "specifications" or it's brethren -- "requirements" you can't
      build anything efficiently, let alone farm it out to someone. I
      suppose you mean something else.

      Regardless, take a look at the perl documentation for this module :
      http://search. cpan.org/ ~byrne/SOAP- Lite-0.67/ lib/OldDocs/ SOAP/Lite. pm

      Hi,

      Thanks for helping me.

      I have already read the SOAP::Lite POD documentation and I have already read
      some pages from soaplite.com site. They helped me to learn a little how to
      create a SOAP client in perl if I also have the code for the SOAP server
      which is also in perl.

      The problem is that I don't know what I need to use as uri() because I don't
      know which is the namespace that I need to use.

      I have tried using the same name as the method's name and a few other
      strings, but without success.

      The guys that made the server could give me some examples in C# or Java, but
      nobody uses perl for this.... and I think I start to understand why...

      Teddy




      ******"We shape the pot but it's the emptiness which holds whatever we want".******


      Yahoo! India Answers: Share what you know. Learn something new Click here
      Catch all the FIFA World Cup 2006 action on Yahoo! India Click here

    • Octavian Rasnita
      Hi, Thank you for that code. I have tried the following: use SOAP::Lite; use SOAP::Lite +trace = [qw(debug)]; my $url = http://... ; my $ENDPOINT = $url; my
      Message 2 of 6 , Jul 3, 2006
      • 0 Attachment
        Hi,

        Thank you for that code.

        I have tried the following:

        use SOAP::Lite;
        use SOAP::Lite +trace => [qw(debug)];

        my $url = "http://...";

        my $ENDPOINT = $url;
        my $lucas = new SOAP::Lite(endpoint => $ENDPOINT, proxy => $ENDPOINT, ns =>
        'www.bvb.ro/Level2');

        $lucas->transport->timeout(600);

        my @params = (
        SOAP::Data->type('string')->name('symbol')->value('SIF5'),
        SOAP::Data->type('string')->name('market')->value('REGS'));

        my $response = $lucas->call('Level2' => @params)->result;
        __END__

        I have seen that the program sends the following HTTP header which is not
        correct:

        SOAPAction: "www.bvb.ro/Level2#Level2"

        The correct header should be:

        SOAPAction: "www.bvb.ro/Level2"

        (without #Level2)

        What can I do to make it send the correct header?

        Thank you.

        Teddy

        ----- Original Message -----
        From: "gayathri athreya" <satanssidekick5@...>

        > Hi,
        > Here is a small sample code. This code was originally in Java and I
        had to rewrite it in perl. It takes a while to actually understand how SOAP
        works but once you do, the language is not a barrier, the perl module is
        just as efficient and easy as java or C#. It is done exactly like the way
        you do it in java, only the function names are different. Please refer to
        www.perl.com for articles on SOAP, they were of immense help to me. Hope
        this helps.
        >
      • rahed
        ... www.bvb.ro/Level2#Level2 Part before # is uri and part after is a called method. SOAPAction http header can be set by an on_action method:
        Message 3 of 6 , Jul 4, 2006
        • 0 Attachment
          "Octavian Rasnita" <orasnita@...> writes:

          > I have seen that the program sends the following HTTP header which is not
          > correct:
          >
          > SOAPAction: "www.bvb.ro/Level2#Level2"
          >
          > The correct header should be:
          >
          > SOAPAction: "www.bvb.ro/Level2"
          >
          > (without #Level2)
          >
          > What can I do to make it send the correct header?
          >



          www.bvb.ro/Level2#Level2
          Part before # is uri and part after is a called method.

          SOAPAction http header can be set by an on_action method:
          $soap->on_action(sub {'www.bvb.ro/Level2'});

          --
          Radek
        • Octavian Rasnita
          Thank you. I have managed to send the correct header but the XML body is not correct. I have also read that I need to make some changes in order to make the
          Message 4 of 6 , Jul 4, 2006
          • 0 Attachment
            Thank you. I have managed to send the correct header but the XML body is not
            correct.
            I have also read that I need to make some changes in order to make the
            SOAP::Lite client work with a .net server (because it is a .net server
            running under IIS), and I have tried changing many things, but the body sent
            is very different than the server needs.

            Here is the SOAP 1.1 and 1.2 requests and responses that should be used.
            Is it possible to do it using SOAP::Lite?
            (with any of them)

            SOAP 1.1

            The following is a sample SOAP 1.1 request and response. The placeholders
            shown need to be replaced with actual values.
            POST /bsews/intraday.asmx HTTP/1.1
            Host: www.rasd.ro
            Content-Type: text/xml; charset=utf-8
            Content-Length: length
            SOAPAction: "www.bvb.ro/Level2"

            <?xml version="1.0" encoding="utf-8"?>
            <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
            <soap:Body>
            <Level2 xmlns="www.bvb.ro">
            <symbol>string</symbol>
            <market>string</market>
            </Level2>
            </soap:Body>
            </soap:Envelope>
            HTTP/1.1 200 OK
            Content-Type: text/xml; charset=utf-8
            Content-Length: length

            <?xml version="1.0" encoding="utf-8"?>
            <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
            <soap:Body>
            <Level2Response xmlns="www.bvb.ro">
            <Level2Result>
            <Symbolcode xmlns="http://www.bvb.ro/">string</Symbolcode>
            <Marketcode xmlns="http://www.bvb.ro/">string</Marketcode>
            <LastTradeTime xmlns="http://www.bvb.ro/">dateTime</LastTradeTime>
            <Openprice xmlns="http://www.bvb.ro/">decimal</Openprice>
            <Closeprice xmlns="http://www.bvb.ro/">decimal</Closeprice>
            <Value xmlns="http://www.bvb.ro/">decimal</Value>
            <Volume xmlns="http://www.bvb.ro/">long</Volume>
            <Trades xmlns="http://www.bvb.ro/">long</Trades>
            <Lowpricecurrent xmlns="http://www.bvb.ro/">decimal</Lowpricecurrent>
            <Highpricecurrent xmlns="http://www.bvb.ro/">decimal</Highpricecurrent>
            <Avgprice xmlns="http://www.bvb.ro/">decimal</Avgprice>
            <NetChgFromOfficialPrice
            xmlns="http://www.bvb.ro/">decimal</NetChgFromOfficialPrice>
            <PrcChgFromOfficialPrice
            xmlns="http://www.bvb.ro/">double</PrcChgFromOfficialPrice>
            <ReferencePrice xmlns="http://www.bvb.ro/">decimal</ReferencePrice>
            <PotentialOpenVol xmlns="http://www.bvb.ro/">decimal</PotentialOpenVol>
            <PotentialOpenPrice xmlns="http://www.bvb.ro/">decimal</PotentialOpenPrice>
            <SymbolStatus xmlns="http://www.bvb.ro/">string</SymbolStatus>
            <LastTopTime xmlns="http://www.bvb.ro/">dateTime</LastTopTime>
            <B1Price xmlns="http://www.bvb.ro/">decimal</B1Price>
            <B1Vol xmlns="http://www.bvb.ro/">double</B1Vol>
            <B2Price xmlns="http://www.bvb.ro/">decimal</B2Price>
            <B2Vol xmlns="http://www.bvb.ro/">double</B2Vol>
            <B3Price xmlns="http://www.bvb.ro/">decimal</B3Price>
            <B3Vol xmlns="http://www.bvb.ro/">double</B3Vol>
            <B4Price xmlns="http://www.bvb.ro/">decimal</B4Price>
            <B4Vol xmlns="http://www.bvb.ro/">double</B4Vol>
            <B5Price xmlns="http://www.bvb.ro/">decimal</B5Price>
            <B5Vol xmlns="http://www.bvb.ro/">double</B5Vol>
            <A1Price xmlns="http://www.bvb.ro/">decimal</A1Price>
            <A1Vol xmlns="http://www.bvb.ro/">double</A1Vol>
            <A2Price xmlns="http://www.bvb.ro/">decimal</A2Price>
            <A2Vol xmlns="http://www.bvb.ro/">double</A2Vol>
            <A3Price xmlns="http://www.bvb.ro/">decimal</A3Price>
            <A3Vol xmlns="http://www.bvb.ro/">double</A3Vol>
            <A4Price xmlns="http://www.bvb.ro/">decimal</A4Price>
            <A4Vol xmlns="http://www.bvb.ro/">double</A4Vol>
            <A5Price xmlns="http://www.bvb.ro/">decimal</A5Price>
            <A5Vol xmlns="http://www.bvb.ro/">double</A5Vol>
            </Level2Result>
            </Level2Response>
            </soap:Body>
            </soap:Envelope>

            SOAP 1.2

            The following is a sample SOAP 1.2 request and response. The placeholders
            shown need to be replaced with actual values.
            POST /bsews/intraday.asmx HTTP/1.1
            Host: www.rasd.ro
            Content-Type: application/soap+xml; charset=utf-8
            Content-Length: length

            <?xml version="1.0" encoding="utf-8"?>
            <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
            <soap12:Body>
            <Level2 xmlns="www.bvb.ro">
            <symbol>string</symbol>
            <market>string</market>
            </Level2>
            </soap12:Body>
            </soap12:Envelope>
            HTTP/1.1 200 OK
            Content-Type: application/soap+xml; charset=utf-8
            Content-Length: length

            <?xml version="1.0" encoding="utf-8"?>
            <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
            <soap12:Body>
            <Level2Response xmlns="www.bvb.ro">
            <Level2Result>
            <Symbolcode xmlns="http://www.bvb.ro/">string</Symbolcode>
            <Marketcode xmlns="http://www.bvb.ro/">string</Marketcode>
            <LastTradeTime xmlns="http://www.bvb.ro/">dateTime</LastTradeTime>
            <Openprice xmlns="http://www.bvb.ro/">decimal</Openprice>
            <Closeprice xmlns="http://www.bvb.ro/">decimal</Closeprice>
            <Value xmlns="http://www.bvb.ro/">decimal</Value>
            <Volume xmlns="http://www.bvb.ro/">long</Volume>
            <Trades xmlns="http://www.bvb.ro/">long</Trades>
            <Lowpricecurrent xmlns="http://www.bvb.ro/">decimal</Lowpricecurrent>
            <Highpricecurrent xmlns="http://www.bvb.ro/">decimal</Highpricecurrent>
            <Avgprice xmlns="http://www.bvb.ro/">decimal</Avgprice>
            <NetChgFromOfficialPrice
            xmlns="http://www.bvb.ro/">decimal</NetChgFromOfficialPrice>
            <PrcChgFromOfficialPrice
            xmlns="http://www.bvb.ro/">double</PrcChgFromOfficialPrice>
            <ReferencePrice xmlns="http://www.bvb.ro/">decimal</ReferencePrice>
            <PotentialOpenVol xmlns="http://www.bvb.ro/">decimal</PotentialOpenVol>
            <PotentialOpenPrice xmlns="http://www.bvb.ro/">decimal</PotentialOpenPrice>
            <SymbolStatus xmlns="http://www.bvb.ro/">string</SymbolStatus>
            <LastTopTime xmlns="http://www.bvb.ro/">dateTime</LastTopTime>
            <B1Price xmlns="http://www.bvb.ro/">decimal</B1Price>
            <B1Vol xmlns="http://www.bvb.ro/">double</B1Vol>
            <B2Price xmlns="http://www.bvb.ro/">decimal</B2Price>
            <B2Vol xmlns="http://www.bvb.ro/">double</B2Vol>
            <B3Price xmlns="http://www.bvb.ro/">decimal</B3Price>
            <B3Vol xmlns="http://www.bvb.ro/">double</B3Vol>
            <B4Price xmlns="http://www.bvb.ro/">decimal</B4Price>
            <B4Vol xmlns="http://www.bvb.ro/">double</B4Vol>
            <B5Price xmlns="http://www.bvb.ro/">decimal</B5Price>
            <B5Vol xmlns="http://www.bvb.ro/">double</B5Vol>
            <A1Price xmlns="http://www.bvb.ro/">decimal</A1Price>
            <A1Vol xmlns="http://www.bvb.ro/">double</A1Vol>
            <A2Price xmlns="http://www.bvb.ro/">decimal</A2Price>
            <A2Vol xmlns="http://www.bvb.ro/">double</A2Vol>
            <A3Price xmlns="http://www.bvb.ro/">decimal</A3Price>
            <A3Vol xmlns="http://www.bvb.ro/">double</A3Vol>
            <A4Price xmlns="http://www.bvb.ro/">decimal</A4Price>
            <A4Vol xmlns="http://www.bvb.ro/">double</A4Vol>
            <A5Price xmlns="http://www.bvb.ro/">decimal</A5Price>
            <A5Vol xmlns="http://www.bvb.ro/">double</A5Vol>
            </Level2Result>
            </Level2Response>
            </soap12:Body>
            </soap12:Envelope>





            Teddy

            ----- Original Message -----
            From: "rahed" <rahed@...>
            To: "Octavian Rasnita" <orasnita@...>
            Cc: "gayathri athreya" <satanssidekick5@...>; "theorem21"
            <bryant.eadon@...>; <soaplite@yahoogroups.com>
            Sent: Tuesday, July 04, 2006 12:59 PM
            Subject: Re: [soaplite] Re: Help using SOAP::Lite


            > "Octavian Rasnita" <orasnita@...> writes:
            >
            > > I have seen that the program sends the following HTTP header which is
            not
            > > correct:
            > >
            > > SOAPAction: "www.bvb.ro/Level2#Level2"
            > >
            > > The correct header should be:
            > >
            > > SOAPAction: "www.bvb.ro/Level2"
            > >
            > > (without #Level2)
            > >
            > > What can I do to make it send the correct header?
            > >
            >
            >
            >
            > www.bvb.ro/Level2#Level2
            > Part before # is uri and part after is a called method.
            >
            > SOAPAction http header can be set by an on_action method:
            > $soap->on_action(sub {'www.bvb.ro/Level2'});
            >
            > --
            > Radek
          Your message has been successfully submitted and would be delivered to recipients shortly.