Greetings,

I'm having issues properly passing input parameters to a web service method. The method is properly defined in the wsdl file, but I'm getting the infamous "c-gensym" element names instead of the proper element names as defined.

The fact that part of the error message is "The name of the element should be one of these[application,xmlReq]" tells me that the wsdl file is being processed properly (yes/no?), I just cannot pass the parameters to the method properly, ie: I need this:

<c-gensym3 xsi:type="xsd:string... <c-gensym5 xsi:type="xsd:string...
to look like this:
<application xsi:type="xsd:string... <xmlReq xsi:type="xsd:string...

More detail:

Running Data::Dumper on the $soap object shows that "sendxml" method is defined:

--much deleted -- # -- generated from file:cdxservices.wsdl my %methods = ( \'sendxml\' => { endpoint => \'http://172.20.14.52:14283/cdxservices/ws\', soapaction => \'\', namespace => \'http://www.bigcompany.com/\', parameters => [ SOAP::Data->new(name => \'application\', type => \'partns:string +\', attr => {}), SOAP::Data->new(name => \'xmlReq\', type => \'partns:string\', a +ttr => {}), ], # end parameters }, # end sendxml ); # end my %methods
My code:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use SOAP::Lite +trace => qw(debug); my $soap = SOAP::Lite-> new( proxy => [ 'http://172.20.14.52:14283/cdxservices/ws', credentials => [ '172.20.14.52:14283', 'default', 'cdxservicesusr', 'cdxservicesusr_qa' ] ], service => 'file:cdxservices.wsdl', readable => 1, ); my $result = $soap->sendxml( "CLAWS", "<?xml version=\"1.0\"?><transac +tion><apiname size=\"40\">LockAcct</apiname><comcorp>7801</comcorp><h +ouse>158301</house><opr size=\"5\">KPE</opr></transaction>" ); print "$result\n";
is generating the following request:
SOAP::Transport::HTTP::Client::send_receive: POST http://172.20.14.52: +14283/cdxservices/ws HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 758 Content-Type: text/xml; charset=utf-8 SOAPAction: "#sendxml" <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Body> <sendxml> <c-gensym3 xsi:type="xsd:string">CLAWS</c-gensym3> <c-gensym5 xsi:type="xsd:string">&lt;?xml version="1.0"?&gt;&lt; +transaction&gt;&lt;apiname size="40"&gt;LockAcct&lt;/apiname&gt;&lt;c +omcorp&gt;7801&lt;/comcorp&gt;&lt;house&gt;158301&lt;/house&gt;&lt;op +r size="5"&gt;KPE&lt;/opr&gt;&lt;/transaction&gt;</c-gensym5> </sendxml> </soap:Body> </soap:Envelope>

which, not surprisingly, generates the following fault:

SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Ser +ver Error Cache-Control: no-cache="set-cookie" Connection: close Date: Wed, 06 Aug 2014 19:21:40 GMT Content-Length: 3610 Content-Type: text/xml; charset=utf-8 Client-Date: Wed, 06 Aug 2014 19:21:40 GMT Client-Peer: 172.20.14.52:14283 Client-Response-Num: 1 Set-Cookie: JSESSIONID=pjHjTvQG9LvtKrPpqgRhJP16xykYhGXGf3DGxgsQv5tQL1y +M2GT1!1881305342; path=/ X-Powered-By: Servlet/2.4 JSP/2.0 <?xml version="1.0" encoding="utf-8" standalone="yes"?><env:Envelope x +mlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http: +//www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.x +mlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchem +a"><env:Header></env:Header><env:Body><env:Fault><faultcode>env:Serve +r</faultcode> <faultstring>Exception during processing: javax.xml.soap.SOAPException +: Found SOAPElement [<c-gensym3><transaction><apiname size="40">LockA +cct</apiname><comcorp>7801</comcorp><house>158301</house><opr size="5 +">KPE</opr></transaction></c-gensym3>].

But was not able to find a Part that is registered with this Message which corresponds to this SOAPElement. The name of the element should be one of these[application,xmlReq]

(see Fault Detail for stacktrace)</faultstring> </env:Fault></env:Body></env:Envelope>

A transaction that works ( captured via a web interface to the service ) shows a working request:

<!--REQUEST.................--> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <env:Header> </env:Header> <env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encodi +ng/"> <m:sendxml xmlns:m="http://www.bigcompany.com/"> <application xsi:type="xsd:string">CLAWS</application> <xmlReq xsi:type="xsd:string"><?xml version="1.0"?><transaction +><apiname size="40">LockAcct</apiname><comcorp>7801</comcorp><house>1 +58301</house><opr size="5">KPE</opr></transaction>lsx</xmlReq> </m:sendxml> </env:Body> </env:Envelope>

Any thoughts or pointers would be most appreciated. The client is running on a Windows Server 2008 R2 box with ActivePerl, so I am pretty much committed to using SOAP::Lite - I can't find SOAP::Simple in the PPM repositories...

As always, thanks very much for your help...
Scott


In reply to SOAP::Lite, WSDL and c-gensym by spstansbury

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.