Can you please provide code sample to Update the Physcial Object's Offsite Id by pass Unique Id as parameter ?
It's not possible using one call only, but it can be done in PO 10.5 using methods:
1. PhysicalObject.PhysObjGetInfoUID( String UniqueID ) which returns "NodeID"
2. DocumentManagement.UpdateNode( Node node ) with an AttributeGroup POCreateInfo having OffsiteStorID as an Attribute (the code snippet is below):
// Update Physical Item metadata Node poNode = docManagement.GetNode([NodeID]); if (poNode != null) {
AttributeGroup[] theAttributeGroups = new AttributeGroup[1]; AttributeGroup theAttributeGroup = new AttributeGroup();
theAttributeGroup.Key = "POCreateInfo"; theAttributeGroup.Type = "POCreateInfo";
List<DataValue> newValues = new List<DataValue>(); StringValue strValue = new StringValue(); strValue.Key = "OffsiteStorID"; newValues.Values = new string[] { [New OffsiteStroID Value] }; newValues.Add(strValue); theAttributeGroup.Values = new DataValue[newValues.Count];
for (int i = 0; i < newValues.Count; i++) { theAttributeGroup.Values[i] = newValues[i]; }
theAttributeGroups[0] = theAttributeGroup;
poNode.Metadata.AttributeGroups = theAttributeGroups;
docManagement.UpdateNode(poNode); }
PhysicalObjects PhyObjs;
PhyObjs.PhysObjGetInfoUID(String UniqueID) ;
Says that "does not contain definition for PhysObjGetInfoUID.
Am i missing something ?
Which version of Physical Objects module are you using?
Right, both functions - resolve the Physical Item ID using its Unique ID, as well as Update Metadata functinality appeared in 10.5.1, not in 10.5.0.
Thank you
The method is exposed after upgradeing the Physical Objects module to 10.5.1. But the method PhysObjGetInfoUID takes PhyObjGetInfoUIDRequest request as parameter that is
PhysicalObjects.PhysObjGetInfoUID (PhyObjGetInfoUIDRequest request)
But you specified as (String UniqueId) as parameter. I tried to pass the parameter as follows thought it will return node id. But it throws null reference exception.
string nodeid;
PhysObjGetInfoUIDRequest physreq = new PhysObjGetInfoUIDRequest();
PhysicalObjects PhysObjs = null;
physreq.UniqueID = "2015000047";
nodeid= PhysObjs.PhysObjGetInfoUID(physreq).ToString();
Strange, the request should get a String as a parameter for the Unique ID. Please check "PhysicalObjects" wsdl and schema definition (xsd=xsd0). BTW - what is your application server - IIS, Tomcat? For the IIS I have:
This is a snippet of java call:
private static void physObjUpdateMetadata(PhysicalObjects phys, DocumentManagement docman) {
PhysObjItemInfo info = phys.physObjGetInfoUID("20150047");
if (info != null) {
Node poNode = docman.getNode(info.getNodeID());
AttributeGroup theAttributeGroup = new AttributeGroup();
theAttributeGroup.setKey("POCreateInfo");
theAttributeGroup.setType("POCreateInfo");
StringValue strValue = new StringValue();
strValue.setKey("OffsiteStorID");
strValue.getValues().add("another test");
theAttributeGroup.getValues().add(strValue);
poNode.setMetadata(new Metadata());
poNode.getMetadata().getAttributeGroups().add(theAttributeGroup);
docman.updateNode(poNode);
}
For C#:
private void btPOMGetDocumentIDviaUniqueID_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(edPOMUniqueID.Text))
MessageBox.Show("Please enter the Unique ID of the document");
return;
fullAuthUrl = String.Format("{0}/{1}/Authentication" + serviceExt, edBaseURL.Text, edCoreAppName.Text);
fullPOUrl = String.Format("{0}/{1}/PhysicalObjects" + serviceExt, edBaseURL.Text, edPOAppName.Text);
try
this.Cursor = Cursors.WaitCursor;
// This service will be used to authenticate a user
RecManAPIClient.Authentication authService = new Authentication(fullAuthUrl);
authService.Timeout = TIMEOUT;
// This class will contain the authentication token used by services
RecManAPIClient.OTAuthentication otAuth = new OTAuthentication();
// authenticate
otAuth.AuthenticationToken = authService.AuthenticateUser("user", "password");
authService.OTAuthenticationValue = otAuth;
// Initialize a proxy for the Physical Objects service
RecManAPIClient.PhysicalObjects poService = new PhysicalObjects(fullPOUrl);
poService.OTAuthenticationValue = otAuth;
// Resolve Node ID using the UniqueID
PhysObjItemInfo info = poService.PhysObjGetInfoUID(edPOMUniqueID.Text);
if (info != null)
edPOMDocID.Text = info.NodeID.ToString();
catch (Exception ex)
MessageBox.Show(ex.Message, "Error Message");
finally
this.Cursor = Cursors.Default;
We are using IIS and i am using C#.Net to consume the webserver. I have removed the Service reference and added again. Find attached the screen shot which show the parameter as PhyObjGetInfoUIDRequest.
Ok, got it. Use this:
AuthenticationTest.AuthenticationClient auth = new AuthenticationTest.AuthenticationClient();
string token = auth.AuthenticateUser("user", "password");
PhysicalObjectsTest.OTAuthentication otAuth = new PhysicalObjectsTest.OTAuthentication();
otAuth.AuthenticationToken = token;
string uniqueID = "your unique ID";
PhysicalObjectsTest.PhysicalObjectsClient physClient = new PhysicalObjectsTest.PhysicalObjectsClient();
PhysicalObjectsTest.PhysObjItemInfo info = physClient.PhysObjGetInfoUID(ref otAuth, uniqueID);
Saravanan,
Typically those objects will appear in autocomplete if you are not using the correct method for adding service references.
The CWS 10.5 documentation can be found here with examples of how to properly set up your references:
https://knowledge.opentext.com/knowledge/llisapi.dll?func=ll&objId=45500683&objAction=browse&sort=name&viewType=1
Cheers,
Kyle
Hi Kyle,
Thank you for the reply. This method is available in 10.5.1 only. I am able to get the method after upgrading the module to 10.5.1
Right… My post was actually referring to the *Request and *Response objects you had in prior screenshots.
Alex,
We just figured that , it updates the offsiteid and removes existing category.
The fix is easy:
// poNode.setMetadata(new Metadata());
It still removes the category....
theAttributeGroup.Values = new DataValue[] { strValue };
//poNode.Metadata = new Metadata();
docClient.UpdateNode(ref otAuth, poNode);
use method "getAttributeGroups()" to get actual groups - otherwise you're wiping out whatever currently exists ( in your case categories)