When doing the following batch request with DataServicesClient:
```
GeneratedDataServicesClient client = new GeneratedDataServicesClient(serviceUrl);
client.Format.UseJson();
BatchCustomer customer = client.BatchCustomer.ToList().First();
Order order = new Order() { Id = 0, PurchaseDate = DateTime.Now };
client.AddToOrder(order);
client.AddLink(customer, "Orders", order);
client.SaveChanges(SaveChangesOptions.Batch);
```
that translates into the following HTTP request:
```
POST BaseUrl/$batch HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: multipart/mixed; boundary=batch_77c46244-d02f-4714-9e8d-28dd0910189c
Accept: multipart/mixed
Accept-Charset: UTF-8
User-Agent: Microsoft ADO.NET Data Services
Host: host
Content-Length: 1099
Expect: 100-continue
--batch_77c46244-d02f-4714-9e8d-28dd0910189c
Content-Type: multipart/mixed; boundary=changeset_d758f8a5-20a0-4d01-8c33-0884b8202729
--changeset_d758f8a5-20a0-4d01-8c33-0884b8202729
Content-Type: application/http
Content-Transfer-Encoding: binary
POST BaseUrl/Order HTTP/1.1
Content-ID: 11
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
{"Id":0,"PurchaseDate":"2013-05-06T09:05:44.6392992-07:00"}
--changeset_d758f8a5-20a0-4d01-8c33-0884b8202729
Content-Type: application/http
Content-Transfer-Encoding: binary
POST BaseUrl/BatchCustomer(0)/$links/Orders HTTP/1.1
Content-ID: 12
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
Content-Type: application/json;odata=minimalmetadata
{"url":"$11"}
--changeset_d758f8a5-20a0-4d01-8c33-0884b8202729--
--batch_77c46244-d02f-4714-9e8d-28dd0910189c--
```
The request fails because the $11 reference in the second request of the batch doesn't get resolved properly. The root of the problem is that ODataLib is not able to resolve the Url. In order for ODataLib to be able to properly resolve the Url we need to implement IODataUrlResolver in the ODataMessageWrapper class.
```
GeneratedDataServicesClient client = new GeneratedDataServicesClient(serviceUrl);
client.Format.UseJson();
BatchCustomer customer = client.BatchCustomer.ToList().First();
Order order = new Order() { Id = 0, PurchaseDate = DateTime.Now };
client.AddToOrder(order);
client.AddLink(customer, "Orders", order);
client.SaveChanges(SaveChangesOptions.Batch);
```
that translates into the following HTTP request:
```
POST BaseUrl/$batch HTTP/1.1
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: multipart/mixed; boundary=batch_77c46244-d02f-4714-9e8d-28dd0910189c
Accept: multipart/mixed
Accept-Charset: UTF-8
User-Agent: Microsoft ADO.NET Data Services
Host: host
Content-Length: 1099
Expect: 100-continue
--batch_77c46244-d02f-4714-9e8d-28dd0910189c
Content-Type: multipart/mixed; boundary=changeset_d758f8a5-20a0-4d01-8c33-0884b8202729
--changeset_d758f8a5-20a0-4d01-8c33-0884b8202729
Content-Type: application/http
Content-Transfer-Encoding: binary
POST BaseUrl/Order HTTP/1.1
Content-ID: 11
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Content-Type: application/json;odata=minimalmetadata
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
{"Id":0,"PurchaseDate":"2013-05-06T09:05:44.6392992-07:00"}
--changeset_d758f8a5-20a0-4d01-8c33-0884b8202729
Content-Type: application/http
Content-Transfer-Encoding: binary
POST BaseUrl/BatchCustomer(0)/$links/Orders HTTP/1.1
Content-ID: 12
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
Content-Type: application/json;odata=minimalmetadata
{"url":"$11"}
--changeset_d758f8a5-20a0-4d01-8c33-0884b8202729--
--batch_77c46244-d02f-4714-9e8d-28dd0910189c--
```
The request fails because the $11 reference in the second request of the batch doesn't get resolved properly. The root of the problem is that ODataLib is not able to resolve the Url. In order for ODataLib to be able to properly resolve the Url we need to implement IODataUrlResolver in the ODataMessageWrapper class.