Reputation: 15
I have looked for a solid working answer on this can't find one.
I am also New at SOAP, but very familiar with PHP.
I send out my SOAP request with CURL and my response comes back like this:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetFeatureResponse xmlns="http://www.supportsite.com/webservices/">
<GetFeatureResult>**string**</GetFeatureResult>
</GetFeatureResponse>
</soap:Body>
</soap:Envelope>
I need to save the ->GetFeatureResult 'string' in a MySQL database without the XML. Everything I try returns blank. Here's what I'm using now:
$result = curl_exec($curl);
curl_close ($curl);
$resultXML = simplexml_load_string($result);
$item = $resultXML->GetFeatureResponse->GetFeatureResult;
Upvotes: 0
Views: 2521
Reputation: 2495
PHP has a built in soap client. It is a LOT easier. As long as you point it to a proper WSDL file, it will return a PHP object ready to use.
EDIT: Dug up an example I had around...
$sc = new SoapClient($wsdl, array(
'location' => "https://$host:$port/path/",
'login' => $user,
'password' => $pass
));
//$sc will now contain methods (maybe properties too) defined by the WSDL file
//Getting the info you need could be as easy as
$info = $sc->getInfo(array('parameter'=>'value'));
Upvotes: 1