Client API Service Context Access

Certified Lead Developer

We are exploring calling Appian as a Client API from a custom component (docs.appian.com/.../reference-js-api.html, and I'm looking into ways to get a user's service context in order to exectue some backend services (i.e. ContentService). I could probably make some calls via Integrations/Web APIs instead, but I'm trying to work with document manipulation, so everything needs to happen server-side and it seems clunky to have my ClientAPI call an Appian WebAPI vs use public API calls.

I see few other components out there are executing ServiceContextFactory.getServiceContext(username)**; but when I've tried to replicate that, but my component is returning a 500 error and this exception:

---

"com.appiancorp.connectedsystems.templateframework.functions.pipeline.proxyDecoratorPipeline.TemplateInvocationException: Contact the developer of this template to resolve the following issue. java.lang.VerifyError: Bad return type Exception Details: Location: com/appiancorp/services/AbstractServiceContext.getImmutableCredentials(Lcom/appiancorp/services/ServiceContext;)Lcom/appiancorp/suiteapi/common/Credentials; @14: areturn Reason: Type 'com/appiancorp/ag/ImmutableCredentials' (current frame, stack[0]) is not assignable to 'com/appiancorp/suiteapi/common/Credentials' (from method signature) Current Frame: bci: @14 flags: { } locals: { 'com/appiancorp/services/AbstractServiceContext', 'com/appiancorp/services/ServiceContext' } stack: { 'com/appiancorp/ag/ImmutableCredentials' } Bytecode: 0x0000000: 2b12 56b8 0057 c000 55b9 0058 0100 b0 "

---

Has anyone else experienced this error or have other ideas on how to resolve or workaround it?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Turned out to be an issue with a dependency conflict in my gradle file. I had the SDK jar set as implementation - changing it to compileOnly resolved the error:

    dependencies {
    compileOnly 'com.appian:connected-systems-core:1.2.0'
    compileOnly files('<Path>/appian-plug-in-sdk.jar')
    implementation 'com.appian:connected-systems-client:1.1.0'
    testImplementation 'com.appian:connected-systems-core:1.2.0'
    }

Reply
  • 0
    Certified Lead Developer

    Turned out to be an issue with a dependency conflict in my gradle file. I had the SDK jar set as implementation - changing it to compileOnly resolved the error:

    dependencies {
    compileOnly 'com.appian:connected-systems-core:1.2.0'
    compileOnly files('<Path>/appian-plug-in-sdk.jar')
    implementation 'com.appian:connected-systems-client:1.1.0'
    testImplementation 'com.appian:connected-systems-core:1.2.0'
    }

Children
No Data