Dear all,

I'm trying to debug this method https://github.com/simoncozens/Net-KashFlow/blob/master/lib/Net/KashFlow.pm#L559

sub email { my ($self, $data) = @_; $data->{InvoiceNumber} = $self->{InvoiceNumber}; for (qw/FromEmail FromName SubjectLine Body RecipientEmail/) { die "You must supply the $_ parameter" unless $data->{$_}; } $self->{kf}->_c("EmailInvoice", $data); }

but can't work out why it is producing broken XML due to the InvoiceNumber closing round everything:

<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" +xmlns:s1="KashFlow/AbstractTypes" xmlns:soapenc="http://schemas.xmlso +ap.org/soap/encoding/" xmlns:tns="KashFlow" xmlns:xsd="http://www.w3. +org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-insta +nce" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <soap:Body> <EmailInvoice xmlns="KashFlow"> <UserName xsi:type="xsd:string">my_user</UserName> <Password xsi:type="xsd:string">my_pass</Password> <InvoiceNumber xsi:type="xsd:int"> <FromName xsi:type="xsd:string">Billing</FromName> <FromEmail xsi:type="xsd:string">billing@billing.co.uk</Fr +omEmail> <RecipientEmail xsi:type="xsd:string">ghenry@ghenry.co.uk< +/RecipientEmail> <Body xsi:type="xsd:string">Many thanks for your business! Please see attached invoice. -- Kind Regards, Billing. E billing@billing.co.uk http://www.billing.co.uk</Body> <InvoiceNumber xsi:type="xsd:int">239925</InvoiceNumber> <SubjectLine xsi:type="xsd:string">Invoice from billing fo +r February 2015</SubjectLine> </InvoiceNumber> </EmailInvoice> </soap:Body> </soap:Envelope>

code in https://github.com/simoncozens/Net-KashFlow/blob/master/lib/Net/KashFlowAPI.pm#L20 is:

EmailInvoice => { endpoint => 'https://securedwebapp.com/api/service.asmx', soapaction => 'KashFlow/EmailInvoice', namespace => 'KashFlow', parameters => [ SOAP::Data->new(name => 'UserName', type => 'xsd:string', attr = +> {}), SOAP::Data->new(name => 'Password', type => 'xsd:string', attr = +> {}), SOAP::Data->new(name => 'InvoiceNumber', type => 'xsd:int', attr + => {}), SOAP::Data->new(name => 'FromEmail', type => 'xsd:string', attr +=> {}), SOAP::Data->new(name => 'FromName', type => 'xsd:string', attr = +> {}), SOAP::Data->new(name => 'SubjectLine', type => 'xsd:string', att +r => {}), SOAP::Data->new(name => 'Body', type => 'xsd:string', attr => {} +), SOAP::Data->new(name => 'RecipientEmail', type => 'xsd:string', +attr => {}), ], # end parameters }, # end EmailInvoice

called using https://github.com/simoncozens/Net-KashFlow/blob/master/lib/Net/KashFlow.pm#L50:

sub _c { my ($self, $method, @args) = @_; my ($result, $status, $explanation) = KashFlowAPI->$method($self->{username}, $self->{password}, @ar +gs); if ($explanation) { croak($explanation) } return $result; }

The data being passed to $self->{kf}->_c("EmailInvoice", $data) via $invoice->email() is:

$VAR1 = { 'FromName' => 'Billing', 'FromEmail' => 'billing@billing.co.uk', 'RecipientEmail' => 'ghenry@ghenry.co.uk', 'Body' => 'Many thanks for your business! Please see attached invoice. -- Kind Regards, Billing. E billing@billing.co.uk http://www.billing.co.uk', 'InvoiceNumber' => '239925', 'SubjectLine' => 'Invoice from Billing for February 2015' };

Any ideas how to trace this double InvoiceNumber getting opened and closed around the actual passed in data?


In reply to Net::KashFlow and broken XML produced by SOAP::Lite by ghenry

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.