Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/07/2010, 11:47
helacer
 
Fecha de Ingreso: mayo-2006
Ubicación: Bogotá
Mensajes: 2.061
Antigüedad: 18 años
Puntos: 50
Ayuda traducir consumo webservices desde .net a php

COmo estan.

Tengo el codigo que consume un webservice desde .net péro necesito consumirlo desde php.

El codigo del webservice es este

Código:
	[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://vesta.com.br/el PSE/MainServices/getBankList", RequestNamespace="http://www.uc-council.org/smp/schemas/eanucc", ResponseNamespace="http://www.uc-council.org/smp/schemas/eanucc", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
		[return: System.Xml.Serialization.XmlElementAttribute("getBankListResponseInformation")]
		public getBankListResponseInformationType[] getBankList(getbankListInformationType getBankListInformation) 
		{
			object[] results = this.Invoke("getBankList", new object[] {
																		   getBankListInformation});
			return ((getBankListResponseInformationType[])(results[0]));
		}
...
Lo que tengo hasta el momento es esto "aclaro que soy novato en esto"
Código PHP:
<?php
error_reporting
(7);
// Realizo el llamado a la libreria.
include_once("lib/nusoap.php");
// Creo la función que cargara el listado de bancos.
function CarLisBank()
{
$wsdl="https://XXXXXXXXXXXXXXXXXXX.asmx";
//url del webservice que invocaremos
$client=new soapclient($wsdl,TRUE); //instanciando un nuevo objeto cliente para consumir el webservice  

//$param=array('estado'=>'1'); //pasando parametros de entrada que seran pasados hacia el metodo

$LisBancos $client->call('getBankList'$param); //llamando al metodo y recuperando el array de productos en una variable

//¿ocurrio error al llamar al web service? 
if ($client->fault) { // si
      
echo 'No se pudo completar la operación'
      die(); 
}else{ 
// no
    
$error $client->getError(); 
    if (
$error) { // Hubo algun error 
        
echo 'Error:' $error
    } 

if(
is_array($LisBancos)){ //si hay valores en el array
    
for($i=0;$i<count($LisBancos);$i++){
        echo 
$LisBancos[$i]['financialInstitutionCode'].'<br>';
    }
}else{
    echo 
'No hay bancos';
}

}
// Realizo el llamado a la función.
CarLisBank();
?>