2012-11-06 38 views
1

我正在使用SiteCore,我需要通过使用PHP脚本的API或SQL数据库将某些数据从软件中提取出来。我说两者都有可能的原因是因为即使稍后数据库发生变化,这对我来说也没有关系。需要从Sitecore中的问题中提取字段

反正...

我想拉任何数据字段,我可以从一个特定的问题得到。这是我的SOAP到目前为止的代码,并将其连接到服务等,但回报是不是我所需要...

try 
{ 
    $client = new SoapClient('http://localhost:8083/sitecore/shell/webservice/service.asmx?WSDL'); 

    $credentials = array('Password' => 'mypassword','Username' => 'sitecore\myusername'); 

    $Current_Issue = array(
    'id' => '{043B69BA-3175-4184-812F-C925CE80324E}', 
    //'language' => 'en', 
    //'version' => '1', 
    //'allFields' => 'true', 
    'databaseName' => 'web', 
    'credentials' => $credentials 
    ); 

    $response = $client->GetItemMasters($Current_Issue); 
    print_r($response); 

} 
catch(SoapFault $e) 
{ 
echo $e->getMessage(); 
} 
catch(Exception $e) 
{ 
echo $e->getMessage(); 
} 

这是我的输出:

stdClass Object 
(
    [GetItemMastersResult] => stdClass Object 
     (
      [any] => <sitecore xmlns=""/> 
     ) 

) 

任何帮助非常感谢。如果有人知道我可以使用的示例SQL查询,那么这与其他方法一样有用。

感谢

回答

6

如果您正在运行Sitecore的6.5/6.6,你可能想看看在Sitecore的项目网页API,于昨日(12年5月11日)公布。

http://sdn.sitecore.net/Products/Sitecore%20Item%20Web%20API.aspx

这使您可以执行对Sitecore的项目REST风格的操作,而不需要对旧的Web服务/ SOAP接口。使用此模块,您可以接收Sitecore项目或项目集合的JSON表示,甚至可以发回更改。您可能会发现它更容易使用:)

如果您必须使用SOAP接口,您确定您的项目已发布?尝试更改databaseName - >'master'并查看是否得到任何结果。其他要检查的事项是您正在使用的用户凭据的权限。