+ Reply to Thread
Results 1 to 3 of 3

Thread: Sending Multidimensional Array using php

  1. #1
    pratheesh is offline Junior Member
    Join Date
    Dec 2008
    Posts
    14

    Default Sending Multidimensional Array using php

    For anybody facing troubles with sending complex array to KF webservice, this might help.
    After considerable hairpulling i managed to solve the riddle.
    This is for the function InsertInvoice. Note: you have to provide explicit type for <anytype> element.
    You are free to thank me anytime

    PHP Code:
    <?
    require_once('nusoap.php');
    //$client = new soapclient('https://secure.kashflow.co.uk/api/service.asmx?WSDL','wsdl');
     
    $soapaction "KashFlow/InsertInvoice";
    $wsdl "https://secure.kashflow.co.uk/api/service.asmx";
    $namespace "KashFlow";
        
    $client = new soapclient($wsdl);
    $mysoapmsg $client->serializeEnvelope('
      <InsertInvoice xmlns="KashFlow"><UserName>yourusername</UserName><Password>yourpassword</Password><Inv><InvoiceDate>2009-01-20T11:11:04+00:00</InvoiceDate><DueDate>2009-01-20T11:11:04+00:00</DueDate><CustomerID>525434</CustomerID><Lines><anyType xsi:type="InvoiceLine"><Quantity>150</Quantity><Description>Bindaas baby</Description><Rate>30</Rate><ChargeType>812270</ChargeType><VatRate>21</VatRate></anyType></Lines></Inv></InsertInvoice>
    '
    ,'',array(),'document''literal');

    $response $client->send($mysoapmsg$soapaction);

        if (
    $client->fault) {
              echo 
    '<h3>Fault</h3><pre>';
              
    print_r($response);
              echo 
    '</pre>';
            }

        echo 
    "<p>SOAP query</p>";
        echo 
    '<pre>' htmlspecialchars($client->requestENT_QUOTES) . '</pre>';
        echo 
    "<p>SOAP response</p>";
        echo 
    '<pre>' htmlspecialchars($client->responseENT_QUOTES) . '</pre>';
    ?>

  2. #2
    philsmy is offline Junior Member
    Join Date
    Jan 2009
    Posts
    4

    Default

    I'm having this same issue under Ruby! I have no idea how to force soap4r to include the types.

  3. #3
    pratheesh is offline Junior Member
    Join Date
    Dec 2008
    Posts
    14

    Default

    Never used ruby or soap4r. Couldnt find any function similar to serializeEnvelope().
    kashflow have new webservice insertinvoiceline. you may have to use it instead.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts