Forum Discussion

zamba1's avatar
zamba1
Occasional Visitor
6 years ago

ARRAYS DECLARATION PHP

hi, im trying to pass an array as input and test in SoapUi , the problem is that i dont know how to...i make this , please any help !! (i need to input several values to the array request to test)

 

php code

 

$server->wsdl->addComplexType(
// name
'Cheques',
// typeClass (complexType|simpleType|attribute)
'complexType',
// phpType: currently supported are array and struct (php assoc array)
'struct',
// compositor (all|sequence|choice)
'all',
// restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
'',
// elements = array ( name = array(name=>'',type=>'') )
array(
'codbanc ' => array(
'name' => 'codbanc',
'type' => 'xsd:string'
),
'codsuc' => array(
'name' => 'codsuc',
'type' => 'xsd:string'
),
'fecha' => array(
'name' => 'fecha ',
'type' => 'xsd:string'
),
'nroche' => array(
'name' => 'nroche ',
'type' => 'xsd:string'
),
'importe' => array(
'impche' => 'impche ',
'type' => 'xsd:string'
)
)
);

$server->wsdl->addComplexType(
// name
'ChequeArrays',
// typeClass (complexType|simpleType|attribute)
'complexType',
// phpType: currently supported are array and struct (php assoc array)
'array',
// compositor (all|sequence|choice)
'',
// restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
'SOAP-ENC:Array',
// elements = array ( name = array(name=>'',type=>'') )
array(),
// attrs
array(
array(
'ref' => 'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:Cheques[]'
)
),
// arrayType: namespace:name (http://www.w3.org/2001/XMLSchema:string)
'tns:Cheques'
);


$server->wsdl->addComplexType(
// name
'RequestPago',
// typeClass (complexType|simpleType|attribute)
'complexType',
// phpType: currently supported are array and struct (php assoc array)
'struct',
// compositor (all|sequence|choice)
'all',
// restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
'',
// elements = array ( name = array(name=>'',type=>'') )
array
(
'entidad' => array( 'type' => 'xsd:string'),
'token' => array( 'type' => 'xsd:string'),
'transaccion' => array( 'type' => 'xsd:string'),
'nis' => array( 'type' => 'xsd:string'),
'metpago' => array( 'type' => 'xsd:string'),
'fecha' => array( 'type' => 'xsd:string'),
'hora' => array( 'type' => 'xsd:string'),
'imppago' => array( 'type' => 'xsd:string'),
'ChequeArray' => array( 'type' => 'tns:ChequeArrays' )
)
);

$server->wsdl->addComplexType(
// name
'ResponsePago',
// typeClass (complexType|simpleType|attribute)
'complexType',
// phpType: currently supported are array and struct (php assoc array)
'struct',
// compositor (all|sequence|choice)
'all',
// restrictionBase namespace:name (http://schemas.xmlsoap.org/soap/encoding/:Array)
'',
// elements = array ( name = array(name=>'',type=>'') )
array
(
'retorno' => array( 'type' => 'xsd:string'),
'nis' => array( 'type' => 'xsd:string'),
'fecha' => array( 'type' => 'xsd:string'),
'hora' => array( 'type' => 'xsd:string'),
'codconf' => array( 'type' => 'xsd:string'),
'pagoArray' => array( 'type' => 'tns:DeudaArrays' ),
'credit' => array( 'type' => 'xsd:string'),
'baja' => array( 'type' => 'xsd:string')
)
);


$server->register(
// string $name the name of the PHP function, class.method or class..method
'RegistrarPago',
// array $in assoc array of input values: key = param name, value = param type
array(
'RequestPago' => 'tns:RequestPago'
),
// array $out assoc array of output values: key = param name, value = param type
array(
'ResponsePago' => 'tns:ResponsePago'
),
// mixed $namespace the element namespace for the method or false
// 'urn:' . $myNamespace,
"urn:ws_edelar_cobros",
// mixed $soapaction the soapaction for the method or false
// 'urn:' . $myNamespace . "#getStuffs",
"urn:ws_edelar_cobros" . "#RegistrarPago",
// mixed $style optional (rpc|document) or false Note: when 'document' is specified, parameter and return wrappers are created for you automatically
'rpc',
// mixed $use optional (encoded|literal) or false
'encoded',
// string $documentation optional Description to include in WSDL
'Registra el pago de un cliente' // documentation
);

 

 

soap UI request

 

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ws_edelar_cobros" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<urn:RegistrarPago soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<RequestPago xsi:type="urn:RequestPago">
<!--You may enter the following 9 items in any order-->
<entidad xsi:type="xsd:string">?</entidad>
<token xsi:type="xsd:string">?</token>
<transaccion xsi:type="xsd:string">?</transaccion>
<nis xsi:type="xsd:string">?</nis>
<metpago xsi:type="xsd:string">?</metpago>
<fecha xsi:type="xsd:string">?</fecha>
<hora xsi:type="xsd:string">?</hora>
<imppago xsi:type="xsd:string">?</imppago>
<ChequeArray xsi:type="urn:ChequeArrays" soapenc:arrayType="urn:Cheques[]"/>
</RequestPago>
</urn:RegistrarPago>
</soapenv:Body>
</soapenv:Envelope>

1 Reply

  • Lucian's avatar
    Lucian
    Community Hero

    Hey zamba1,

     

    You posted quite some code but you didn't explain what you want to do with it. Where do you need to pass that array? What does it have to do with PHP? What is your test scenario here?