Skip to main content
17-Peridot
July 10, 2020
Question

Getting value of IBA by Java

  • July 10, 2020
  • 1 reply
  • 1344 views

Hello everyone!

 

I tried to get the values of global attributes through RMI, I could not do it.
Tell me, please, how can I do it?
Are there other ways in java to do it?
For example, through the odataWeb.jar library classes?
Thanks in advance!

 

Respectfully!

1 reply

5-Regular Member
July 10, 2020

Hi

 

Please check this sample where you will be able to update an IBA via RMI invocation. Note that you not have to check out the document if you want to only read the IBA value. :

 

public class updateIBA implements RemoteAccess {
	
	public static void main(String[] args)
	 {
	 // Retrieve a MethodServer remote reference
	 // from the ServerManager
	 RemoteMethodServer rms = RemoteMethodServer.getDefault();

	 // Authenticate using the default
	 // HTTPLogin Authenticator
	 rms.setUserName("wcadmin");
	 rms.setPassword("ts");

	 try
	 {
	 rms.invoke("update",
	 "ext.training.updateIBA", null, null, null);
	 System.out.println("Should have worked, check the MS log");
	 }
	 catch (Exception e)
	 {
	 e.printStackTrace();
	 }
	 }
 public static void update()
 {
 
 try
 {
 ObjectIdentifier oid = ObjectIdentifier.newObjectIdentifier("wt.doc.WTDocument:2956425"); 
 WTDocument object = (WTDocument) PersistenceHelper.manager.refresh(oid);
 Folder folder = WorkInProgressHelper.service.getCheckoutFolder();
 CheckoutLink cout = WorkInProgressHelper.service.checkout(object, folder, "checkedout");
 WTDocument manuf_copy = (WTDocument) cout.getWorkingCopy();
 
 PersistableAdapter obj = new PersistableAdapter(manuf_copy, null, SessionHelper.getLocale(), new UpdateOperationIdentifier());
 obj.load("intt");
 obj.set("intt", "158");
 
 object = (WTDocument) obj.apply();
 
 PersistenceHelper.manager.modify(object);
 WorkInProgressHelper.service.checkin(object, null);
 }
 catch (Exception e)
 {
 e.printStackTrace();
 }
 }
}

 

VladiSlav17-PeridotAuthor
17-Peridot
July 11, 2020

Thank you very much for your reply!

After starting, I have the following error:

 

wt.util.WTRemoteException: Unable to invoke remote method; nested exception is:
	java.lang.NoSuchMethodException: com.com.acme.Test.update()

 

What am I doing wrong?