2013-05-13 55 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,

这解决了我的问题。希望能帮助到你。

相关问题