Page 1 of 1

Call wcf service from SoapClient using Complex type

Posted: Wed Mar 02, 2011 2:15 am
by ghost1003
HI,
I have very big problem cal wcf service from php. When i call this wcf throw exception : null object.

My wsdl :

Code: Select all

<xs:element name="sendMails">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="fromAddr" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="toAddr" nillable="true" type="q2:ArrayOfstring"/>
</xs:sequence>
</xs:complexType>
</xs:element>
ArrayOfString type :

Code: Select all

<xs:schema elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<xs:complexType name="ArrayOfstring">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfstring" nillable="true" type="tns:ArrayOfstring"/>
</xs:schema>

and my call from php:

Code: Select all

$client = new SoapClient('http://localhost:1022/wsSite/WS.svc?wsdl');

              $tab = array();
              array_push($tab, "a1@gmail.com");
              array_push($tab, "a2@gmail.com");

        $parameters = array(
                "fromAddr" => "anyFromaddres@gmail.com",
                "toAddr" => $tab,
            );

        $result = $client->sendMails($parameters);
With simple type as string, int it works fine, but complex type like ArrayOfstring on wcf side is null.

Propably i'am not correctly call wcf service.
Please help if you has any ideas
Regards Thom.

Re: Call wcf service from SoapClient using Complex type

Posted: Thu Mar 03, 2011 8:01 am
by ghost1003
hurry it works.
My problem was wrong name between interface and class on wcf service.
Regards