SOAP-ERROR:编码:对象没有'CompanyID'属性“PHP

时间:2013-06-05 07:29:18

标签: php xml soap xml-parsing

以下是我们在发送SOAP请求时在项目中遇到的常见Soap错误。

请查看下面的PHP代码和SOAP请求示例....

        $client = new SoapClient("url for wsdl",
                 array(
                    'soap_version'   => SOAP_1_1, // Default Version
                    'trace'          => true,
                    'exceptions' => true,
                    'style' => SOAP_RPC, 
                    'use' => SOAP_ENCODED
                    )
                 );


                $parimaryName = array(  
                    "Company" => "xyz",
                    "FirstName" => "test",
                    "LastName" => "test",
                    "Mi"=>"test",
                    "NickName" => "t",
                    "Email" => "test@test.com"
                 );

            $customer = array(
                     "CustClassificationID" => 12345,
                     "PrimaryName" => $parimaryName,
                     "EnrollerDistributorID" => 345545
                );


                $webser= array(
                'APIKey' => 'xxx-xxx-xxxx',
                'CompanyID' => xxx,            
                "Customer"=> $customer

                );

                $ccRequest= array(
                    "WebServiceCredentialsBase"=>$webser,
                    "CustomerCreateOnlyRequest"=>$req                       
                );    

                $final=  array( 'Request' =>  $ccRequest);

                try {

                $result = $client->myServiceCall($final);
                echo "<pre>"; print_r($result); echo "</pre>";
                echo "Success"."<br />";
                echo("\n<p><pre>Dumping request:\n" . htmlspecialchars($client->__getLastRequest()) . '</pre></p>');
                echo("\n<p><pre>Dumping response:\n" . htmlspecialchars($client->__getLastResponse()) . '</pre></p>');              
              } catch(Exception $e) {
                echo "Failure"."<br />";
                echo("\n<p><pre>Dumping request:\n" . htmlspecialchars($client->__getLastRequest()) . '</pre></p>');
                echo("\n<p><pre>Dumping response:\n" . htmlspecialchars($client->__getLastResponse()) . '</pre></p>');
                echo "Caught Exception"; echo "</br>";
                var_dump($e->getMessage());
            }

错误: -

Caught Exception
string(56) "SOAP-ERROR: Encoding: object has no 'CompanyID' property"

我尝试调试错误但没有解决方案!!

请指导我在哪里做错了!!

谢谢!

0 个答案:

没有答案