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

Any XML::Compile monks out there?

I've been using XML::Compile for many months to test web services. Today I added yet another web service to test that is fairly similar to the dozen others I've tested. For some reason my script is not functioning with this new web service.

The structure from explain() is two hashes "Header" and "Body". My %params hash contains the programmatically constructed hash that reflects these two hashes and their contents. However, when I display the trace request the contents of my hash are not mapped into the request resulting in the following XML:

<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/env +elope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body/> </SOAP-ENV:Envelope>

I get a few "warning: unused values" during the actual WSDL11 call to the web service operation

"use Log::Report mode => 'DEBUG';" wasn't terribly helpful either

Thanks for your suggestions as always

Replies are listed 'Best First'.
Re: XML::Compile not mapping my params hash
by kcott (Archbishop) on Feb 05, 2014 at 08:21 UTC

    G'day jdudleyh,

    Firstly, a disclaimer: I'm not a user of XML::Compile.

    Some issues:

    • "The structure from explain() is ..." — the token "explain" does not appear anywhere in the XML::Compile documentation: some information about this may be useful.
    • "My %params hash contains the programmatically constructed hash that ..." — the code that does this may be useful.
    • "I get a few "warning: unused values" ..." — the actual messages may be useful.
    • The guidelines in "How do I post a question effectively?" should help in identifying issues with your post and how to improve it.

    Assuming <SOAP-ENV:Header/> and <SOAP-ENV:Body/> should contain some values and the warnings are indicating unused values, could the problem lie with your %params hash? If so, my guess would be problems with either the structure of the hash or the keys (maybe capitalisation or embedded whitespace). Use Data::Dumper to look at the hash; set $Data::Dumper::Useqq to find spurious characters.

    If that doesn't help, addressing the issues raised may result in better answers.

    -- Ken

      "explain" is called on the WSDL object, so the doc is in XML::Compile::WSDL11

      You can find more info in the $trace object.

      I have read the guidelines on how to post effective questions a priori.

      The warning I quoted is the actual message minus the data element names in the Header hash that were appended to the end. I suppose I could have appended "element1, element2, ...".

      I'd love to share the code so others can reproduce my problem but it's divided into multiple modules, with WSDLs, data pulled in from Excel worksheets, etc. The WSDLs are not something my employer would want on public forums.

      Yes I could simplify the WSDL to hide the data structure, create inline sample data, simplify the code, and post it here in hopes of an answer. My approach however is to avoid that nontrivial effort and simply ask if someone might be familiar with this behavior or have more debugging insights.

      Thanks for your suggestions. The keys of the hash are exact with no spurious characters.

      Use Data::Dumper to look at the hash; set $Data::Dumper::Useqq to find spurious characters.

      :D

      sub dd { use Data::Dumper; print Data::Dumper->new([@_])->Sortkeys(1) ->Indent(1)->Useqq(1)->Dump . "\n"; }
Re: XML::Compile not mapping my params hash
by markov (Scribe) on Feb 05, 2014 at 10:51 UTC

    These "unused" messages *always* mean that the data-structure you are passing in is incorrect.

    You can also find help for XML::Compile on its IRC channel irc.perl.org#xml-compile and mailing-list

      Thanks Markov. And thanks for your modules!

      I'm intrigued by this article -- namely the second numbered point under the "Parameter unpacking" section.

      I'm wondering if I'm just a victim of unfortunate naming by the WSDL creators.

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel +ope/" xmlns:v1="yadayadayada" xmlns:v11=and other namespace stuff...> <soapenv:Header> <v1:CommonHeader> ...list of simple elements omitted... </v1:CommonHeader> </soapenv:Header> <soapenv:Body> <v11:Registration> ... more simple elements omitted... </v11:Registration> </soapenv:Body> </soapenv:Envelope>
Re: XML::Compile not mapping my params hash (reproducible)
by Anonymous Monk on Feb 05, 2014 at 07:40 UTC

    Well, how can I reproduce that?