Foros del Web » Programando para Internet » PHP »

PHP y SOAP

Estas en el tema de PHP y SOAP en el foro de PHP en Foros del Web. Hola. Tengo dos scripts de prueba, uno para el servidor y otro para el cliente. En el servidor hay: Código: <? /* Incluimos las clases ...
  #1 (permalink)  
Antiguo 20/10/2014, 10:52
 
Fecha de Ingreso: agosto-2002
Mensajes: 66
Antigüedad: 21 años, 8 meses
Puntos: 0
PHP y SOAP

Hola.

Tengo dos scripts de prueba, uno para el servidor y otro para el cliente.

En el servidor hay:

Código:
<?


/* Incluimos las clases de SOAP */
require("../lib/nusoap.php");

/* Creamos el objeto del servidor */
$servidor=new soap_server();

/* Generación del WSDL */

$servidor->debug_flag=true;



$servidor->configureWSDL("QSubasta", "http://localhost/Subasta_prueba.php");
$servidor->wsdl->schemaTargetNamespace = "http://localhost/Subasta_prueba.php";

$servidor->wsdl->addComplexType(
		'salvamentos',
		'complexType',
		'struct',
		'all',
		'',
		array(
				'idremate' => 'xsd:string',
				'TipoRemate' => 'xsd:string',
				'inicioremate' => 'xsd:string',
				'finremate' => 'xsd:string',
				'salvamentos'=>'tns:salvamentos[]'
		)
);




$servidor->wsdl->addComplexType(
		'salvamento',
		'complexType',
		'struct',
		'all',
		'',
		array(
				'return' => 'xsd:array'
			));

$servidor->wsdl->addComplexType(
  'salvamentos',
  'complexType',
  'array',
  '',
  'SOAP-ENC:Array',
  array(),
  array(
    array(
      'ref' => 'SOAP-ENC:arrayType',
      'wsdl:arrayType' => 'tns:salvamento[]'
    ),
  ),
  'tns:salvamento'
);


// Registramos la función que queremos exponer como servicio webc con el nombre del método
$servidor->register("function1", array("IdRemate"=>"xsd:string", "TipoRemate"=>"xsd:string", "inicioremate"=>"xsd:string", "finremate"=>"xsd:string", "salvamentos"=>array(
		"idsalvamento"=>"xsd:string",
		"siniestro"=>"xsd:string",
		"ejercicio"=>"xsd:string",
		"marca"=>"xsd:string",
		"tipo"=>"xsd:string",
		"descripcion1"=>"xsd:string",
		"modelo"=>"xsd:string",
		"color"=>"xsd:string",
		"nummotor"=>"xsd:string",
		"numserie"=>"xsd:string",
		"chatarra"=>"xsd:string",
		"ubicacion"=>"xsd:string",
		"torre"=>"xsd:string",
		"liberacion"=>"xsd:string",
		"llaves"=>"xsd:string",
		"baja_placas"=>"xsd:string",
		"status"=>"xsd:string",
		"tipo_unidad"=>"xsd:string",
		"garantia"=>"xsd:string",
		"cobertura"=>"xsd:string",
		"monto_salvamento"=>"xsd:string",
		"monto_base"=>"xsd:string",
		"monto_guia_alta"=>"xsd:string",
		"monto_guia_baja"=>"xsd:string",
		"iva"=>"xsd:string",
		"corralon"=>"xsd:string",
		"tenencias"=>"xsd:string",
		"starts"=>"xsd:string",
		"ends"=>"xsd:string",
		"oficina"=>"xsd:string",
		"repuve"=>"xsd:string",
		"fotos"=>"xsd:string"
)), array("resultado"=>"xsd:string"));

function function1($IdRemate=0, $TipoRemate=0, $inicioremate=0, $finremate=0, $salvamentos=array()) {

  

  return array("idremate"=>$IdRemate, "TipoRemate"=>$TipoRemate, "inicioremate"=>$inicioremate, "finremate"=>$finremate, "salvamentos"=>$salvamentos);
}


// Enviar el resultado como una respuesta SOAP por HTTP
$servidor->service($HTTP_RAW_POST_DATA);
exit();

?>

En el cliente tengo:

Código:
<?

/* Incluimos las clases de SOAP */
require("../lib/nusoap.php");

//This is your webservice server WSDL URL address
$wsdl = "http://localhost/Subasta_prueba.php?wsdl&debug=1";

//create client object
$client = new soapclient($wsdl);



//calling our first simple entry point
$result1=$client->call('function1', array('IdRemate'=>'23654','TipoRemate'=>'1','inicioremate'=>'2014/10/20','finremate'=>'2014/10/23','salvamentos'=>array(
		'idsalvamento'=>'123545',
		'siniestro'=>'Choque',
		'ejercicio'=>'Octubre',
		'marca'=>'Toyota',
		'tipo'=>'Sedan',
		'descripcion1'=>'Esta es una descripción del coche',
		'modelo'=>'2013',
		'color'=>'Rojo',
		'nummotor'=>'1235sdf',
		'numserie'=>'45s412546',
		'chatarra'=>'si',
		'ubicacion'=>'Qualitas oficinas centrales',
		'torre'=>'3',
		'liberacion'=>'2014',
		'llaves'=>'si tiene llaves',
		'baja_placas'=>'ash123',
		'status'=>'corriente',
		'tipo_unidad'=>'Es un sedan',
		'garantia' => 'expirada',
		'cobertura'=>'2015',
		'monto_salvamento'=>'200000',
		'monto_base'=>'25000',
		'monto_guia_alta'=>'50000',
		'monto_guia_baja'=>'25000',
		'iva'=>'10000',
		'corralon'=>'doctores',
		'tenencias'=>'pagadas',
		'starts'=>'hoy',
		'ends'=>'pasado mañana',
		'oficina'=>'six flags',
		'repuve'=>'Cualquier repuve',
		'fotos'=>'una foto'
)));

$err = $client->getError();
if ($err) {
	// Display the error
	echo '<h2>Constructor error</h2>' . $err;
	// At this point, you know the call that follows will fail
	exit();
}

print_r($result1);


?>
Pero al llamar al cliente me dice este error:

no transport found, or selected transport is not yet supported!

Por favor ayuda!!

Etiquetas: soap
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:25.