A ver si me se explicar. El error me da al intentar instanciar la clase
PersonList de SOAPWrapper. A partir de ese momento no da mas errores.
Cita: Este es el error:
Parse error: syntax error, unexpected T_CLASS, expecting T_FUNCTION in C:\AppServ\www\maqueta02\index2.php on line 31
No puedo pegar aqui el codigo completo porque no permite pegar las URLs del WSDL ni la definicion del ENCABEZADO
mi codigoqueda asi:
Código PHP:
<?php
abstract class SoapWrapper {
public function getAsSOAP() {
foreach($this as $key=>&$value) {
$this->prepareSOAPrecursive($this->$key);
}
return $this;
}
private function prepareSOAPrecursive(&$element) {
if(is_array($element)) {
foreach($element as $key=>&$val) {
$this->prepareSOAPrecursive($val);
}
$element=new SoapVar($element,SOAP_ENC_ARRAY);
}elseif(is_object($element)) {
if($element instanceof SoapWrapper) {
$element->getAsSOAP();
}
$element=new SoapVar($element,SOAP_ENC_OBJECT);
}
}
// ------------------------------------------
// Ejemplo de uso
// ------------------------------------------
class PersonList extends SoapWrapper {
protected $ArrayOfPerson;
}
class Person extends SoapWrapper {
}
$client=new SoapClient("---http:---//gisom.grupoiris.net/Gisom-hotels-ws/HotelOnlineService?wsdl", array( 'soap_version'=>SOAP_1_2, 'trace'=>1, 'classmap' => array('Person' => "Person", 'PersonList' => "PersonList") ));
//$PersonList=new PersonList;
//$PersonList->getAsSOAP();
//Continuas aqui con tus metodos u operaciones.
try
{
// Valores
$nameSpace = "---http---://jax-ws.dev.java.net/xml/ns/";
$SessionId = "06f16f43-c6f5-4af0-aa29-4af377c78295";
// Parametros para la llamada
$parametros = array("LanguageId" => "es_ES", "DestinationName" => "Madrid");
$soapHeader = new SoapHeader($nameSpace,"objectId",$SessionId,0);
// ESTO ES SOLO PARA VISUALIZAR EL OBJETO CABECERA
echo "<br><hr><br><pre>";
print_r($soapHeader);
echo "</pre><br><hr><br>";
//TODO: reemplazo tu linea por lo que creo intentas hacer.
//No sé porque le envias este parametro ni lo que contiene, los parametros deberian ser el array Parametros
$PersonList=new PersonList;
$client->getDestinationSearch($PersonList);
//TODO: un pequeño ejemplo de uso
//$client->echoStruct(new SoapParam($PersonList, "inputStruct"));
//TODO: de ser asi entonces pienso que solo deberias pasarlo en la seccion parametros no?
//$resultado = $client->__soapCall("getDestinationSearch", $parametros, NULL, $soapHeader, $output_headers);
}
catch(SoapFault $fault)
{
//echo '<b>Mensaje:</b> ' .$e->getMessage();
echo "<pre>*** ERROR ***<br><br>";
echo "Fault Code : ".$fault->faultcode."<br>";
echo "Fault String : ".$fault->faultstring."<br>";
echo "Fault Actor : ".$fault->faultactor."<br><br>";
echo "</pre><br><br>";
}
?>
He colocado las URLs con --- por tema de SPAM, Muchas gracias por tu ayuda.