Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2022-07-06 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?