0

Any help, much appreciated.

I'm using the 1.6 SDK for Azure Storage Tables. On UpdateObject() I'm getting the following error:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <code>InvalidInput</code>
  <message xml:lang="en-US">One of the request inputs is not valid.
RequestId:b78bc343-f93c-4ec7-8991-24386131de43
Time:2012-08-08T01:25:32.4366914Z</message>
</error>

Here's the request (pulled from Fiddler):

MERGE https://foo.table.core.windows.net/foo('87a23657-9206-4450-a7ca-09d599b41b9f') HTTP/1.1
User-Agent: Microsoft ADO.NET Data Services
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 2.0;NetFx
x-ms-version: 2011-08-18
x-ms-date: Wed, 08 Aug 2012 01:24:56 GMT
Authorization: SharedKeyLite <foo>
Accept: application/atom+xml,application/xml
Accept-Charset: UTF-8
Content-Type: application/atom+xml
If-Match: *
Host: foo.table.core.windows.net
Content-Length: 1047

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry 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">
  <title />
  <author>
    <name />
  </author>
  <updated>2012-08-08T01:24:56.9434703Z</updated>
  <id>https://foo.table.core.windows.net/foo('87a23657-9206-4450-a7ca-09d599b41b9f')</id>
  <content type="application/xml">
    <m:properties>
      <d:EmailAddress>foo</d:EmailAddress>
      <d:Enabled m:type="Edm.Boolean">false</d:Enabled>
      <d:Id>87a23657-9206-4450-a7ca-09d599b41b9f</d:Id>
      <d:LastSignIn m:null="true" />
      <d:Name>new</d:Name>
      <d:PIN>0000</d:PIN>
      <d:PartitionKey>sandbox</d:PartitionKey>
      <d:RowKey>87a23657-9206-4450-a7ca-09d599b41b9f</d:RowKey>
      <d:SignupDate m:null="true" />
      <d:Timestamp m:type="Edm.DateTime">0001-01-01T00:00:00</d:Timestamp>
    </m:properties>
  </content>
</entry>

Here's the call to UpdateObject():

Public Sub Update(existingItem As UserDataModel)
    _ServiceContext.AttachTo(UserDataServiceContext.UserTableName, existingItem, "*")
    _ServiceContext.UpdateObject(existingItem)
    _ServiceContext.SaveChanges()
End Sub

Here's the code that initializes the service context:

Public Sub New()
    Try
        Dim storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString")
        _ServiceContext = New UserDataServiceContext(storageAccount.TableEndpoint.ToString(), storageAccount.Credentials)
        _ServiceContext.IgnoreResourceNotFoundException = True
        ' Create the tables
        ' In this case, just a single table.  
        storageAccount.CreateCloudTableClient().CreateTableIfNotExist(UserDataServiceContext.UserTableName)
    Catch ex As Exception
        Debug.WriteLine("Problem with New() UserDataSource. Error: " & ex.Message)
    End Try
End Sub

Let me know if there's anything else I can provide...

Cheers,

Thomas

EDIT 1: Here's what a successful insert looks like in Fiddler:

POST https://foo.table.core.windows.net/<tablename> HTTP/1.1
User-Agent: Microsoft ADO.NET Data Services
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 2.0;NetFx
x-ms-version: 2011-08-18
x-ms-date: Wed, 08 Aug 2012 15:41:36 GMT
Authorization: SharedKeyLite <key>
Accept: application/atom+xml,application/xml
Accept-Charset: UTF-8
Content-Type: application/atom+xml
Host: <tablename>.table.core.windows.net
Content-Length: 990

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry 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">
  <title />
  <author>
    <name />
  </author>
  <updated>2012-08-08T15:41:36.3923506Z</updated>
  <id />
  <content type="application/xml">
    <m:properties>
      <d:EmailAddress>[email protected]</d:EmailAddress>
      <d:Enabled m:type="Edm.Boolean">false</d:Enabled>
      <d:Id>74cdf74d-4eea-40b8-93c4-a7f8bc01c387</d:Id>
      <d:LastSignIn>634800372963013454</d:LastSignIn>
      <d:Name>(test)</d:Name>
      <d:PIN>0000</d:PIN>
      <d:PartitionKey>sandbox</d:PartitionKey>
      <d:RowKey>74cdf74d-4eea-40b8-93c4-a7f8bc01c387</d:RowKey>
      <d:SignupDate>634800372963013454</d:SignupDate>
      <d:Timestamp m:type="Edm.DateTime">0001-01-01T00:00:00</d:Timestamp>
    </m:properties>
  </content>
</entry>
2
  • Is this running against devstorage? Sometimes it behaves differently than the documentation says. eg, the insert-or-merge operation doesn't seem to work there. Commented Aug 8, 2012 at 19:30
  • The code above is running in a WCF service in local Azure compute emulator but it is hitting remote Azure cloud storage. Commented Aug 9, 2012 at 0:30

1 Answer 1

1

The URL looks wrong, but I'm not sure how it got that way... it should normally be something like https://<account>.table.core.windows.net/<table>(PartitionKey='<pkey>',RowKey='<rkey>'). But I have no explanation for why yours doesn't look right. (The code looks fairly straightforward.)

Are you able to perform other operations, like an insert? Do the URLs look right in Fiddler when you do that?

Sign up to request clarification or add additional context in comments.

2 Comments

Hi Steve - I've added a successful insert request trace to the question above.
Thanks. Oops, I guess an insert doesn't have the same URL structure.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.