Jump to content

Search the Community

Showing results for tags 'XML SOAP PHP Web Service'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH


  • Community Calendar




Website URL








Found 1 result

  1. I'm trying to get a string representative of an XML sheet send to a web service. This is how sales orders will be submitted online. The web service stores the order in a database. The web service is meant to take in a string to be read as XML. PHP and SOAP can't send XML to a web service as is and I'm having trouble working around this.First here is the code that generates the string.$xmlDocument = '<?xml version="1.0" encoding="utf-16"?>'; $xmlDocument.= '<SalesOrder dateCreated="'.$year.'-'.$mon.'-'.$day.' '.$hour.':'.$minutes.':'.$seconds.'" amount="'.$amount.'" mark_up="15.0000" customerID="'.$customer_id.'" employeeID="80000003-1325611163" source="0">'; while($row=mysql_fetch_array($result)) { //Product Id is called ProductID in the XML $product_id = $row['product_id']; //Sales info is NOT needed for the order. $sales_info = $row['sales_info']; echo $sales_info.'<br>'; //Final price is called SalesPrice in the XML $final_price = $row['final_price']; echo $final_price.'<br>'; //qty is called Quantity in the XML $qty = $row['qty']; echo $qty.'<br>'; //Purchase cost is called PurchaseCost in the XML $purchase_cost = $row['purchase_cost']; echo $purchase_cost.'<br>'; $xmlDocument .="<SalesOrderLine>"; $xmlDocument.='<ProductID>'.$product_id.'</ProductID>'; $xmlDocument.='<Quantity>'.$qty.'</Quantity>'; $xmlDocument.='<SalesPrice>'.$final_price.'</SalesPrice>'; $xmlDocument.='<PurchaseCost>'.$purchase_cost.'</PurchaseCost>'; $xmlDocument.='</SalesOrderLine>'; //$amount = $amount + $final_price; //$i++; } $xmlDocument .="</SalesOrder>"; I conclude by transmitting the string, but something is wrong. ini_set("soap.wsdl_cache_enabled", "0");$client = new SoapClient("", array( 'trace' => 1, 'exceptions' => 1, 'soap_version' => SOAP_1_1, 'encoding' => 'ISO-8859-1', 'features' => SOAP_SINGLE_ELEMENT_ARRAYS ));$xmlvar = new SoapVar( "<ns1:xmlDocument>".$xmlDocument."</ns1:xmlDocument>", XSD_ANYXML );$params->xmlDocument = (object)$xmlvar;$save_result = $client->AddSalesOrder($params);I'm quote new to working with SOAP, but I'm really stuck with this. How do I fix this? The only alternative is using brute force and doing the insertion myself. I would love nothing more but to do that, but I have to use the webservice, because it will not only write to the MySQL database, it will write to Quickbooks.