Ok, my problem is I'm accessing a web service with apache axis and when I try to send an array ob object to the service only the first element of the array is received. I'm using JBuilder to develop the client, and the web service is written in PHP using NuSOAP. The service is simple it just counts the number of elements in the array and returns the amount. Here's the WSDL: <?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:si="http://soapinterop.org/xsd" xmlns:tns="http://homegrown.mine.nu/TestService" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://homegrown.mine.nu/TestService"> <types> <xsd:schema targetNamespace="http://homegrown.mine.nu/TestService"> <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" /> <xsd:complexType name="Person"> <xsd:all> <xsd:element name="personId" type="xsd:int"/> <xsd:element name="firstName" type="xsd:string"/> <xsd:element name="lastName" type="xsd:string"/> <xsd:element name="email" type="xsd:string"/> </xsd:all> </xsd:complexType> <xsd:complexType name="PersonArray"> <xsd:complexContent> <xsd:restriction base="SOAP-ENC:Array"> <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:Person[]"/> </xsd:restriction> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="StringArray"> <xsd:complexContent> <xsd:restriction base="SOAP-ENC:Array"> <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]"/> </xsd:restriction> </xsd:complexContent> </xsd:complexType> </xsd:schema> </types> <message name="countObjectsRequest"> <part name="persons" type="tns:PersonArray" /> </message> <message name="countObjectsResponse"> <part name="return" type="xsd:int" /> </message> <message name="countStringRequest"> <part name="strings" type="tns:StringArray" /> </message> <message name="countStringResponse"> <part name="return" type="xsd:int" /> </message> <portType name="TestFunctionsPortType"> <operation name="countObjects"> <documentation>Counts the number of elements in an array that was received and returns the amount.</documentation> <input message="tns:countObjectsRequest"/> <output message="tns:countObjectsResponse"/> </operation> <operation name="countString"> <documentation>Count the number of objects in string array and return the amount.</documentation> <input message="tns:countStringRequest"/> <output message="tns:countStringResponse"/> </operation> </portType> <binding name="TestFunctionsBinding" type="tns:TestFunctionsPortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="countObjects"> <soap:operation soapAction="http://homegrown.mine.nu/TestService#countObjects" style="rpc"/> <input> <soap:body use="encoded" namespace="http://homegrown.mine.nu/TestService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output> <soap:body use="encoded" namespace="http://homegrown.mine.nu/TestService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> <operation name="countString"> <soap:operation soapAction="http://homegrown.mine.nu/TestService#countString" style="rpc"/> <input> <soap:body use="encoded" namespace="http://homegrown.mine.nu/TestService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output> <soap:body use="encoded" namespace="http://homegrown.mine.nu/TestService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <service name="TestFunctions"> <port name="TestFunctionsPort" binding="tns:TestFunctionsBinding"> <soap:address location="http://homegrown.mine.nu/websvc/server.php"/> </port> </service> </definitions>
And here is my code that I'm using to test the service: package soapobjectarraytest; import java.net.URL; import nu.mine.homegrown.TestService.*; import org.apache.axis.*; public class ObjectTest { public static void main(String[] args) { TestFunctions service = new TestFunctionsLocator(); Person p1, p2, p3; try { TestFunctionsBindingStub binding = new TestFunctionsBindingStub(new URL( service.getTestFunctionsPortAddress()), service); p1 = new Person(12, "Bart", "Simpson", "[EMAIL PROTECTED]"); p2 = new Person(14, "Marge", "Simpson", "[EMAIL PROTECTED]"); p3 = new Person(22, "Harry", "Potter", "[EMAIL PROTECTED]"); Person[] pers = {p1, p2, p3}; System.out.println("Number of objects recieved at server: " + binding.countObjects(pers)); } catch (AxisFault e) { System.err.println("Caught SOAPException (" + e.getFaultCode() + "): " + e.getMessage()); } catch (Exception ex) { ex.getMessage(); ex.printStackTrace(); } } } ===== Roberto De Shong ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca