• PHP Help
  • How can I use the WSDL web service in PHP?

I want to use site tsetmc.com web service in my robot but I don't know exactly how to do it Code web service:

<s:element name="Company">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" />
            <s:element minOccurs="1" maxOccurs="1" name="Flow" type="s:unsignedByte" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="CompanyResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="CompanyResult">
              <s:complexType>
                <s:sequence>
                  <s:element ref="s:schema" />
                  <s:any />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
$client = new SoapClient("http://service.tsetmc.com/WebService/TsePublicV2.asmx?WSDL", array('soap_version'   => SOAP_1_2));
echo'<pre>';
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
echo'</pre>';
echo'<hr>';
$params = array(
    "UserName" => "--",
    "Password" => "---",
    "Flow" => 0,
);
$response = $client->__soapCall("Company", array($params));
if($response)
{
    echo 'true <br>';
    var_dump($response);
}else{
    echo 'false';
}

The following operations are supported. For a formal definition, please review the Service Description.

Company service name help web service

Please guide me to use this web service

Result object(stdClass)#2 (0) { }

Thanks

    The fact that you get an object and not false/error as the result seems good. Since I don't know what would be the expected result, it's hard to say why it's empty. What does the "flow" setting mean? Have you tried a non-zero value (between 1 and 255)?

      Write a Reply...