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

Hi Monks,

Having used this site in silence for many years (it's been great, thanks :-) ), I've finally found a problem for which I can't find the answer.

I need generate a soap request in with containing the following xml:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel +ope/" xmlns:typ="http://www.corvil.com/ws/stats/types"> <soapenv:Header/> <soapenv:Body> <typ:getCnesRequest version="1"/> </soapenv:Body> </soapenv:Envelope>

The bit I'm really struggling with is getting the tag attribute?: version="1" added to the method getCnesRequest.

I've tried many different ways of doing it including using $soap->getCnesRequest->attr({Version=>"1"}) and even using raw xml, but nothing seems to do what I need...this may be due to the fact that I'm no expert in XML and I may even be using the wrong terminology when I search for the answer.

Any help/pointers anyone can provide would be very much appreciated.

Many thanks.
Trickydicky

2017-12-23 Athanasius added code and paragraph tags

Replies are listed 'Best First'.
Re: SOAP::Lite method attributes
by thanos1983 (Parson) on Dec 22, 2017 at 12:37 UTC

    Hello trickydicky,

    Welcome back, please follow Posting on PerlMonks and more specifically Writeup Formatting Tips.

    Currently your code is really difficult to read / experiment.

    Looking forward to your update, BR.

    Seeking for Perl wisdom...on the process of learning...not there...yet!
      Hi thanos1983,

      Apologies for the rubbish posting, I didn't realise I could use html tags.

      Thanks for pointing out the error of my ways ;-)


      Trickydicky

        Hello again trickydicky,

        No worries no problems, next time you know how to do it correctly. It is preferred to update your question that posting an answer to your question with the fix to the code.

        Having said that take a look at SOAP::SOM/ACCESSING ELEMENT VALUES, I think this is what you are looking for.

        Hope this helps, BR.

        Seeking for Perl wisdom...on the process of learning...not there...yet!
      Hi Monks, Having used this site in silence for many years (it's been great, thanks :-) ), I've finally found a problem for which I can't find the answer.

      I need generate a soap request in with containing the following xml:

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel +ope/" xmlns:typ="http://www.corvil.com/ws/stats/types"> <soapenv:Head +er/> <soapenv:Body> <typ:getCnesRequest version="1"/> </soapenv:Body> + </soapenv:Envelope>

      The bit I'm really struggling with is getting the tag attribute?: version="1" added to the method getCnesRequest.

      I've tried many different ways of doing it including using $soap->getCnesRequest->attr({Version=>"1"}) and even using raw xml, but nothing seems to do what I need...this may be due to the fact that I'm no expert in XML and I may even be using the wrong terminology when I search for the answer.

      Any help/pointers anyone can provide would be very much appreciated.


      Many thanks.
      Trickydicky

        Try

        my $method = SOAP::Data->name('typ:getCnesRequest')->attr({Version=>1});
        my $response = $soap->call($method);
        
        poj