#1 Problema con web service
Hola gente, estoy probando algunos ejempplos de web services con php ya que me estoy metiendo de a poco en el tema.

cliente.php
Código PHP:
<?php

// Incluimos la clase NuSoap
require_once('../nusoap/lib/nusoap.php');

// Direccion del servicio web
$url 'http://localhost/desarrollo/repositoriolocal/loginServer/ejemplo/server.php?wsdl';

// Creamos una instancia del objeto Soap en su modo Cliente
$soapclient = new soapclient($urlTRUE);
$soapclient->debugLevel(0);

// Funcion "hola" a llamar en el webservice
$function 'hola';

// Parametros pasados a la funci�n
$params = array('nombre' => 'Pepe');

// Llamamos a la funcion publicada en el servicio web y devolvemos el resultado en $result
$result $soapclient->call($function $params);

// Imprimimos el resultado
print_r($result);

?>
server.php
Código PHP:
<?php

// Incluir NuSoap
require_once('../nusoap/lib/nusoap.php');

// Crear una instancia del soap server
$server = new soap_server();

// Inicializar el soporte para WSDL
$server->configureWSDL('holawsdl''urn:holawsdl');

// Registrar el método
$server->register('hola',               // nombre método
    
array('nombre' => 'xsd:string'),    // parámetros de entrada
    
array('return' => 'xsd:string'),    // parámetros de salida
    
'urn:holawsdl',                     // namespace
    
'urn:holawsdl#hola',                // soapaction
    
'rpc',                              // estilo
    
'encoded',                          // uso
    
'Saludar a quien se desee'          // documentación
);

// Definir el método como una función PHP
/**
 * Saludar a una persona
 *
 * @param string $nombre
 * @return string
 */
function hola($nombre) {
        return 
'Hola, ' $nombre;
}

// Usar la petición (en caso de existir) para invocar al servicio
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA '';

$server->service($HTTP_RAW_POST_DATA);

?>
cuando ejecuto el cliente no me muestra nada.

si ejecuto el servidor solo me muestra:
Código PHP:
BODY{font:x-small 'Verdana';margin-right:1.5em} .c{cursor:hand} .b{color:red;font-family:'Courier New';font-weight:bold;text-decoration:none} .e{margin-left:1em;text-indent:-1em;margin-right:1em} .k{margin-left:1em;text-indent:-1em;margin-right:1em} .t{color:#990000} .xt{color:#990099} .ns{color:red} .dt{color:green} .m{color:blue} .tx{font-weight:bold} .db{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;border-left:1px solid #CCCCCC;font:small Courier} .di{font:small Courier} .d{color:blue} .pi{color:blue} .cb{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;font:small Courier;color:#888888} .ci{font:small Courier;color:#888888} PRE{margin:0px;display:inline}  <?xml version="1.0"  encoding="ISO-8859-1" ?>   - <definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:holawsdl"  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:holawsdl">   - <types>   - <xsd:schema targetNamespace="urn:holawsdl">     <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />     <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />    </xsd:schema>   </types>  - <message name="holaRequest">     <part name="nombre"  type="xsd:string" />    </message>  - <message name="holaResponse">     <part name="return"  type="xsd:string" />    </message>  - <portType name="holawsdlPortType">   - <operation name="hola">     <documentation>Saludar a quien se desee</documentation>      <input message="tns:holaRequest"  />     <output message="tns:holaResponse"  />    </operation>   </portType>  - <binding name="holawsdlBinding"  type="tns:holawsdlPortType">     <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />   - <operation name="hola">     <soap:operation soapAction="urn:holawsdl#hola" style="rpc" />    - <input>     <soap:body use="encoded"  namespace="urn:holawsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />    </input>  - <output>     <soap:body use="encoded"  namespace="urn:holawsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />    </output>   </operation>   </binding>  - <service name="holawsdl">   - <port name="holawsdlPort"  binding="tns:holawsdlBinding">     <soap:address location="http://localhost/desarrollo/repositoriolocal/loginServer/ejemplo/server.php" />    </port>   </service>   </definitions>
donde esta el problema?


saludos
+
 
0
Me gusta
 
http://www.psicofxp.com/forums/desarrollo-web.264/904344-problema-con-web-service.html
| Más