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

new to soap, cant seem to get it right

Expand Messages
  • opus23k
    I m just getting started with SOAP, I ve been asked to write some code to make requests using it. Things are starting to make sense, however all the examples I
    Message 1 of 6 , Dec 30, 2003
    • 0 Attachment
      I'm just getting started with SOAP, I've been asked to write some
      code to make requests using it.

      Things are starting to make sense, however all the examples I see
      and the XML that I'm generating just doesnt match what I'm supposed
      to give.

      Can someone give me a head start with some example code that
      generates something like what I've shown below?

      Your help is greatly appreciated.

      I need to make a number of queries that look like this one:

      <?xml version='1.0'?>
      <SOAP:Envelope xmlns:SOAP='urn:schemas-xmlsoap-org:soap:vl'
      xmlns:elig='www.mywebsite.com/secure/'>
      <SOAP:Body>
      <Batch type='HDRVER' version='000001' date='10/16/2003'
      time='4:42:02 PM' batchsource='' batchid='12345'>
      <Transaction type='INSVER' version='000002'
      submittertraceid='123'>
      <MultipleRequestFlag></MultipleRequestFlag>
      <TestIndicator>T</TestIndicator>
      <SearchCriteria>
      <BenefitType></BenefitType>
      <DateOfService></DateOfService>
      </SearchCriteria>
      </Transaction>
      </Batch>
      </SOAP:Body>
      </SOAP:Envelope>
    • opus23k
      ... Take a look at http://soapenv.org/article.pl? sid=02/02/11/1740229&mode=thread Also, see Byrne Reese s website. http://majordojo.com/soaplite/ ... These
      Message 2 of 6 , Dec 30, 2003
      • 0 Attachment
        OK so I got some useful information from Jonathan:
        ---------
        Take a look at http://soapenv.org/article.pl?
        sid=02/02/11/1740229&mode=thread

        Also, see Byrne Reese's website.
        http://majordojo.com/soaplite/
        ---------

        These sites have helped but I'm still having some trouble getting
        this right.

        So you can see the XML I'm trying to generate at the bottom of this
        message, but here's as close as I can get to that:

        <?xml version="1.0" encoding="UTF-8"?>
        <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-
        instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-
        ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <SOAP-ENV:Body>
        <namesp1:Batch xmlns:namesp1="urn:schemas-xmlsoap-org:soap:vl">
        <Transaction>
        <MultipleRequestFlag xsi:type="xsd:string"/>
        </Transaction>
        <Transaction>
        <TestIndicator xsi:type="xsd:string">T</TestIndicator>
        </Transaction>
        <Transaction>
        <SearchCriteria>
        <BenefitType xsi:type="xsd:string"/>
        </SearchCriteria>
        <SearchCriteria>
        <DateOfService xsi:type="xsd:string"/>
        </SearchCriteria>
        </Transaction>
        </namesp1:Batch>
        </SOAP-ENV:Body>
        </SOAP-ENV:Envelope>


        I'm using this Code:

        use SOAP::Lite;

        print SOAP::Lite
        ->uri('urn:schemas-xmlsoap-org:soap:vl')
        ->on_action(sub { return 'urn:schemas-xmlsoap-org:soap:vl' })
        ->proxy('https://www.mywebsite.com/secure/SOAP.asp')
        ->Batch(
        SOAP::Data->name("Transaction" =>
        (
        \SOAP::Data->name("MultipleRequestFlag" => ''),
        \SOAP::Data->name("TestIndicator" => 'T'),
        \SOAP::Data->name("SearchCriteria" =>
        (
        \SOAP::Data->name("BenefitType" => ''),
        \SOAP::Data->name("DateOfService" => '')
        ))
        ))
        )
        ->result;


        There apears to be several major differences, first my SOAP
        envelope, I dont know how to modify whats going in this tag and its
        really wrong right now.

        Then calling the function 'Batch' must not be the right way to go
        about it since that looks completely wrong, but I cant seem to use
        SOAP::Data unless its inside a function.

        And it also appears that <transaction> is creating a new tag for
        every subelement.

        Any help is appreciated.

        Thanks!

        --- In soaplite@yahoogroups.com, "opus23k" <nihal@e...> wrote:
        > I'm just getting started with SOAP, I've been asked to write some
        > code to make requests using it.
        >
        > Things are starting to make sense, however all the examples I see
        > and the XML that I'm generating just doesnt match what I'm
        supposed
        > to give.
        >
        > Can someone give me a head start with some example code that
        > generates something like what I've shown below?
        >
        > Your help is greatly appreciated.
        >
        > I need to make a number of queries that look like this one:
        >
        > <?xml version='1.0'?>
        > <SOAP:Envelope xmlns:SOAP='urn:schemas-xmlsoap-org:soap:vl'
        > xmlns:elig='www.mywebsite.com/secure/'>
        > <SOAP:Body>
        > <Batch type='HDRVER' version='000001' date='10/16/2003'
        > time='4:42:02 PM' batchsource='' batchid='12345'>
        > <Transaction type='INSVER' version='000002'
        > submittertraceid='123'>
        > <MultipleRequestFlag></MultipleRequestFlag>
        > <TestIndicator>T</TestIndicator>
        > <SearchCriteria>
        > <BenefitType></BenefitType>
        > <DateOfService></DateOfService>
        > </SearchCriteria>
        > </Transaction>
        > </Batch>
        > </SOAP:Body>
        > </SOAP:Envelope>
      • Tim Wood
        ... SOAPbox: There seems to be a meta-problem with SOAP::Lite that s keeping from being as useful as it could be. Basically I and others are encountering fog
        Message 3 of 6 , Dec 30, 2003
        • 0 Attachment
          At 01:27 PM 12/30/03, opus23k wrote:
          >OK so I got some useful information from Jonathan:
          >---------
          >Take a look at http://soapenv.org/article.pl?
          >sid=02/02/11/1740229&mode=thread
          >
          >Also, see Byrne Reese's website.
          >http://majordojo.com/soaplite/
          >---------
          >
          >These sites have helped but I'm still having some trouble getting
          >this right.
          >
          >So you can see the XML I'm trying to generate...

          SOAPbox: There seems to be a meta-problem with SOAP::Lite that's keeping from being as useful as it could be. Basically I and others are encountering fog where there should be a clear semantic model of what SOAP::Lite APIs have what effect on which SOAP messages. Clearly SOAP::Lite is a powerful package, but without a tutorial doc, or at very least a Javadoc-style API spec, it's very difficult to know how to use the package to get a desired result.

          The fact that we have to work at the level of SOAP message text and reading the SOAP::Lite code in order to guess what to do is a red flag. The possible highest priority for SOAP::Lite development is not more cool features but a comprehensive usage guide that covers major distributed programming patterns. Byrne's site has several Perls which need to be edited and collected into a volume. Ideally, one should be able to design and implement a Web service (with components in different languages/frameworks) without having to view SOAP messages or the SOAP::Lite code. The sooner SOAP becomes a hidden implementation detail, the more productive we'll all be.

          Now back to your regularly scheduled hacking.

          TW
        • Byrne Reese
          I could not agree with you more Tim. I have considered documentation to be a real short-coming since I started using SOAP::Lite. Luckily Randy J. Ray, the
          Message 4 of 6 , Jan 4, 2004
          • 0 Attachment
            I could not agree with you more Tim.

            I have considered documentation to be a real short-coming since I
            started using SOAP::Lite. Luckily Randy J. Ray, the author of
            the "Programming Web Services with Perl" book from Oreilly, has
            volunteered (with permission from Oreilly of course) to reproduce a
            large part of the aforementioned book in Perl POD format. It will not
            be a carbon copy of the book, but will take the API documentation a
            quantum-leap forward.

            The sooner we can get a digital copy of that book, the sooner I can
            start integrating it. I will ping Randy again to check his status on
            this very important deliverable.

            --- In soaplite@yahoogroups.com, Tim Wood <timwood0@p...> wrote:
            > At 01:27 PM 12/30/03, opus23k wrote:
            > >OK so I got some useful information from Jonathan:
            > >---------
            > >Take a look at http://soapenv.org/article.pl?
            > >sid=02/02/11/1740229&mode=thread
            > >
            > >Also, see Byrne Reese's website.
            > >http://majordojo.com/soaplite/
            > >---------
            > >
            > >These sites have helped but I'm still having some trouble getting
            > >this right.
            > >
            > >So you can see the XML I'm trying to generate...
            >
            > SOAPbox: There seems to be a meta-problem with SOAP::Lite that's
            keeping from being as useful as it could be. Basically I and others
            are encountering fog where there should be a clear semantic model of
            what SOAP::Lite APIs have what effect on which SOAP messages.
            Clearly SOAP::Lite is a powerful package, but without a tutorial doc,
            or at very least a Javadoc-style API spec, it's very difficult to
            know how to use the package to get a desired result.
            >
            > The fact that we have to work at the level of SOAP message text and
            reading the SOAP::Lite code in order to guess what to do is a red
            flag. The possible highest priority for SOAP::Lite development is
            not more cool features but a comprehensive usage guide that covers
            major distributed programming patterns. Byrne's site has several
            Perls which need to be edited and collected into a volume. Ideally,
            one should be able to design and implement a Web service (with
            components in different languages/frameworks) without having to view
            SOAP messages or the SOAP::Lite code. The sooner SOAP becomes a
            hidden implementation detail, the more productive we'll all be.
            >
            > Now back to your regularly scheduled hacking.
            >
            > TW
          • jpeyser
            Here are some methods that will help to generate the desired XML. $soap - uri( urn:schemas-xmlsoap-org:soap:vl ) - on_action(sub { return
            Message 5 of 6 , Jan 5, 2004
            • 0 Attachment
              Here are some methods that will help to generate the desired XML.

              $soap
              ->uri('urn:schemas-xmlsoap-org:soap:vl')
              ->on_action(sub { return 'urn:schemas-xmlsoap-org:soap:vl' })
              ->proxy('https://www.mywebsite.com/secure/SOAP.asp')
              -> maptype({`elig' => 'www.mywebsite.com/secure/'})
              -> autotype(0)
              -> envprefix('SOAP')

              However, there are a number of issues.

              First, there are predefined schemas in SOAP::Lite that are placed in
              the envelope; urn:schemas-xmlsoap-org:v1 is not one of them. So,
              there is no way to put it in the envelope without hacking (See
              SOAP::Constants)

              Second, there is no reason to put it in the envelope as it will be
              the default namespace for the method.

              <namesp1:Batch xmlns:namesp1="urn:schemas-xmlsoap-
              org:soap:vl">

              Third, I have encountered ASP SOAP servers that do not like namespace
              prefixes. The above line would have to be generated as

              < Batch xmlns="urn:schemas-xmlsoap-org:soap:vl">

              This can be accomplished by redefining SOAP::Serializer::gen_ns (THIS
              IS A HACK)

              BEGIN {
              # no warnings 'redefine';
              local($^W) = 0;
              *SOAP::Serializer::gen_ns = sub {};
              }

              However, prefixes in SOAP::Lite are an important part of namespace
              mapping as can be seen from the next issue. Suppressing the prefixes
              will interfere with some mappings.

              Lastly, the method maptype will add the namespace definition to the
              envelope, provided that it is referenced in the XML. There is no
              prefix `elig' for any method or element.

              Jonathan

              --- In soaplite@yahoogroups.com, "opus23k" <nihal@e...> wrote:
              >
              > So you can see the XML I'm trying to generate at the bottom of this
              > message, but here's as close as I can get to that:
              >
              > <?xml version="1.0" encoding="UTF-8"?>
              > <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-
              > instance" xmlns:SOAP-
              ENC="http://schemas.xmlsoap.org/soap/encoding/"
              > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
              > xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-
              > ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
              > <SOAP-ENV:Body>
              > <namesp1:Batch xmlns:namesp1="urn:schemas-xmlsoap-org:soap:vl">
              > <Transaction>
              > <MultipleRequestFlag xsi:type="xsd:string"/>
              > </Transaction>
              > <Transaction>
            • Byrne Reese
              In the upcoming release of SOAP::Lite, one will be able to programmatically turn namespace prefixing on/off. .NET for example wants default namespaces to be
              Message 6 of 6 , Jan 6, 2004
              • 0 Attachment
                In the upcoming release of SOAP::Lite, one will be able to
                programmatically turn namespace prefixing on/off. .NET for example wants
                default namespaces to be used, as opposed to prefixes. In any event, this
                capability is forthcoming.

                >
                >
                >
                >
                > Here are some methods that will help to generate the desired XML.
                >
                > $soap
                > -
                >
                >
                >
                >
                > Yahoo! Groups Links
                >
                > To visit your group on the web, go
                > to:http://groups.yahoo.com/group/soaplite/
                > To unsubscribe from this group, send an email
                > to:soaplite-unsubscribe@yahoogroups.com
                > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
                >
                >
                >
                >
                >
                >
                >


                ^byrne :/
              Your message has been successfully submitted and would be delivered to recipients shortly.