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

Re: [soaplite] xsi:type="SOAP-ENC:base64 -- Ok i found it

Expand Messages
  • Tilman Baumann
    ... I see that, my problems get more and more focused to the data Formating at the server side. If i put a hash to a request it appears at the server verry
    Message 1 of 7 , Nov 11, 2003
    • 0 Attachment
      Tilman Baumann wrote:
      > So sending data to the server runs perfect. I'm sending the data in
      > great perl hashes wich SOAP::Lite convert verry well.
      >
      > So, the server has to send the client a file (or lets say a bytestream)
      > in some cases.
      > I saw no examples they describe a way to do this.
      > I think i need a filed with type xsi:type="SOAP-ENC:base64".

      I see that, my problems get more and more focused to the data Formating
      at the server side.
      If i put a hash to a request it appears at the server verry well. But if
      i return any complex datatype at the server some wired things happen..

      sub validate{
      return {
      SOAP::Data->type('base64' => 'Here comes the file...'),
      "infotext" => "Well done"
      };
      }

      Btw. Would it be easy to handle for a .net server if i use the standard
      Struct Array Datatypes all the time.
      or, why doesn't all the soapservies use this style and put theyr info in
      a well formed and human readable xml form.
      like
      <foo>
      <bar/>
      <baz>boo</baz>
      </foo>

      My form is'nt that pretty, and sadly i find no way to formatt my complex
      structures in this way. :(


      Sorry for my stupid questions.
      --
      Tilman Baumann

      pyramid computer GmbH
      Boetzinger Strasse 60 D-79111 Freiburg

      ----------------------------------
      They who would give up an essential liberty for temporary security, deserve
      neither liberty or security
      - Benjamin Franklin
    • Tilman Baumann
      Well, i think i m in the know now. Mostly... I have still one single Problem. How do i access parts at the serverside when they are like a array. Like this:
      Message 2 of 7 , Nov 12, 2003
      • 0 Attachment
        Well, i think i 'm in the know now. Mostly...


        I have still one single Problem. How do i access parts at the serverside
        when they are like a array.

        Like this: (Code at the clients side)
        (it's not necessary to understnad the german words... :) )
        SOAP::Data->name("kunde" => \SOAP::Data->value(
        SOAP::Data->name("name" => "Tilman"),
        SOAP::Data->name("ansprechpartner" =>
        \SOAP::Data->value(

        SOAP::Data->name("name" => "foo"),
        SOAP::Data->name("email" => "foo\@bar"),
        )),
        SOAP::Data->name("ansprechpartner" =>
        \SOAP::Data->value(
        SOAP::Data->name("name" => "foo"),
        SOAP::Data->name("email" => "foo\@bar"),
        )),
        SOAP::Data->name("ansprechpartner" =>
        \SOAP::Data->value(
        SOAP::Data->name("name" => "foo"),
        SOAP::Data->name("email" => "foo\@bar"),
        )),
        ))...

        At the server i get this:
        'kunde' => {
        'ansprechpartner' => {
        'email' => 'foo@bar',
        'tel' => '6415646',
        'fax' => '316484',
        'name' => 'foo'
        },
        'name' => 'Tilman'
        },

        All 'ansprechpartner' nodes appear in the xml stream that gets
        transported over the net.


        Here the servercode, respectively the handling method in the Module:

        sub register{
        print STDERR "incomming struct: " . Dumper($_[1]) . "\n";
        print "\$_[0] Typ: " . ref($_[0]) . "\n";
        print "\$_[1] Typ: " . ref($_[1]) . "\n";

        return SOAP::Data->name("lizenz" =>
        \SOAP::Data->value(
        SOAP::Data->name("zertifikat" =>
        SOAP::Data->type('base64' => 'zsdfsdfsdfsdgferrtwerwe')),
        SOAP::Data->name("message" => "Yo cool, deine Kiste ist
        nun registriert. Am besten machst du gleich mal ein update")
        ));


        I think it would be easy to handle with a SOM tree. But $_[1] has HASH
        type and is not a SOM.

        Is there a way to access the other 'ansprechpartner' fields?

        Hm, i tested something yet and it runs...
        If i put them all into a array, i see them all at the serverside.

        Im not sure if that is good style, anyway i post this mail. Maybe
        somebody has something to say to it...


        --
        Tilman Baumann

        pyramid computer GmbH
        Boetzinger Strasse 60 D-79111 Freiburg

        ----------------------------------
        They who would give up an essential liberty for temporary security, deserve
        neither liberty or security
        - Benjamin Franklin
      • Tilman Baumann
        ... The array is sadly not named. So it would be maybe a bit dificult to parse at the serverside. Is there a way to create something like
        Message 3 of 7 , Nov 12, 2003
        • 0 Attachment
          Tilman Baumann wrote:
          > If i put them all into a array, i see them all at the serverside.

          The array is sadly not named. So it would be maybe a bit dificult to
          parse at the serverside.

          Is there a way to create something like
          <anpsrechpartners xsi:type="SOAP-ENC:Array">
          <ansprechpartner/>
          <ansprechpartner/>
          <ansprechpartner/>
          </anpsrechpartners>


          --
          Tilman Baumann

          pyramid computer GmbH
          Boetzinger Strasse 60 D-79111 Freiburg

          ----------------------------------
          They who would give up an essential liberty for temporary security, deserve
          neither liberty or security
          - Benjamin Franklin
        • Duncan Cameron
          ... I m afraid that I have lost track of quite what you are trying to achieve
          Message 4 of 7 , Nov 12, 2003
          • 0 Attachment
            At 10:24:01 on 2003-11-12 Tilman Baumann <Tilman.Baumann@...> wrote:

            >Tilman Baumann wrote:
            >
            >> If i put them all into a array, i see them all at the serverside.
            >
            >The array is sadly not named. So it would be maybe a bit dificult to
            >parse at the serverside.
            >Is there a way to create something like
            ><anpsrechpartners xsi:type="SOAP-ENC:Array">
            ><ansprechpartner/>
            ><ansprechpartner/>
            ><ansprechpartner/>
            ></anpsrechpartners>
            I'm afraid that I have lost track of quite what you are trying to achieve <;
            If you are using SOAP::Lite on both client and server and not concerned about interoperability then you may as well use SOAP::Lite's automatic encoding of Perl variables
            to send an array you need to pass an array ref
            to send a hash you need to pass a hash ref

            so maybe your example could be coded as

            $soap->method({
            'name' => 'Tilman',
            'ansprechpartner' => [
            {name => 'foo', email => 'foo@bar'},
            {name => 'foo2', email => 'f002@bar'}
            # etc
            ]
            }
            );
            Your server method will receive a hash ref through which it can access the individual elements and the array.

            If you really need to access the SOAP envelope from your server class then you need to inherit from SOAP::Server::Parameters, see the section in the docs "ACCESSING HEADERS AND ENVELOPE ON SERVER SIDE"

            Regards
            Duncan
          • Byrne Reese
            Let me suggest you use an attachment. It is a much easier solution than trying to embed a base64 encoded file into some XML. Use SOAP::Lite v0.60, or
            Message 5 of 7 , Nov 12, 2003
            • 0 Attachment
              Let me suggest you use an attachment. It is a much easier solution than
              trying to embed a base64 encoded file into some XML.

              Use SOAP::Lite v0.60, or SOAP::Lite v0.55 with SOAP::MIME. Even though the
              two toolkits are merged in 0.60, the code samples are the same:

              http://www.majordojo.com/SOAP-MIME/

              > I banished the thought of making object oriententated programminig in
              > SOAP. But problems still stay. :)
              >
              > So sending data to the server runs perfect. I'm sending the data in
              > great perl hashes wich SOAP::Lite convert verry well.
              >
              > So, the server has to send the client a file (or lets say a bytestream)
              > in some cases.
              > I saw no examples they describe a way to do this.
              > I think i need a filed with type xsi:type="SOAP-ENC:base64".
              >
              > (My real part is the client, but i have to implement a testserver since
              > there is no real server. Other people has to implement the real server
              > towards my specification...)
              >
              > Thank you again :)
              >
              > PS: I did'nt saw my last post apper at the list. You neither?
              >
              > --
              > Tilman Baumann
              >
              > pyramid computer GmbH
              > Boetzinger Strasse 60 D-79111 Freiburg
              >
              > ----------------------------------
              > They who would give up an essential liberty for temporary security,
              > deserve
              > neither liberty or security
              > - Benjamin Franklin
              >
              >
              >
              >
              >
              >
              >
              >
              >
              > Yahoo! Groups Sponsor
              >
              >
              > ADVERTISEMENT
              >
              >
              >
              >
              >
              >
              >
              >
              >
              > 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 :/
            • Byrne Reese
              Duncan is right - you need to extend SOAP::Server::Parameters. There is a good article that provides these code samples:
              Message 6 of 7 , Nov 12, 2003
              • 0 Attachment
                Duncan is right - you need to extend SOAP::Server::Parameters. There is a
                good article that provides these code samples:

                http://builder.com.com/5100-6389-1046624.html
                http://builder.com.com/5100-6389-1052448.html

                >
                >
                >
                >
                >
                > Well, i think i 'm in the know now. Mostly...
                >
                >
                > I have still one single Problem. How do i access parts at the serverside
                > when they are like a array.
                >
                > Like this: (Code at the clients side)
                > (it's not necessary to understnad the german words... :) )
                > SOAP::Data-
                >
                >
                >
                >
                > 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.