<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Swekee Team Developer &#187; Servicios Web</title>
	<atom:link href="http://developer.swekee.com/tag/servicios-web/feed/" rel="self" type="application/rss+xml" />
	<link>http://developer.swekee.com</link>
	<description>Blog de los desarrolladores de Swekee</description>
	<lastBuildDate>Fri, 05 Sep 2008 02:43:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Consumir un Servicio Web en PHP utilizando NuSoap</title>
		<link>http://developer.swekee.com/2008/09/03/consumir-un-servicio-web-en-php-utilizando-nusoap/</link>
		<comments>http://developer.swekee.com/2008/09/03/consumir-un-servicio-web-en-php-utilizando-nusoap/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 02:53:21 +0000</pubDate>
		<dc:creator>david.alvaro</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[NuSoap]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Servicios Web]]></category>

		<guid isPermaLink="false">http://developer.swekee.com/?p=90</guid>
		<description><![CDATA[Hola tigre ahora te explicare como Consumir un Servicio Web utilizando NuSoap 0.7.3. para ello debes tener creado un Servicio Web en cualquier lenguaje (PHP, .NET, JAVA, etc&#8230;.), para explicarte, y para que me entiendas mejor usaremos el Servicio Web creado en el post anterior; Empecemos :
1.- Para que funcione el ejemplo descárgate las clases [...]]]></description>
			<content:encoded><![CDATA[<p>Hola tigre ahora te explicare como Consumir un Servicio Web utilizando NuSoap 0.7.3. para ello debes tener creado un Servicio Web en cualquier lenguaje (PHP, .NET, JAVA, etc&#8230;.), para explicarte, y para que me entiendas mejor usaremos el Servicio Web creado en el post anterior; Empecemos :</p>
<p>1.- Para que funcione el ejemplo descárgate las clases de NuSOAP versión 0.7.3 puedes hacerlo desde la pagina <a href="http://sourceforge.net/projects/nusoap/" target="_blank">http://sourceforge.net/projects/nusoap/</a>.</p>
<p>2.- Después descomprimes ese archivo y lo copias a tu sitio web (para este ejemplo el sitio se llama miwebservice y los archivos de NuSOAP los puse en un directorio llamado lib-nusoap).</p>
<p>3.- Luego ejecutas en tu MySQL 5.0 el script de la Base de Datos db_productos.sql que lo puedes descargar desde esta pagina.</p>
<p>4.- Posteriormente crea una pagina PHP (en este ejemplo la pagina se llama clienteweb.php) y codificas lo siguiente:<br />
</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'lib-nusoap/nusoap.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$wsdl</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://localhost/miwebservice/servicioweb.php?wsdl&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//url del webservice que invocaremos</span>
<span style="color: #000088;">$client</span><span style="color: #339933;">=</span><span style="color: #000000; font-weight: bold;">new</span> nusoap_client<span style="color: #009900;">&#40;</span><span style="color: #000088;">$wsdl</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'wsdl'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//instanciando un nuevo objeto cliente para consumir el webservice  </span>
&nbsp;
<span style="color: #000088;">$param</span><span style="color: #339933;">=</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'estado'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//pasando parametros de entrada que seran pasados hacia el metodo</span>
&nbsp;
<span style="color: #000088;">$productos</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$client</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">call</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ListarProductos'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$param</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//llamando al metodo y recuperando el array de productos en una variable</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//¿ocurrio error al llamar al web service? </span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$client</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fault</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// si</span>
      <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'No se pudo completar la operación'</span><span style="color: #339933;">;</span> 
      <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// no</span>
	<span style="color: #000088;">$error</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$client</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getError</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$error</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// Hubo algun error </span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Error:'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$error</span><span style="color: #339933;">;</span> 
	<span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$productos</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//si hay valores en el array</span>
	<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span>count<span style="color: #009900;">&#40;</span><span style="color: #000088;">$productos</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$productos</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ProductoID'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'  '</span><span style="color: #339933;">.</span><span style="color: #000088;">$productos</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Nombre'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' su precio es : '</span><span style="color: #339933;">.</span><span style="color: #000088;">$productos</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Precio'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;br&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'No hay productos'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Y al ejecutar en el navegador te debe mostrar algo así:</p>
<p><img src="http://farm4.static.flickr.com/3158/2828767903_8a90b78898_o.png" width="199" height="85" alt="consumir_un_servicio_web_en_php5_utilizando_nusoap" /></p>
<p>Si deseas puedes descargar el ejemplo completo desde <a href="http://www.box.net/shared/mo32v2facl" target="_blank">aquí</a>.</p>
<p>Ahora si me voy a tomar mi leche, mucha suerte tigre!!</p>
]]></content:encoded>
			<wfw:commentRss>http://developer.swekee.com/2008/09/03/consumir-un-servicio-web-en-php-utilizando-nusoap/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Crear un Servicio Web en PHP utilizando NuSoap</title>
		<link>http://developer.swekee.com/2008/08/30/crear-un-servicio-web-en-php-utilizando-nusoap/</link>
		<comments>http://developer.swekee.com/2008/08/30/crear-un-servicio-web-en-php-utilizando-nusoap/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 20:22:12 +0000</pubDate>
		<dc:creator>david.alvaro</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[NuSoap]]></category>
		<category><![CDATA[Servicios Web]]></category>

		<guid isPermaLink="false">http://developer.swekee.com/?p=27</guid>
		<description><![CDATA[Hola recien llego de mi trabajo y me anime a escribir acerca de este tema tan interesante y de moda; Para crear Servicios Web en PHP 5 usaremos las clases de NuSOAP:
1.- Para que funcione el ejemplo descárgate las clases de NuSOAP versión 0.7.3 puedes hacerlo desde la pagina http://sourceforge.net/projects/nusoap/.
2.- Después descomprimes ese archivo y [...]]]></description>
			<content:encoded><![CDATA[<p>Hola recien llego de mi trabajo y me anime a escribir acerca de este tema tan interesante y de moda; Para crear Servicios Web en PHP 5 usaremos las clases de NuSOAP:</p>
<p>1.- Para que funcione el ejemplo descárgate las clases de NuSOAP versión 0.7.3 puedes hacerlo desde la pagina <a href="http://sourceforge.net/projects/nusoap/" target="_blank">http://sourceforge.net/projects/nusoap/</a>.</p>
<p>2.- Después descomprimes ese archivo y lo copias a tu sitio web (para este ejemplo el sitio se llama miwebservice y los archivos de NuSOAP los puse en un directorio llamado lib-nusoap.</p>
<p>3.- Luego ejecutas en tu MySQL 5.0 el script de la Base de Datos db_productos.sql que lo puedes descargar desde esta pagina.</p>
<p>4.- Luego crea una pagina PHP (en este ejemplo la pagina se llama servicioweb.php) y codificas lo siguiente:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'lib-nusoap/nusoap.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$server</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> soap_server<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$ns</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://192.168.1.5/aplicativo&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// espacio de nombres; Sitio donde estará alojado el web service</span>
<span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">configurewsdl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'MiWebService'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//nombre del web service</span>
<span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">wsdl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">schematargetnamespace</span><span style="color: #339933;">=</span><span style="color: #000088;">$ns</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/************ REGISTRANDO EL ARRAY A DEVOLVER(array de productos) **************/</span>
<span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">wsdl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addComplexType</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'ArregloProductos'</span><span style="color: #339933;">,</span> 			<span style="color: #666666; font-style: italic;">// Nombre</span>
	<span style="color: #0000ff;">'complexType'</span><span style="color: #339933;">,</span> 					<span style="color: #666666; font-style: italic;">// Tipo de Clase</span>
	<span style="color: #0000ff;">'array'</span><span style="color: #339933;">,</span> 						<span style="color: #666666; font-style: italic;">// Tipo de PHP</span>
	<span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> 							<span style="color: #666666; font-style: italic;">// definición del tipo secuencia(all|sequence|choice)</span>
	<span style="color: #0000ff;">'SOAP-ENC:Array'</span><span style="color: #339933;">,</span> 				<span style="color: #666666; font-style: italic;">// Restricted Base</span>
	<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ref'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'SOAP-ENC:arrayType'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wsdl:arrayType'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'tns:Productos[]'</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">// Atributos</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
	<span style="color: #0000ff;">'tns:Productos'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/************ REGISTRANDO LA ESTRUCTURA DE DATOS PRODUCTOS **************/</span>
<span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">wsdl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addComplexType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Productos'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'complexType'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'struct'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'all'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'ProductoID'</span><span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'ProductoID'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'xsd:int'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'Nombre'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Nombre'</span><span style="color: #339933;">,</span>    <span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'xsd:string'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'Precio'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Precio'</span><span style="color: #339933;">,</span>    <span style="color: #0000ff;">'type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'xsd:string'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*METODO DEL WEB SERVICE*/</span>
<span style="color: #000000; font-weight: bold;">function</span> ListarProductos<span style="color: #009900;">&#40;</span><span style="color: #000088;">$estado</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$estado</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> mysqli<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//mysqli exclusivo para usar procedimientos almacenados</span>
		<span style="color: #000088;">$db_result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;root&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;db_productos&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$sql</span><span style="color: #339933;">=</span><span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;call usp_ListarProductos('<span style="color: #009933; font-weight: bold;">%s</span>');&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$estado</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//intentando filtrar el SQL Injection</span>
		<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">mysqli_errno</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;mySQL error <span style="color: #009933; font-weight: bold;">%s</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">error</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//si es que hubo error se muestra</span>
		<span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_rows</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$row</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysqli_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$toc</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ProductoID'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;producto_id&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$toc</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Nombre'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;nombre&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$toc</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Precio'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;precio&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$i</span><span style="color: #339933;">++;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #000088;">$result</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">free</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//liberando memoria</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$toc</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/************ REGISTRANDO EL METODO **************/</span>
<span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">register</span><span style="color: #009900;">&#40;</span>
	<span style="color: #0000ff;">'ListarProductos'</span><span style="color: #339933;">,</span>   						<span style="color: #666666; font-style: italic;">// Nombre del Método</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'estado'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'xsd:string'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>           <span style="color: #666666; font-style: italic;">// Parámetros de Entrada</span>
    <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'return'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'tns:ArregloProductos'</span><span style="color: #009900;">&#41;</span>   <span style="color: #666666; font-style: italic;">//Datos de Salida</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">/******PROCESA LA SOLICITUD Y DEVUELVE LA RESPUESTA*******/</span>
<span style="color: #000088;">$input</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$HTTP_RAW_POST_DATA</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$HTTP_RAW_POST_DATA</span> <span style="color: #339933;">:</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">file</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'php://input'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">service</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$input</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>
Y al ejecutar en el navegador te debe mostrar algo así:<br />
<br />
<img src="http://farm4.static.flickr.com/3190/2828767849_6b8d438334_m.jpg" width="240" height="119" alt="crear_un_servicio_web_en_php5_utilizando_nusoap" /><br />
<br />
Si deseas puedes descargar el ejemplo completo desde <a href="http://www.box.net/shared/7l6tx4nkr9" target="_blank">aquí</a>.</p>
<p>También te recomiendo que leas Consumir un Servicio Web en PHP utilizando NuSoap<br />
<br />
Suerte Tigre !!</p>
]]></content:encoded>
			<wfw:commentRss>http://developer.swekee.com/2008/08/30/crear-un-servicio-web-en-php-utilizando-nusoap/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
