四、配置与调试

昨天导师从美国回来,经过陈工导师和王工的悉心指导,终于完成了配置,可以在浏览器中访问。

首先在service.config里添加svc配置

   <service name="SugarCRM2.svc">
          <path>\services\IDataServiceQueryProvider2 Implementation\SugarCRM\SugarCRMDataService.php</path>
          <classname>SugarCRMDataService</classname>
          <baseURL>/SugarCRM2.svc</baseURL>
      </service>


 

然后在根目录下添加.htaccess文件,内容为

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (\.svc.*) OData/Index.php
</IfModule>


 

即为重写的规则,并开启apache的重写功能

之后在php中添加odata producer的库

即在php.ini中添加

include_path = ".;D:\wamp\www\Odata\library;";

 

重启服务器,在浏览器中输入

http://127.0.0.1/WordPress.svc/Posts(1)   返回了XML格式的数据

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<entry xml:base="http://127.0.0.1:80/WordPress.svc" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom" m:etag="W/"datetime'2014-03-09T16:17:03'"">
 <id>http://127.0.0.1:80/WordPress.svc/Posts(PostID=1)</id>
 <title type="text">Post</title>
 <updated>2014-08-04T12:05:14+00:00</updated>
 <author>
  <name/>
 </author>
 <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/User" type="application/atom+xml;type=entry" title="User" href="Posts(PostID=1)/User"/>
 <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Tags" type="application/atom+xml;type=feed" title="Tags" href="Posts(PostID=1)/Tags"/>
 <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Categories" type="application/atom+xml;type=feed" title="Categories" href="Posts(PostID=1)/Categories"/>
 <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Comments" type="application/atom+xml;type=feed" title="Comments" href="Posts(PostID=1)/Comments"/>
 <category term="WordPress.Post" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
 <content type="application/xml">
  <m:properties>
   <d:PostID m:type="Edm.Int32">1</d:PostID>
   <d:Author m:type="Edm.Int32">1</d:Author>
   <d:Date m:type="Edm.DateTime">2013-12-02T09:06:51</d:Date>
   <d:DateGmt m:type="Edm.DateTime">2013-12-02T01:06:51</d:DateGmt>
   <d:Content m:type="Edm.String">?????????????????????</d:Content>
   <d:Title m:type="Edm.String">????</d:Title>
   <d:Excerpt m:type="Edm.String" m:null="true"/>
   <d:Status m:type="Edm.String">publish</d:Status>
   <d:CommentStatus m:type="Edm.String">open</d:CommentStatus>
   <d:PingStatus m:type="Edm.String">open</d:PingStatus>
   <d:Password m:type="Edm.String" m:null="true"/>
   <d:Name m:type="Edm.String">hello-world</d:Name>
   <d:ToPing m:type="Edm.String" m:null="true"/>
   <d:Pinged m:type="Edm.String" m:null="true"/>
   <d:Modified m:type="Edm.DateTime">2014-03-09T16:17:03</d:Modified>
   <d:ModifiedGmt m:type="Edm.DateTime">2014-03-09T08:17:03</d:ModifiedGmt>
   <d:ContentFiltered m:type="Edm.String" m:null="true"/>
   <d:ParentID m:type="Edm.Int32">0</d:ParentID>
   <d:Guid m:type="Edm.String">http://127.0.0.1/wp/?p=1</d:Guid>
   <d:MenuOrder m:type="Edm.Int32">0</d:MenuOrder>
   <d:Type m:type="Edm.String">post</d:Type>
   <d:MimeType m:type="Edm.String" m:null="true"/>
   <d:CommentCount m:type="Edm.Int32">1</d:CommentCount>
  </m:properties>
 </content>
</entry>

至此测试成功

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值