PHP - nusoap arreglo como parametros

 
Vista:

nusoap arreglo como parametros

Publicado por zamba (1 intervención) el 28/09/2018 13:24:24
Buenas,,,necesito hacer un webservice en php en donde con nuSoap reciba unos datos entre los cuales uno de ellos debe ser un arreglo con varias entradas.
Lo detallo asi :

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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
$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
);


Mi problema reside en que al querer testearlo con SoapUi obviamente no "entiende" el tipo

1
<ChequeArray xsi:type="urn:ChequeArrays" soapenc:arrayType="urn:Cheques[]"/>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<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>

Existe alguna forma de poder armarlo para que se puedan pasar los valores ?
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

nusoap arreglo como parametros

Publicado por Javier (1 intervención) el 04/03/2021 05:56:09
Hola que tal, estoy en la misma que tu, veo que ya tiene algo de tiempo tu publicación, de casualidad habrás encontrado la solución o te decidiste a usar alguna otra herramienta.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar