$domDocument = Hydrate($order);
$client = new SoapClient('http://10.1.208.120/api/webservice.asmx?WSDL', array('trace' => 1));
$xml = simplexml_load_string($domDocument->saveHTML());
$result = $client->SendOrder($xml);
Upon debug, $xml ends up having all my values correctly assigned where they should be. Most notably, the DateTime values that I set in the Hydrate() method:
<ns1:OrderDate>2014-08-06T19:37:53+00:00</ns1:OrderDate>
When I SendOrder(), I get:
Server was unable to read request. --> There is an error in XML document (2, 515). --> String was not recognized as a valid DateTime.
And my DateTime values end up being blank:
<ns1:OrderDate/>
I'm beyond frustrated with this. Does anyone know what's going on?
Edit:
The problem was that I was not using namespaces when generating the DomDocument. I just prepended ns1: to all elements and used a SoapVar and __SoapCall.
$this->setSoapClient(new SoapClient( $this->getURL() .'?WSDL', array('trace' => 1)));
$this->setSoapRequest(Mage::getModel('apiorder/domdocbuilder')->Hydrate($this->getOrder())->saveHTML());
$this->setSoapBody(new SoapVar($this->getSoapRequest(), XSD_ANYXML));
try
{
$this->setSoapResult($this->getSoapClient()->__SoapCall('SendOrder', array($this->getSoapBody())));
}
catch(SoapFault $e)
{
$this->setSoapFault($e);
}
The problem was that I was not using namespaces when generating the DomDocument. I just prepended ns1: to all elements and used a SoapVar and __SoapCall.
$this->setSoapClient(new SoapClient( $this->getURL() .'?WSDL', array('trace' => 1)));
$this->setSoapRequest(Mage::getModel('apiorder/domdocbuilder')->Hydrate($this->getOrder())->saveHTML());
$this->setSoapBody(new SoapVar($this->getSoapRequest(), XSD_ANYXML));
try
{
$this->setSoapResult($this->getSoapClient()->__SoapCall('SendOrder', array($this->getSoapBody())));
}
catch(SoapFault $e)
{
$this->setSoapFault($e);
}