I must clone a web service consuming it, then what I have is a service that consumes another service, using php and nusoap, this is the service that I should consume: link and this is my wsdl link this is my code to generate the wsdl
ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache_ttl',0);
include_once('includes.php');
class ServicioSeguridad
{
private $_soapServer = null;
public function __construct()
{
$this->_soapServer = new soap_server();
$this->_soapServer->configureWSDL("ServicioSeguridad" );
#elements/complexTypes{
#SolicitudObtenerToken{
$this->_soapServer->wsdl->addElement(
array('name' =>'SolicitudObtenerToken',
'nillable'=>'true',
'type' =>'SolicitudObtenerToken')
);
$this->_soapServer->wsdl->addComplexType(
'SolicitudObtenerToken',
'complexType',
'struct',
'sequence',
'',
array(
'RFC' => array('name' =>'RFC',
'type' =>'xsd:string',
'nillable' =>'true',
'minOccurs'=>'0'),
'TransaccionID'=> array('name' =>'TransaccionID',
'type' =>'xsd:long',
'minOccurs'=>'0')
)
);
#}
#RespuestaObtenerToken{
$this->_soapServer->wsdl->addElement(
array('name' =>'RespuestaObtenerToken',
'nillable'=>'true',
'type' =>'RespuestaObtenerToken')
);
$this->_soapServer->wsdl->addComplexType(
'RespuestaObtenerToken',
'complexType',
'struct',
'sequence',
'',
array(
'Token' => array('name' =>'Token',
'type' =>'xsd:string',
'nillable' =>'true',
'minOccurs'=>'0'),
'TransaccionID'=> array('name' =>'TransaccionID',
'type' =>'xsd:long',
'minOccurs'=>'0')
)
);
#}
#FallaServicio{
$this->_soapServer->wsdl->addElement(
array('name' =>'FallaServicio',
'nillable'=>'true',
'type' =>'FallaServicio')
);
$this->_soapServer->wsdl->addComplexType(
'FallaServicio',
'complexType',
'struct',
'sequence',
'',
array(
'RFC' =>array('name' =>'RFC',
'type' =>'xsd:string',
'nillable'=>'true'),
'Numero' =>array('name'=>'Numero',
'type'=>'xsd:int'),
'Descripcion'=>array('name' =>'Descripcion',
'type' =>'xsd:string',
'nillable' =>'true',
'minOccurs'=>'0'),
'Evento' =>array('name' =>'Evento',
'type' =>'xsd:string',
'nillable' =>'true',
'minOccurs'=>'0')
)
);
#}
#FallaSesion{
$this->_soapServer->wsdl->addElement(
array('name' =>'FallaSesion',
'nillable'=>'true',
'type' =>'FallaSesion')
);
$this->_soapServer->wsdl->addComplexType(
'FallaSesion',
'complexType',
'struct',
'all',
'',
array(
'RFC' =>array('name' =>'RFC',
'type' =>'xsd:string',
'nillable'=>'true'),
'Estatus' =>array('name' =>'Estatus',
'type' =>'xsd:int',
'minOccurs'=>'0'),
'Descripcion'=>array('name' =>'Descripcion',
'type' =>'xsd:string',
'nillable' =>'true',
'minOccurs'=>'0')
)
);
#}
#}
$this->_soapServer->register(
'Seguridad.ObtenerToken', // method name
array('SolicitudObtenerToken'=>'tns:SolicitudObtenerToken'), // input parameters
array('RespuestaObtenerToken' => 'tns:RespuestaObtenerToken'), // output parameters
false, // namespace
false, // soapaction
'rpc', // style
'encoded', // use
'Servicio que regresa un Token', // documentation
array('FallaSesion'=>'tns:FallaSesion')
);
//procesamos el webservice
$this->_soapServer->service(file_get_contents("php://input"));
}
}
$server = new ServicioSeguridad();
When I send the information correctly, it responds without problems, but the problem is when I return a fault to the service, since they are not added to the function, it obviously thunders because the objects are not there Original code:
<wsdl:portType name="Seguridad">
<wsdl:operation name="ObtenerToken">
<wsdl:input wsaw:Action="http://Ecodex.WS.Model/2011/CFDI/Seguridad/ObtenerToken" name="SolicitudObtenerToken" message="tns:SolicitudObtenerToken"/>
<wsdl:output wsaw:Action="http://Ecodex.WS.Model/2011/CFDI/Seguridad/ObtenerTokenResponse" name="RespuestaObtenerToken" message="tns:RespuestaObtenerToken"/>
<wsdl:fault wsaw:Action="http://Ecodex.WS.Model/2011/CFDI/Seguridad/ObtenerTokenFallaServicioFault" name="FallaServicioFault" message="tns:Seguridad_ObtenerToken_FallaServicioFault_FaultMessage"/>
<wsdl:fault wsaw:Action="http://Ecodex.WS.Model/2011/CFDI/Seguridad/ObtenerTokenFallaSesionFault" name="FallaSesionFault" message="tns:Seguridad_ObtenerToken_FallaSesionFault_FaultMessage"/>
</wsdl:operation>
</wsdl:portType>
In my code:
<portType name="ServicioSeguridadPortType">
<operation name="Seguridad.ObtenerToken">
<documentation>Servicio que retorna un Token</documentation>
<input message="tns:Seguridad.ObtenerTokenRequest"/>
<output message="tns:Seguridad.ObtenerTokenResponse"/>
</operation>
</portType>
what I need:
<portType name="ServicioSeguridadPortType">
<operation name="Seguridad.ObtenerToken">
<documentation>Servicio que retorna un Token</documentation>
<input message="tns:Seguridad.ObtenerTokenRequest"/>
<output message="tns:Seguridad.ObtenerTokenResponse"/>
<fault message="tns:Seguridad.FallaServicioFault"/>
<fault message="tns:Seguridad.FallaSesionFault"/>
</operation>
</portType>
is there a way to insert the fault?