Call wcf service from SoapClient using Complex type

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ghost1003
Forum Newbie
Posts: 2
Joined: Wed Mar 02, 2011 2:03 am

Call wcf service from SoapClient using Complex type

Post 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.
ghost1003
Forum Newbie
Posts: 2
Joined: Wed Mar 02, 2011 2:03 am

Re: Call wcf service from SoapClient using Complex type

Post by ghost1003 »

hurry it works.
My problem was wrong name between interface and class on wcf service.
Regards
Post Reply