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

gSoap with SOAP::Lite

Expand Messages
  • techrg99
    Is it possible to use gSOAP (http://www.cs.fsu.edu/~engelen/soap.html) as a client with a SOAP::Lite (Apache, mod_perl, mod_soap) server? If so, are there any
    Message 1 of 4 , Sep 26, 2006
    • 0 Attachment
      Is it possible to use gSOAP (http://www.cs.fsu.edu/~engelen/soap.html)
      as a client with a SOAP::Lite (Apache, mod_perl, mod_soap) server? If
      so, are there any examples out on the web?
    • Mike South
      Also, how about using a SOAP::Lite client to talk to a gSOAP server? Someone told me they tried this and it wouldn t work. I d like to know if anyone has
      Message 2 of 4 , Sep 26, 2006
      • 0 Attachment
        Also, how about using a SOAP::Lite client to talk to a gSOAP server?  Someone told me they tried this and it wouldn't work.

        I'd like to know if anyone has experience in that direction.

        mike

        On 9/26/06, techrg99 <bhess@...> wrote:
        Is it possible to use gSOAP (http://www.cs.fsu.edu/~engelen/soap.html)
        as a client with a SOAP::Lite (Apache, mod_perl, mod_soap) server?  If
        so, are there any examples out on the web?







        Yahoo! Groups Links

        <*> To visit your group on the web, go to:
            http://groups.yahoo.com/group/soaplite/

        <*> Your email settings:
            Individual Email | Traditional

        <*> To change settings online go to:
            http://groups.yahoo.com/group/soaplite/join
            (Yahoo! ID required)

        <*> To change settings via email:
            mailto:soaplite-digest@yahoogroups.com
            mailto:soaplite-fullfeatured@yahoogroups.com

        <*> To unsubscribe from this group, send an email to:
            soaplite-unsubscribe@yahoogroups.com

        <*> Your use of Yahoo! Groups is subject to:
            http://docs.yahoo.com/info/terms/




      • flemmon
        It s no cake walk, that s for sure. I ve been fooling with it this past week. Basically, as soon as a complex type is involved in a method call, you re pretty
        Message 3 of 4 , Sep 29, 2006
        • 0 Attachment
          It's no cake walk, that's for sure. I've been fooling with it this
          past week. Basically, as soon as a complex type is involved in a
          method call, you're pretty much on your own to serialize the request
          body properly. The best bet I've seen so far is to go lower level with
          SOAP::Data::ComplexType, but I can't get it to work quite right, either.

          Frank

          --- In soaplite@yahoogroups.com, "Mike South" <msouth@...> wrote:
          >
          > Also, how about using a SOAP::Lite client to talk to a gSOAP server?
          > Someone told me they tried this and it wouldn't work.
          >
          > I'd like to know if anyone has experience in that direction.
          >
          > mike
        • Sherzod Ruzmetov
          Btw, very nice job on the ComplexType module. I had to code a similar solution for eBay Perl SDK, so I think SOAP::Data::ComplexType s interface is a little
          Message 4 of 4 , Sep 30, 2006
          • 0 Attachment
            Message
            Btw, very nice job on the ComplexType module. I had to code a similar solution for eBay Perl SDK, so I think SOAP::Data::ComplexType's interface is a little too complex, and believe could be made simpler.
             
            Depending on the nature of your type, you may have to come up with your own solution. For eBay's SDK I had to create an AbstractType as the parent of all the complexTypes. AbstractType has a method called "serialize()" which is used to serialize its content  into a tree of SOAP::Data objects. If any value in the object attribute is of AbstractType, it's serialize() method is called, which facilitates unlimited recursive complexType creation.
             
            Following is the serialize() method from my AbstractType, again, AbstractType is the base of all the complexTypes (over 550 of them in eBay's WSDL). This means, any type that inherits from AbstractType automatically support serialize() method as the result of inheritance, and can serialize themselves accordingly:
             
            sub serialize {
                my $self        = shift;
             
                my @data = ();
                for my $name ( $self->columns ) {
                    my $value = $self->get( $name );
             
                    #
                    # If the tag doesn't have any value, we do not populate
                    # the tag
                    next unless ( defined $value );
             
             
             
                    #
                    # If the value is an array, it has to be walked through
                    # and serialized seperately
                    if ( ref($value) && (ref $value eq 'ARRAY') ) {
                        my @array_data = ();
                        for ( @$value ) {
             
                            #
                            # If the element is an instance of AbstractType,
                            # we know it already supports 'serialize()' method, which
                            # can return porperly serialized data:
                            if (ref($_) && ($_->isa("eBay::API::AbstractType"))) {
                                push @array_data, \$_->serialize();
                            }
             
                            #
                            # If the value is not an instance of AbstractType,
                            # we explicitly have it serialized as a value.
                            else {
                                push @array_data, SOAP::Data->value($_);
                            }
                        }
             
                        #
                        # Serializing the array data with $name
                        my $sd = SOAP::Data->name($name => \@array_data);
             
                        #
                        # If value has any type data in xs: namespace (native)
                        # we make sure to tell SOAP::Data about it to have it
                        # serialized properly
                        if ( defined($self->{_columns}->{$name}->[1])
                            && (my ($type) = $self->{_columns}->{$name}->[1] =~ m/^xs:(.+)$/)) {
                            if ( ($type eq 'token') || ($type eq 'anyURI') ) {
                                $sd->type( $type );
                            }
                        }
                        push @data, $sd;
                    }
             

                    #
                    # If the single value is an instance of AbstractType or any of its
                    # descendants, we know it already supports serialize(), so we take
                    # advantage of that.
                    elsif ( ref($value) && UNIVERSAL::isa($value, "eBay::API::AbstractType") ) {
             
                        #
                        # Below we're identifying it's native data type, if known
                        my $sd = SOAP::Data->name($name, \$value->serialize);
                         if ( defined($self->{_columns}->{$name}->[1])
                            && (my ($type) = $self->{_columns}->{$name}->[1] =~ m/^xs:(.+)$/)) {
                            $sd->type($type);
                        }
                        push @data, $sd;
                    }
             
                    #
                    # If none of the above assumptions are true, we assume the value is a regular
                    # native data type that SOAP::Data should be able to serialize accordingly.
                    else {
                        my $sd = SOAP::Data->name($name, $value);
                         if ( defined($self->{_columns}->{$name}->[1])
                            && (my ($type) = $self->{_columns}->{$name}->[1] =~ m/^xs:(.+)$/)) {
                            $sd->type($type) unless $type eq 'token';
                        }
                        push @data, $sd;
                    }
                }
             
                #
                # We return the whole object as a value, because all the
                # objects will be either contents, or children of a parent
                # tag, the information not yet know for the object itself.
                return SOAP::Data->value(@data);
            }
             
             
             
            Good Luck
             
            Sherzod Ruzmetov
            http://ebay.handalak.com - Perl SDK for eBay's SOAP API
            http://author.handalak.com/uz/ - Yigitlik Sarguzashtlari
             
             
             
             
            -----Original Message-----
            From: soaplite@yahoogroups.com [mailto:soaplite@yahoogroups.com] On Behalf Of flemmon
            Sent: Friday, September 29, 2006 4:33 PM
            To: soaplite@yahoogroups.com
            Subject: [soaplite] Re: gSoap with SOAP::Lite

            It's no cake walk, that's for sure. I've been fooling with it this
            past week. Basically, as soon as a complex type is involved in a
            method call, you're pretty much on your own to serialize the request
            body properly. The best bet I've seen so far is to go lower level with
            SOAP::Data:: ComplexType, but I can't get it to work quite right, either.

            Frank

            --- In soaplite@yahoogroup s.com, "Mike South" <msouth@...> wrote:
            >
            > Also, how about using a SOAP::Lite client to talk to a gSOAP server?
            > Someone told me they tried this and it wouldn't work.
            >
            > I'd like to know if anyone has experience in that direction.
            >
            > mike

          Your message has been successfully submitted and would be delivered to recipients shortly.