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

Can anyone help with a SOAP:Lite Document/Literal example please

Expand Messages
  • arun9a
    I know the new beta version kinda support document/liternal i think. Can anyone help with a SOAP:Lite document/liternal example. Thanks Aron
    Message 1 of 3 , Jun 29, 2005
    • 0 Attachment
      I know the new beta version kinda support document/liternal i think.
      Can anyone help with a SOAP:Lite document/liternal example.

      Thanks
      Aron
    • arun9a
      I had to spent many hours to find how to access document/literal web services using SOAP:Lite. Cant believe SOAP::Lite folks didnt have time to write a
      Message 2 of 3 , Jul 2, 2005
      • 0 Attachment
        I had to spent many hours to find how to access document/literal
        web services using SOAP:Lite. Cant believe SOAP::Lite folks didnt
        have time to write a simpleexample. Too bad... anyway.. i kind a
        figured it out and it is working well.


        Before you start you would need the following perl modules

        SOAP::Lite (SOAP-Lite-0.60)
        XML::Parser(XML-Parser-2.34)

        NOTE: Install the SOAP::Lite using CPAN will automaticall install
        the XML::Parser. If it doesnt do that then install the XML::Parser
        module.


        SOAP call input (To the web service) from the perl client.
        This is the output of the per client to the web services.
        =========================================================
        ----- start----
        <SOAP-ENV:Envelope
        xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <SOAP-ENV:Body>

        <lookupTicketRequest xmlns="urn:zzz:xml:ns:pmp-1.0">

        <ticketNumber>1234</ticketNumber>

        </lookupTicketRequest>

        </SOAP-ENV:Body>

        </SOAP-ENV:Envelope>
        ---- end----

        Here the URL is "urn:zzz:xml:ns:pmp-1.0"

        NOTE: MAKE SURE THE URN IS CORRECT BEFORE YOU CALL. IF THE URN IS
        NOT CORRECT YOUR THE STRUCTURE OF THE SOAP DOCUMENT WILL BECOME
        INCORRECT.




        SOAP call output (From the web service)
        This is the output of the web service after processing the request.
        ===================================================
        ----- start ----
        <SOAP-ENV:Envelope
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <SOAP-ENV:Body>

        <ns:lookupTicketResponse xmlns:ns="urn:zzz:xml:ns:pmp-1.0">

        <ns:result code="100">

        <ns:message>Successfull</ns:message>

        </ns:result>

        </ns:lookupTicketResponse>

        </SOAP-ENV:Body>

        </SOAP-ENV:Envelope>
        ----- end ----


        ===========================================
        PERL CODE THAT DOES THE TRICK
        ===========================================

        This Perl code uses SOAP::Lite to access a document/literal web
        service.
        The web service is hosted in BEA.


        ---- program start ----------
        use strict;
        use SOAP::Lite;

        # IMPORTANT
        #
        # uri "urn:zzz:xml:ns:pmp-1.0" is the key to this document/litral
        type. Make
        # sure you have the correct uri.


        my $soap = SOAP::Lite
        -> uri('urn:zzz:xml:ns:pmp-1.0')
        -> on_action( sub { return
        '"http://localhost:7001/WebServices/pmp10.jws/lookupTicketRequest"' }
        )
        -> proxy('http://localhost:7001/WebServices/pmp10.jws');

        #Set the operation to call
        my $method = SOAP::Data->name('lookupTicketRequest')
        ->attr({xmlns => 'urn:zzz:xml:ns:pmp-1.0'});

        #Set data elements
        my $query = SOAP::Data->name(ticketNumber => '123456');

        my $result = SOAP::SOM->new;

        #Call the service
        $result = $soap->call($method => $query);

        unless ($result->fault) {

        #Get 'result' element of element 'lookupTicketResponse'
        my $result1 = $result->valueof('//lookupTicketResponse/result');

        #Get the 'code' attribute of element 'result'
        print "Code =
        ".$result->dataof('//lookupTicketResponse/result')
        ->attr->{'code'}."\n";

        #Get the element 'message' of element 'result'
        print "Message =
        ".$result->valueof('//lookupTicketResponse/result/message');

        print "\n";

        } else {
        print join ', ',
        $result->faultcode,
        $result->faultstring,
        $result->faultdetail;
        }
        ---- end program ------------

        ========================
        OUTPUT OF THIS PROGRAM
        ========================

        Code =100
        Message =Successfull
      • Mark Fuller
        ... I have an example client and server I can email to anyone who wants it. It has six examples from simple to complex (including a client call using a WSDL).
        Message 3 of 3 , Jul 2, 2005
        • 0 Attachment
          --- arun9a <arunr2002@...> wrote:

          > I had to spent many hours to find how to access
          > document/literal
          > web services using SOAP:Lite. Cant believe
          > SOAP::Lite folks didnt
          > have time to write a simpleexample.

          I have an example client and server I can email to
          anyone who wants it. It has six examples from simple
          to complex (including a client call using a WSDL).

          I found SOAP::Lite *way* too complex due to its own
          mixed bag of syntaxes. My examples aren't rocket
          science. And they don't explain the 18 different ways
          you can do something in SOAP::Lite (as if that's a
          badge of honor?). It's just six examples to get a
          person up and running without banging their head
          against the wall.

          Mark



          ____________________________________________________
          Yahoo! Sports
          Rekindle the Rivalries. Sign up for Fantasy Football
          http://football.fantasysports.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.