Call RAM API not work problem
I want to call the RAM API to implement the goal: change the community of the asset .
My code like this: RAMAsset asset = this.getAsset(assetID); RAMCommunity community = session.getCommunity(communityname); asset.setCommunity(community); RAMSession session = new RAMSession("URL", "username", "password"); session.put(asset, new RAMStatusMonitor()); But after the above code run successfully, the asset never change its community, if in above codes I just use like asset.setDescription("test"), then the asset description will be updated. Is anybody knows what I miss in my code? Thanks. |
4 answers
Why are you creating a new session between the fetch and the put? Try...
RAMAsset asset = this.getAsset(assetID); RAMCommunity community = session.getCommunity(communityname); asset.setCommunity(community); session.put(asset, new RAMStatusMonitor()); and see if this works better for you? Thanks, Kevin I want to call the RAM API to implement the goal: change the community of the asset . |
Kbauer, I have tried the code as you given, but it still the same result, do you have any other idea?
The strange problem is when I run the unit test, in RAM 7.1 is succeed but the community not changed for that asset, the result is not correct but application runs with no error throw out. But in RAM 7.2 , it will report error like this: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1$DiagnosticWrappedException: org.xml.sax.SAXParseException: Premature end of file. at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:307) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:268) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:390) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(ResourceSetImpl.java:210) at com.ibm.ram.defaultprofile.util.Utilities.loadClassificationSchemaObjectFromURI(Utilities.java:861) at com.ibm.ram.common.util.ManifestAccessor$CustomAttribute.getDescriptor(ManifestAccessor.java:2020) at com.ibm.ram.common.util.ManifestAccessor$CustomAttribute.isRestrictedValues(ManifestAccessor.java:2046) at com.ibm.ram.common.util.ManifestAccessor$CustomAttribute.getUnrestrictedAttributeValues(ManifestAccessor.java:2190) at com.ibm.ram.common.util.ValidationManager.validateArtifactConstraints(ValidationManager.java:998) at com.ibm.ram.common.util.ValidationManager.validate(ValidationManager.java:209) at com.ibm.ram.common.util.ValidationManager.validate(ValidationManager.java:193) at com.ibm.ram.client.RAMSession.putAsset(RAMSession.java:2887) at com.ibm.ram.client.RAMSession.put(RAMSession.java:4730) at com.ibm.cloud.ram.RAMClient.setAssetCommunity(RAMClient.java:143) Thanks. Why are you creating a new session between the fetch and the put? Try... I want to call the RAM API to implement the goal: change the community of the asset . |
Today I continue to do unit test for this problem and open whole console log, it will throw following exception:
2010-08-24 16:17:14,609 - Enter: Call::invoke() 2010-08-24 16:17:14,609 - MessageContext: setTargetService(RAM1) 2010-08-24 16:17:14,609 - org.apache.axis.i18n.resource::handleGetObject(noService10) 2010-08-24 16:17:14,609 - Exception: org.apache.axis.ConfigurationException: No service named RAM1 is available org.apache.axis.ConfigurationException: No service named RAM1 is available at org.apache.axis.configuration.FileProvider.getService(FileProvider.java:233) at org.apache.axis.AxisEngine.getService(AxisEngine.java:311) at org.apache.axis.MessageContext.setTargetService(MessageContext.java:756) at org.apache.axis.client.Call.invoke(Call.java:2690) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.ibm.ram.repository.web.ws.core.v71.RAM1SoapBindingStub.getAllClassificationSchemaURI(RAM1SoapBindingStub.java:4608) at com.ibm.ram.internal.access.ws.RAMv71.getAllClassificationSchemaURI(RAMv71.java:110) at com.ibm.ram.internal.client.util.SessionManager.getAllCatgeorySchemaURIs(SessionManager.java:133) at com.ibm.ram.client.RAMSession.initCategorySchemaCache(RAMSession.java:1952) at com.ibm.ram.client.RAMSession.getAllCategorySchemas(RAMSession.java:1653) at com.ibm.ram.internal.client.util.ClientValidationManager.getAllCategoryURIs(ClientValidationManager.java:81) at com.ibm.ram.common.util.ValidationManager.initialize(ValidationManager.java:456) at com.ibm.ram.common.util.ManifestBuilder.setValidationManager(ManifestBuilder.java:2375) at com.ibm.ram.client.RAMAsset.getManifestBuilder(RAMAsset.java:925) at com.ibm.ram.client.RAMAsset.getSolutionCreateIfNeeded(RAMAsset.java:1809) at com.ibm.ram.client.RAMAsset.getArtifactsRoot(RAMAsset.java:1642) at com.ibm.ram.client.RAMAsset.getLocalArtifactArchiveFile(RAMAsset.java:3219) at com.ibm.ram.client.RAMSession.putAsset(RAMSession.java:2868) at com.ibm.ram.client.RAMSession.put(RAMSession.java:4730) at com.ibm.cloud.ram.RAMClient.setAssetCommunity(RAMClient.java:175) at com.ibm.cloud.ram.RAMClientTest.testSetAssetCommunity(RAMClientTest.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:44) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) at org.apache.axis.configuration.FileProvider.getService(FileProvider.java:233) at org.apache.axis.AxisEngine.getService(AxisEngine.java:311) at org.apache.axis.MessageContext.setTargetService(MessageContext.java:756) at org.apache.axis.client.Call.invoke(Call.java:2690) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.ibm.ram.repository.web.ws.core.v71.RAM1SoapBindingStub.getAllClassificationSchemaURI(RAM1SoapBindingStub.java:4608) at com.ibm.ram.internal.access.ws.RAMv71.getAllClassificationSchemaURI(RAMv71.java:110) at com.ibm.ram.internal.client.util.SessionManager.getAllCatgeorySchemaURIs(SessionManager.java:133) at com.ibm.ram.client.RAMSession.initCategorySchemaCache(RAMSession.java:1952) at com.ibm.ram.client.RAMSession.getAllCategorySchemas(RAMSession.java:1653) at com.ibm.ram.internal.client.util.ClientValidationManager.getAllCategoryURIs(ClientValidationManager.java:81) at com.ibm.ram.common.util.ValidationManager.initialize(ValidationManager.java:456) at com.ibm.ram.common.util.ManifestBuilder.setValidationManager(ManifestBuilder.java:2375) at com.ibm.ram.client.RAMAsset.getManifestBuilder(RAMAsset.java:925) at com.ibm.ram.client.RAMAsset.getSolutionCreateIfNeeded(RAMAsset.java:1809) at com.ibm.ram.client.RAMAsset.getArtifactsRoot(RAMAsset.java:1642) at com.ibm.ram.client.RAMAsset.getLocalArtifactArchiveFile(RAMAsset.java:3219) at com.ibm.ram.client.RAMSession.putAsset(RAMSession.java:2868) at com.ibm.ram.client.RAMSession.put(RAMSession.java:4730) at com.ibm.cloud.ram.RAMClient.setAssetCommunity(RAMClient.java:175) at com.ibm.cloud.ram.RAMClientTest.testSetAssetCommunity(RAMClientTest.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:44) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) 2010-08-24 16:17:14,609 - MessageContext: setServiceHandler(null) 2010-08-24 16:17:14,609 - org.apache.axis.i18n.resource::handleGetObject(targetService) 2010-08-24 16:17:14,609 - Target service: RAM1 2010-08-24 16:17:14,609 - MessageContext: setTargetService(getAllClassificationSchemaURI) 2010-08-24 16:17:14,609 - org.apache.axis.i18n.resource::handleGetObject(noService10) 2010-08-24 16:17:14,625 - Exception: org.apache.axis.ConfigurationException: No service named getAllClassificationSchemaURI is available org.apache.axis.ConfigurationException: No service named getAllClassificationSchemaURI is available at org.apache.axis.configuration.FileProvider.getService(FileProvider.java:233) at org.apache.axis.AxisEngine.getService(AxisEngine.java:311) at org.apache.axis.MessageContext.setTargetService(MessageContext.java:756) at org.apache.axis.transport.http.HTTPTransport.setupMessageContextImpl(HTTPTransport.java:89) at org.apache.axis.client.Transport.setupMessageContext(Transport.java:46) at org.apache.axis.client.Call.invoke(Call.java:2738) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.ibm.ram.repository.web.ws.core.v71.RAM1SoapBindingStub.getAllClassificationSchemaURI(RAM1SoapBindingStub.java:4608) at com.ibm.ram.internal.access.ws.RAMv71.getAllClassificationSchemaURI(RAMv71.java:110) at com.ibm.ram.internal.client.util.SessionManager.getAllCatgeorySchemaURIs(SessionManager.java:133) at com.ibm.ram.client.RAMSession.initCategorySchemaCache(RAMSession.java:1952) at com.ibm.ram.client.RAMSession.getAllCategorySchemas(RAMSession.java:1653) at com.ibm.ram.internal.client.util.ClientValidationManager.getAllCategoryURIs(ClientValidationManager.java:81) at com.ibm.ram.common.util.ValidationManager.initialize(ValidationManager.java:456) at com.ibm.ram.common.util.ManifestBuilder.setValidationManager(ManifestBuilder.java:2375) at com.ibm.ram.client.RAMAsset.getManifestBuilder(RAMAsset.java:925) at com.ibm.ram.client.RAMAsset.getSolutionCreateIfNeeded(RAMAsset.java:1809) at com.ibm.ram.client.RAMAsset.getArtifactsRoot(RAMAsset.java:1642) at com.ibm.ram.client.RAMAsset.getLocalArtifactArchiveFile(RAMAsset.java:3219) at com.ibm.ram.client.RAMSession.putAsset(RAMSession.java:2868) at com.ibm.ram.client.RAMSession.put(RAMSession.java:4730) at com.ibm.cloud.ram.RAMClient.setAssetCommunity(RAMClient.java:175) at com.ibm.cloud.ram.RAMClientTest.testSetAssetCommunity(RAMClientTest.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:44) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) at org.apache.axis.configuration.FileProvider.getService(FileProvider.java:233) at org.apache.axis.AxisEngine.getService(AxisEngine.java:311) at org.apache.axis.MessageContext.setTargetService(MessageContext.java:756) at org.apache.axis.transport.http.HTTPTransport.setupMessageContextImpl(HTTPTransport.java:89) at org.apache.axis.client.Transport.setupMessageContext(Transport.java:46) at org.apache.axis.client.Call.invoke(Call.java:2738) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.ibm.ram.repository.web.ws.core.v71.RAM1SoapBindingStub.getAllClassificationSchemaURI(RAM1SoapBindingStub.java:4608) at com.ibm.ram.internal.access.ws.RAMv71.getAllClassificationSchemaURI(RAMv71.java:110) at com.ibm.ram.internal.client.util.SessionManager.getAllCatgeorySchemaURIs(SessionManager.java:133) at com.ibm.ram.client.RAMSession.initCategorySchemaCache(RAMSession.java:1952) at com.ibm.ram.client.RAMSession.getAllCategorySchemas(RAMSession.java:1653) at com.ibm.ram.internal.client.util.ClientValidationManager.getAllCategoryURIs(ClientValidationManager.java:81) at com.ibm.ram.common.util.ValidationManager.initialize(ValidationManager.java:456) at com.ibm.ram.common.util.ManifestBuilder.setValidationManager(ManifestBuilder.java:2375) at com.ibm.ram.client.RAMAsset.getManifestBuilder(RAMAsset.java:925) at com.ibm.ram.client.RAMAsset.getSolutionCreateIfNeeded(RAMAsset.java:1809) at com.ibm.ram.client.RAMAsset.getArtifactsRoot(RAMAsset.java:1642) at com.ibm.ram.client.RAMAsset.getLocalArtifactArchiveFile(RAMAsset.java:3219) at com.ibm.ram.client.RAMSession.putAsset(RAMSession.java:2868) at com.ibm.ram.client.RAMSession.put(RAMSession.java:4730) at com.ibm.cloud.ram.RAMClient.setAssetCommunity(RAMClient.java:175) at com.ibm.cloud.ram.RAMClientTest.testSetAssetCommunity(RAMClientTest.java:88) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:44) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41) at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) at org.junit.runners.ParentRunner.run(ParentRunner.java:220) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) 2010-08-24 16:17:14,625 - MessageContext: setServiceHandler(null) The strange thing is: In RAM , for this asset, it show the message for the asset Updated. Updated section: content. Asset updated using the rich client. But actually its community never changed. |
Are you sure the Web Services app is up? Can you hit the web services URL (you give to the client) renders in a browser.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.