Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Net::KashFlow and broken XML produced by SOAP::Lite

by ghenry (Vicar)
on Mar 10, 2015 at 16:55 UTC ( #1119550=perlquestion: print w/replies, xml ) Need Help??

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

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?

Replies are listed 'Best First'.
Re: Net::KashFlow and broken XML produced by SOAP::Lite
by Anonymous Monk on Mar 10, 2015 at 23:59 UTC

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

    You already traced it, you're done, methodname is method name

    Why do you think this is broken xml?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1119550]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2020-06-02 18:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (19 votes). Check out past polls.

    Notices?