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

Sending complex data structures using stubmaker

Expand Messages
  • Roland Rosenfeld
    Hi! I m new to SOAP::Lite, so excuse me, if my question is a little bit stupid, but I didn t find an answer in the documentation yet. I have a WSDL file where
    Message 1 of 2 , Aug 24, 2005
    • 0 Attachment
      Hi!

      I'm new to SOAP::Lite, so excuse me, if my question is a little bit
      stupid, but I didn't find an answer in the documentation yet.

      I have a WSDL file where a function createUser (among others) is
      defined which takes one argument with the name "User" and the type
      "User". The type "User" is a data structure which consists of an
      array of UserIdentifier (which is another struct) and some other
      (optional) types.

      Now i used stubmaker.pl from SOAP::Lite 0.65_6 and created a
      SoapUserManagementService.pm from the WSDL file.

      With another WSDL file, where all functions are called with strings
      and other simple data types I now was able to call the functions from
      the WSDL file.

      If I try this with the new WSDL file and the function createUser, I
      always get the message
      Type 'User' can't be found in a schema class 'SOAP::Serializer'

      "User" seems to be the type of the struct parameter of createUser.
      But how can I tell SOAP::Lite, that the data type which I feed into
      createUser as the first parameter is type "User"?
      I tried the following:

      my $User = SOAP::Data->name('User' => \SOAP::Data->value(
      SOAP::Data->name("UserIdentifiers" => @UserIdentifiers)),
      type=>'User');
      my $res = $sums->createUser(SOAP::Data->new(name=>'User',
      type=>'User', value=>$User));

      But all this doesn't help, I still get the message
      Type 'User' can't be found in a schema class 'SOAP::Serializer'

      Do I have to extend SOAP::Serializer to be able to send complex
      structs to the SOAP server? Or is stubmaker.pl unable to create stubs
      for functions with complex struct parameters?

      I didn't find much documentation about complex struct parameters as
      input (most documentation talks about struct results). All I found
      was the following in SOAP::Data(3pm):

      EXAMPLES
      [...]
      COMPLEX TYPES

      A common question is how to do you created nested XML elements using
      SOAP::Lite. The following example demonstrates how:

      SOAP::Data->name('foo' => \SOAP::Data->value(
      SOAP::Data->name('bar' => '123')));

      The above code will produce the following XML:

      <foo>
      <bar>123</bar>
      </foo>

      But this doesn't talk about stubmaker.pl and SOAP::Serializer.

      Here's the %methods snipplet from the created stub:

      createUser => {
      endpoint => 'http://localhost:8080/jboss-net/services/UserManagement',
      soapaction => 'UserManagement',
      uri => 'http://usermanagement.soap.commonprovisioning.alcatel.com',
      parameters => [
      SOAP::Data->new(name => 'in0', type => 'tns1:User', attr => {}),
      ], # end parameters
      }, # end createUser

      The problem is "tns1:User", because if I modify this one to
      "tns1:User2", the error message changes accordingly and talks about
      "User2".

      If I missed some documentation about this, don't hesitate to point me
      to this, but neither in "Users Guide" nor in "Cookbook" I found hints
      to handle complex data types as SOAP function parameters.

      Tschoeeee

      Roland
    • mbouvant
      Hello, I ve exactly the same problem which is not present in old version (like perl-SOAP-Lite-0.60). Type verification wasn t done in the past. If you comment
      Message 2 of 2 , Mar 7, 2006
      • 0 Attachment
        Hello,
        I've exactly the same problem which is not present in old version
        (like perl-SOAP-Lite-0.60). Type verification wasn't done in the past.
        If you comment these lines in Lite.pm, it works fine :

        package SOAP::XMLSchema1999::Serializer;
        ...
        # die "Type '$method' can't be found in a schema class '$package'\n"
        # unless $method =~ s/^as_// && grep {$_ eq $method}
        @{"$package\::EXPORT"};
        ...

        Now, I'm very embarassed like you, and I don't know if there is a
        better solution like exporting automaticely types with stubmaker.pl ?

        For the moment, I use the version 0.60 for stub generation...

        Mathias

        --- In soaplite@yahoogroups.com, Roland Rosenfeld <rrosenfeld@...> wrote:
        >
        > Hi!
        >
        > I'm new to SOAP::Lite, so excuse me, if my question is a little bit
        > stupid, but I didn't find an answer in the documentation yet.
        >
        > I have a WSDL file where a function createUser (among others) is
        > defined which takes one argument with the name "User" and the type
        > "User". The type "User" is a data structure which consists of an
        > array of UserIdentifier (which is another struct) and some other
        > (optional) types.
        >
        > Now i used stubmaker.pl from SOAP::Lite 0.65_6 and created a
        > SoapUserManagementService.pm from the WSDL file.
        >
        > With another WSDL file, where all functions are called with strings
        > and other simple data types I now was able to call the functions from
        > the WSDL file.
        >
        > If I try this with the new WSDL file and the function createUser, I
        > always get the message
        > Type 'User' can't be found in a schema class 'SOAP::Serializer'
        >
        > "User" seems to be the type of the struct parameter of createUser.
        > But how can I tell SOAP::Lite, that the data type which I feed into
        > createUser as the first parameter is type "User"?
        > I tried the following:
        >
        > my $User = SOAP::Data->name('User' => \SOAP::Data->value(
        > SOAP::Data->name("UserIdentifiers" => @UserIdentifiers)),
        > type=>'User');
        > my $res = $sums->createUser(SOAP::Data->new(name=>'User',
        > type=>'User', value=>$User));
        >
        > But all this doesn't help, I still get the message
        > Type 'User' can't be found in a schema class 'SOAP::Serializer'
        >
        > Do I have to extend SOAP::Serializer to be able to send complex
        > structs to the SOAP server? Or is stubmaker.pl unable to create stubs
        > for functions with complex struct parameters?
        >
        > I didn't find much documentation about complex struct parameters as
        > input (most documentation talks about struct results). All I found
        > was the following in SOAP::Data(3pm):
        >
        > EXAMPLES
        > [...]
        > COMPLEX TYPES
        >
        > A common question is how to do you created nested XML
        elements using
        > SOAP::Lite. The following example demonstrates how:
        >
        > SOAP::Data->name('foo' => \SOAP::Data->value(
        > SOAP::Data->name('bar' => '123')));
        >
        > The above code will produce the following XML:
        >
        > <foo>
        > <bar>123</bar>
        > </foo>
        >
        > But this doesn't talk about stubmaker.pl and SOAP::Serializer.
        >
        > Here's the %methods snipplet from the created stub:
        >
        > createUser => {
        > endpoint =>
        'http://localhost:8080/jboss-net/services/UserManagement',
        > soapaction => 'UserManagement',
        > uri => 'http://usermanagement.soap.commonprovisioning.alcatel.com',
        > parameters => [
        > SOAP::Data->new(name => 'in0', type => 'tns1:User', attr => {}),
        > ], # end parameters
        > }, # end createUser
        >
        > The problem is "tns1:User", because if I modify this one to
        > "tns1:User2", the error message changes accordingly and talks about
        > "User2".
        >
        > If I missed some documentation about this, don't hesitate to point me
        > to this, but neither in "Users Guide" nor in "Cookbook" I found hints
        > to handle complex data types as SOAP function parameters.
        >
        > Tschoeeee
        >
        > Roland
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.