seki has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I am trying to understand (and perhaps fix somes issues in) the implementation of SOAP::WSDL while trying to set attributes for an element inside a request and I am struggling with the notations like

my %xmlns_of            :ATTR(:name<xmlns> :default<{}>);
that are used a lot i.e in SOAP::WSDL::BASE.pm and in the Elements and Types generated by the script wsdl2perl.pl in order to build SOAP request by filling a simple hashtable (all the types resolving and corresponding xml generation is done at run time thanks to the generated packages).

I have made some research to understand the attributes with Attribute::Handlers but it seems to be a variation as the documentation does not show the attributes in the arguments like for :name, and the code is not even using this package. Or is it something different?

If you can provide some help...

The best programs are the ones written when the programmer is supposed to be working on something else. - Melinda Varian
  • Comment on SOAP::WSDL: variable attributes with attributes also as parameters?

Replies are listed 'Best First'.
Re: SOAP::WSDL: variable attributes with attributes also as parameters?
by genio (Beadle) on Nov 27, 2017 at 20:59 UTC
    Hi!

    You are, unfortunately, stuck in a land that most Perlers do not like to visit, SOAP-land. I hate to be the guy who tells you to "use something else" but in this case, I must. XML::Compile and, more specifically, XML::Compile::WSDL11 are more than likely what you want. The author of those modules puts a lot of painstaking effort into keeping those up-to-date and sensible to use.

    I'm sorry you're stuck having to deal with SOAP, but at least there's someone like Mark Overmeer out there to make your life a bit easier!

    Thanks, Chase

      Thanks for the suggestion of XML::Compile::WSDL11 that I was not aware.

      But now I managed to fix the code generated and I can successfully interact with HP Service Management. This code is relatively small, and the user-level is actually minimal. But Obviously I will have to fix the generator.

      I will anyway look at the other alternative

      but at first my question was not xml/xsd attributes related, but perl syntax attributes related. And I still do not know where the notation used by SOAP::WSDL is coming.

Re: SOAP::WSDL: variable attributes with attributes also as parameters?
by kcott (Archbishop) on Nov 27, 2017 at 21:10 UTC

    G'day seki,

    You may find the documentation for the attributes pragma useful. It has many examples and links to related information.

    [I'm unfamiliar with the modules in the SOAP:: namespace, so I can't provide any direct help with that.]

    — Ken

      unfortunately, it does not help as it seems to be more high-level Attribute::Handlers related. And even on top of it, as it is using the

      :ATTR
      notation, but passing arguments different from
      CODE, SCALAR, HASH, ...etc
      that are in the documentation of Attribute::Handlers. I did not find the answer yet.

Re: SOAP::WSDL: variable attributes with attributes also as parameters?
by Anonymous Monk on Nov 30, 2017 at 10:34 UTC

        Great! That's it.

        I never used Class::Std before so I was not accustomed to this representation. A great discovery for the recent Perl coder that I am.

        Many thanks!