Bonjour,

Je rencontre un problème avec mon client NuSOAP (php 4.4) pour envoyer des paramètres "ComplexType" (tableaux associatifs) à mon Web Services sous Apache-Axis

Voici ma WSDL :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
<definitions targetNamespace="http://mycompany.fr/mysystem/xmlio/">
	<!--
WSDL created by Apache Axis version: 1.3
Built on Oct 05, 2005 (05:23:37 EDT)
-->
	<wsdl:types>
	<schema elementFormDefault="qualified" targetNamespace="http://mycompany.fr/mysystem/xmlio/">
	<complexType name="XmlIoHeaderType">
	<sequence>
<element maxOccurs="1" minOccurs="0" name="SecurityId" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="SecurityToken" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="ProcessId" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="ParentId" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
	<complexType name="XmlIoRequest">
	<sequence>
<element name="XmlIoHeader" nillable="true" type="impl:XmlIoHeaderType"/>
<element name="ClassName" nillable="true" type="xsd:string"/>
<element name="OperationName" nillable="true" type="xsd:string"/>
<element name="XmlIoCurrentUrl" nillable="true" type="xsd:string"/>
<element name="XmlIoFinalUrl" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="XmlIn" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="XsdIn" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<element name="XmlIoRequest" type="impl:XmlIoRequest"/>
	<complexType name="XmlIoErrorType">
	<sequence>
<element name="ClassName" nillable="true" type="xsd:string"/>
<element name="Message" nillable="true" type="xsd:string"/>
<element maxOccurs="unbounded" minOccurs="0" name="StackElement" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
	<complexType name="XmlIoResponse">
	<sequence>
<element name="XmlIoHeader" nillable="true" type="impl:XmlIoHeaderType"/>
<element maxOccurs="1" minOccurs="0" name="XmlOut" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="XsdOut" nillable="true" type="xsd:string"/>
<element maxOccurs="1" minOccurs="0" name="XmlIoError" nillable="true" type="impl:XmlIoErrorType"/>
</sequence>
</complexType>
<element name="XmlIoResponse" type="impl:XmlIoResponse"/>
</schema>
</wsdl:types>
	<message name="xmlIoOperationRequest">
<part element="impl:XmlIoRequest" name="XmlIoRequest"/>
</message>
	<message name="xmlIoOperationResponse">
<part element="impl:XmlIoResponse" name="XmlIoResponse"/>
</message>
	<portType name="XmlIoPortType">
	<operation name="xmlIoOperation" parameterOrder="XmlIoRequest">
<input message="impl:xmlIoOperationRequest" name="xmlIoOperationRequest"/>
<output message="impl:xmlIoOperationResponse" name="xmlIoOperationResponse"/>
</operation>
</portType>
	<binding name="XmlIoPortTypeSoapBinding" type="impl:XmlIoPortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
	<operation name="xmlIoOperation">
<wsdlsoap:operation soapAction=""/>
	<input name="xmlIoOperationRequest">
<wsdlsoap:body use="literal"/>
</input>
	<output name="xmlIoOperationResponse">
<wsdlsoap:body use="literal"/>
</output>
</operation>
</binding>
	<service name="XmlIoService">
	<port binding="impl:XmlIoPortTypeSoapBinding" name="XmlIoPortType">
<wsdlsoap:address location="http://myserver.mycompany.fr:7777/mysystemws/services/XmlIoPortType"/>
</port>
</service>
</definitions>
Voici mon client PHP NuSOAP correspondant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
		$proxyhost = '';
		$proxyport = '';
		$proxyusername = '';
		$proxypassword = '';
		$client = new soapclient('http://myserver.mycompany.fr:7777/mysystemws/services/XmlIoPortType', true,
								$proxyhost, $proxyport, $proxyusername, $proxypassword);
		$err = $client->getError();
		if ($err) {
			echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
		}
 
 
		$xmlioheader = array(	'SecurityId' => 'mylogin',
								'SecurityToken' => '00',
								'ProcessId' => '',
								'ParentId' => '');
 
		$param = array(	'XmlIoHeader' => $xmlioheader,
						'ClassName' => 'fr.mycompany.mysystem.outilsws.securite.SecWs',
						'OperationName' => 'allocateSgc',
						'XmlIoCurrentUrl' => '',
						'XmlIoFinalUrl' => '',
						'XmlIn' => '',
						'XsdIn' => ''
					  );
 
		//$namespace = 'XmlIoPortType';
 
		$result = $client->call('xmlIoOperation', $param);
 
 
		// Check for a fault
		if ($client->fault) {
			echo '<h2>Fault</h2><pre>';
			print_r($result);
			echo '</pre>';
		} else {
			// Check for errors
			$err = $client->getError();
			if ($err) {
				// Display the error
				echo '<h2>Error</h2><pre>' . $err . '</pre>';
			} else {
				// Display the result
				echo '<h2>Result</h2><pre>';
				print_r($result);
				echo '</pre>';
			}
		}
		echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
		echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
		echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';

Et voici l'erreur que je récupère... :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Constructor error
 
wsdl error: XML error parsing WSDL from http://myserver.mycompany.fr:7777/mysystemws/services/XmlIoPortType on line 2: junk after document element
 
Fault
 
Array
(
    [faultcode] => soapenv:Server.userException
    [faultstring] => org.xml.sax.SAXException: Invalid element in fr.mycompany.mysystem.outilssvc.xmlio_soap.XmlIoRequest - XmlIoHeader
    [detail] => Array
        (
            [hostname] => myserver.mycompany.fr
        )
 
)
 
Request
 
POST /mysystemws/services/XmlIoPortType HTTP/1.0
Host: myserver.mycompany.fr:7777
User-Agent: NuSOAP/0.7.2 (1.94)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Content-Length: 1033
 
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns8471:xmlIoOperation xmlns:ns8471="http://tempuri.org"><XmlIoHeader><SecurityId xsi:type="xsd:string">mylogin</SecurityId><SecurityToken xsi:type="xsd:string">00</SecurityToken><ProcessId xsi:type="xsd:string"></ProcessId><ParentId xsi:type="xsd:string"></ParentId></XmlIoHeader><ClassName xsi:type="xsd:string">fr.mycompany.mysystem.outilsws.securite.SecWs</ClassName><OperationName xsi:type="xsd:string">allocateSgc</OperationName><XmlIoCurrentUrl xsi:type="xsd:string"></XmlIoCurrentUrl><XmlIoFinalUrl xsi:type="xsd:string"></XmlIoFinalUrl><XmlIn xsi:type="xsd:string"></XmlIn><XsdIn xsi:type="xsd:string"></XsdIn></ns8471:xmlIoOperation></SOAP-ENV:Body></SOAP-ENV:Envelope>
 
Response
 
HTTP/1.1 500 Internal Server Error
Date: Fri, 23 Nov 2007 18:24:33 GMT
Server: Oracle-Application-Server-10g/10.1.2.0.2 Oracle-HTTP-Server
Cache-Control: private
Connection: close
Content-Type: text/xml; charset=iso-8859-1
 
<?xml version="1.0" encoding="ISO-8859-1"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.userException</faultcode><faultstring>org.xml.sax.SAXException: Invalid element in fr.mycompany.mysystem.outilssvc.xmlio_soap.XmlIoRequest - XmlIoHeader</faultstring><detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">myserver.mycompany.fr</ns1:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>
Je ne sais pas trop d'où vient le problème de mon client, mais je suppose que l'erreur se produit car "XmlIoHeader" n'est pas typé dans la requête

Quelqu'un peut m'aider? Je débute avec les WS...
Merci d'avance!