Project

General

Profile

Task #2538

Story #2527: Verify AccessRights and ReplicationPolicy REST calls from Python CLI

Attempt to set replication policy fails using REST calls from Python CLI

Added by Andrew Pippin over 12 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Andrew Pippin
Category:
d1_cn_service
Start date:
2012-03-26
Due date:
% Done:

100%

Milestone:
CCI-1.0.0
Product Version:
*
Story Points:
Sprint:

Description

Cannot change replication policy via the Python/REST api:

DEBUG baseURL: https://cn-dev-3.dataone.org/cn
DEBUG operation: PUT /cn/v1/replicaPolicies/abp-20120326T1857Z
DEBUG headers: {'Content-Length': 464, 'Charset': 'utf-8', 'Content-Type': 'multipart/form-data; boundary=----------6B3C785C-6290-11DF-A355-A6ECDED72085_$', 'Accept': 'application/xml', 'User-Agent': 'pyd1/1.0.0c4 +http://dataone.org/'}
ERROR Unable to set replication policy on: abp-20120326T1857Z
ERROR Error:
ERROR ServiceFailure: No unmarshaller for element "{http://ns.dataone.org/service/types/v1}ReplicationPolicy" (line 1, col 142)

MIME multi-part payload:

------------6B3C785C-6290-11DF-A355-A6ECDED72085_$
Content-Disposition: form-data; name="serialVersion"

1
------------6B3C785C-6290-11DF-A355-A6ECDED72085_$
Content-Disposition: form-data; name="policy"; filename="policy.xml"
Content-Type: application/xml

<?xml version="1.0" ?>
------------6B3C785C-6290-11DF-A355-A6ECDED72085_$--


Related issues

Related to Infrastructure - Task #2539: Incorrect serial version being used for setAccess Closed 2012-03-26

History

#1 Updated by Andrew Pippin over 12 years ago

  • Category changed from d1_client_cli to d1_cn_service
  • Assignee changed from Andrew Pippin to Robert Waltz

I am receiving a "No unmarshalling for element...." error from the @/cn/v1/replicaPolicies@ REST endpoint (CNReplication.setReplicationPolicy(), http://mule1.dataone.org/ArchitectureDocs-current/apis/CN_APIs.html#CNReplication.setReplicationPolicy).

Same error using the Python client. Below is an example using cURL:

% curl -k -E ~/.ssh/pippin.pem --request PUT --trace trace.out \
--form "policy=@rp.xml;filename=policy.xml;type=application/xml" \
--form "serialVersion=@sv.txt" \
https://cn-dev-3.dataone.org/cn/v1/replicaPolicies/abp-20120326T1857Z
<?xml version="1.0" encoding="UTF-8"?>

No unmarshaller for element "{http://ns.dataone.org/service/types/v1}ReplicationPolicy" (line 1, col 142)

Replication policy (@rp.txt@):

<?xml version="1.0" ?>

Serial version (@sv.txt@):

10

#2 Updated by Andrew Pippin over 12 years ago

  • Assignee changed from Robert Waltz to Andrew Pippin

Robert noticed that the XML was serializing incorrectly: "@<ns1:ReplicationPolicy@ ..." instead of "@<ns1:replicationPolicy@ ..."

Roger showed me that PyXB has a quirk in that it assigns the element name based on how the constructor is called. I was invoking "@dataoneTypes.ReplicationPolicy()@" instead of "@dataoneTypes.replicationPolicy()@". Changed that and it started serializing correctly.

Python API call now works correctly.

#3 Updated by Andrew Pippin over 12 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Closing.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 14.8 MB)