Witam,
Mam taki problem: piszę prosty webservice i niestety nie mogę się uporać ze zwracaniem przez funkcję tablicy tablic asocjacyjnych. Próbowałem tak jak jest to zrobione tutaj:
http://www.koders.com/php/fidD92AAAEC4C749...nusoap+array#L9Ale niestety nie udało mi się. Otrzymuję zamiast tablicy wartość false.
Wrzucam kod WSDL, może znajdziecie błąd:
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions 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/" xmlns:tns="http://localhost/adwordsapi" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://localhost/adwordsapi">
<types><xsd:schema targetNamespace="http://localhost/adwordsapi"
>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="ArrayOfstring">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="string[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="GroupObject">
<xsd:sequence>
<xsd:element name="lwPos" type="xsd:float"/>
<xsd:element name="upPos" type="xsd:float"/>
<xsd:element name="text" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfGroupObject">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:GroupObject[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</types>
<message name="helloRequest"><part name="parm" type="xsd:string" /></message>
<message name="helloResponse"><part name="helloResponse" type="xsd:string" /></message>
<message name="userRequest"><part name="func" type="xsd:string" /><part name="params" type="tns:ArrayOfstring" /></message>
<message name="userResponse"><part name="userResponse" type="tns:ArrayOfstring" /></message>
<message name="groupRequest"><part name="params" type="tns:ArrayOfstring" /></message>
<message name="groupResponse"><part name="groupResponse" type="tns:ArrayOfGroupObject" /></message>
<portType name="GForgeAPIPortType"><operation name="hello"><input message="tns:helloRequest"/><output message="tns:helloResponse"/></operation><operation name="user"><input message="tns:userRequest"/><output message="tns:userResponse"/></operation><operation name="group"><input message="tns:groupRequest"/><output message="tns:groupResponse"/></operation></portType>
<binding name="GForgeAPIBinding" type="tns:GForgeAPIPortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="hello"><soap:operation soapAction="http://localhost/adwordsapi/soap2.php/hello" style="rpc"/><input><soap:body use="encoded" namespace="http://localhost/adwordsapi" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" namespace="http://localhost/adwordsapi" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation><operation name="user"><soap:operation soapAction="http://localhost/adwordsapi/soap2.php/user" style="rpc"/><input><soap:body use="encoded" namespace="http://localhost/adwordsapi" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" namespace="http://localhost/adwordsapi" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation><operation name="group"><soap:operation soapAction="http://localhost/adwordsapi/soap2.php/group" style="rpc"/><input><soap:body use="encoded" namespace="http://localhost/adwordsapi" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input><output><soap:body use="encoded" namespace="http://localhost/adwordsapi" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output></operation></binding>
<service name="GForgeAPI"><port name="GForgeAPIPort" binding="tns:GForgeAPIBinding"><soap:address location="http://localhost/adwordsapi/soap2.php"/></port></service>
</definitions>
Kod klienta:
<?php
$client = new soapclientNusoap( 'htt://localhost/adwordsapi/soap2.php?wsdl', true );
$result_array = array( 'XYZ', 'ABC' ); $response = $client->call( 'group', array( "XYZ", "ABC" ) ); ?>
Natomaist var_dump( group(array( "XYZ", "ABC" ))); w serwerze dał mi oczekiwany rezultat.
Liczę na Waszą pomoc

Może być także działający przykład - nie mam nic przeciwko

pzdr.
Ten post edytował masterix 19.09.2008, 11:06:14