2013-05-13 54 views
4

我正在嘗試使用opencart連接後臺支持系統。 我想這個SOAP致命錯誤:未捕獲SoapFault異常:[客戶端] SOAP-ERROR:編碼:對象沒有'源'屬性

<?php 
error_reporting(E_ALL); 
ini_set('display_errors', '1'); 

$osticket = new SoapClient('http://www.website.com/osticket/api/soap/index.php?wsdl'); 

// Set up the parameters 
$args = array(
    'username'  => 'WebService', 
    'password'  => '[email protected]', 
    'origin'  => 'Web', 
    'alertUser'  => true, 
    'alertStaff' => true, 
    'ticketData' => array(
     'name'  => utf8_encode('sir Test'), 
     'email'  => utf8_encode('[email protected]'), 
     'subject' => utf8_encode('testing'), 
     'message' => utf8_encode('this is a message'), 
     'topicId' => 3, //topic Website Support 
     'deptId' => 2, //department Sales 
     'staffId' => null, 
     'duedate' => null, 
     'time'  => null, 
     'pri'  => 2, // default priority 
     'phone'  => null, 
    ) 
); 

try { 
    // Send the request and receive the ticketID 
    $result = $osticket->__call('ostTicket.open',$args); 
} 
catch (SoapFault $e) { 
    throw $e; 
} 
?> 

整合我得到的錯誤是

Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object hasn't 'source' property in /home/website/website.com/catalog/view/theme/testtheme/template/information/contact.tpl:60 
Stack trace: 
#0 /home/website/website.com/catalog/view/theme/testtheme/template/information/contact.tpl(60): SoapClient->__call('ostTicket.open', Array) 
#1 /home/website/website.com/vqmod/vqcache/vq2-system_engine_controller.php(67): require('/home/website/tu...') 
#2 /home/website/website.com/catalog/controller/information/contact.php(127): Controller->render() 
#3 /home/website/website.com/vqmod/vqcache/vq2-system_engine_front.php(43): ControllerInformationContact->index() 
#4 /home/website/website.com/vqmod/vqcache/vq2-system_engine_front.php(29): Front->execute(Array, Array) 
#5 /home/website/website.com/index.php(238): Front->dispatch(Object(Action)) 
#6 {main} thrown in/home/website/website.com/catalog/view/theme/testtheme/template/information/contact.tpl on line 60 

這裏是60行(/template/information/contact.tpl):

$result = $osticket->__call('ostTicket.open',$args); 

我會,如果任何人心存感激請在這個問題上幫助我。

SOAP信息

這是從的phpinfo

Soap Client enabled 
Soap Server enabled 

Directive Local Value Master Value 
soap.wsdl_cache 1 1 
soap.wsdl_cache_dir /tmp /tmp 
soap.wsdl_cache_enabled 1 1 
soap.wsdl_cache_limit 5 5 
soap.wsdl_cache_ttl 86400 86400 
+0

分享你的Soap實現怎麼樣?沒有提供任何代碼,我們無法提供幫助。還發布整個錯誤(也與文件列表)。無論如何,這與OpenCart幾乎沒有任何關係,因此可以考慮刪除Opencart標籤... – shadyyx 2013-05-13 08:04:14

+0

嗨,更新了信息,感謝您的快速回復 – user1932809 2013-05-13 08:16:24

+0

嗯,例外情況是說有些對象缺少**'源' **必須具有的屬性,但我不知道它指向哪個對象。也許它也可能是這個'$ args'數組... – shadyyx 2013-05-13 08:42:35

回答

4

我也有同樣的問題,我一直在網上搜索,發現沒有答案。所以,我自己追查它。我喜歡分享我如何修復它。

正如你可以在http://www.website.com/osticket/api/soap/index.php?wsdl(將其更改爲你的URL)

看到下(XSD:複雜類型名稱= 「TicketData」),其參數需要ostTicket.open

你可以看到,有一個名爲source的元素(xsd:element name =「source」type =「xsd:string」),所以這就是ticketData數組中缺少的元素。只需要在你的ticketData數組裏面加上那個,可以賦值爲w/null。

ex。 'source'=> null,

這解決了我的問題。希望能幫助到你。

相關問題