Layer7 Access Management

Expand all | Collapse all

Response Attribute creation by SDK

Jump to Best Answer
  • 1.  Response Attribute creation by SDK

    Posted 06-19-2017 02:17 PM

    Hello,

     

    I am trying to create response attribute by java SDK. I am using below code but ended getting below error from SmApiResult. I can only see the object "accept_response31" in "test_domain1" but not response attribute. Here, I want to have "ATTR_WA_HTTP_HEADER_VARIABLE" as a Attribute Type,"User Attribute" as Attribute Kind and EIN=<%userattr="UID"%>in Attribute Field

     

    Can you please advise on this...

     

    error:

     

    [facility=4 severity=3 reason=-1 status=36 message=ResponseAttr Unknown Failure] //failure for Resp Attr
    [facility=4 severity=0 reason=0 status=0 message=] // Success for response

     

     

    SmResponse response= new SmResponse();
    SmResponseAttr response_attr=new SmResponseAttr();
    response.setName("accept_response31");
    response.setDomainName("test_domain1");
    response_attr.setType(2);
    boolean x=true;
    response_attr.setAttrValue("UID");
    response_attr.setVarName("EIN");

    result=policyApi.addResponseAttr(response_attr,x);
    System.out.println(result);
    result=policyApi.addResponse(response);
    System.out.println(result);



  • 2.  Re: Response Attribute creation by SDK
    Best Answer

    Posted 06-20-2017 02:40 AM

    Hello,

     

    You can check the samples provided with the SDK.

    /opt/CA/sdk/samples/javapolicyapi/PolicyApiSample.java

     

    In the createResponseAttributes(SmPolicyApi policyapi) method

     

     // Static WebAgent-HTTP-Header-Variable Response Attribute
            Log(CRLF + bundle.getString("CREATE_HEADER_VARIABLE"));
            SmResponseAttr attrWAhttpHdrVar = new SmResponseAttr();
            attrWAhttpHdrVar.setAgentTypeAttr(SmResponseAttr.ATTR_WA_HTTP_HEADER_VARIABLE);
            attrWAhttpHdrVar.setType(SmResponseAttr.AttrType_Active);
            attrWAhttpHdrVar.setResponse(response.getOid());
            attrWAhttpHdrVar.setDomain(domain);
            attrWAhttpHdrVar.setTTL(60);
            attrWAhttpHdrVar.setValue("varname=varvalue");

     

     

    Hope it helps,

    Julien.



  • 3.  Re: Response Attribute creation by SDK

    Posted 06-21-2017 03:40 PM

    Thanks Julien. It worked as expected