Custom Error Codes on JSSP

davidl14970702

21-08-2018

We are POSTing to a JSSP page in AC, and everything is working correctly but I need some help writing a response back to the headers in case a 200, 400 ect...

This is what I've got so far but it doesn't seem to be showing any error codes.

var rcp =

    <recipient

      _operation="insertOrUpdate"

      _key="@email"

      xtkschema="nms:recipient"

      firstName={request.getParameter("firstName")}

      lastName={request.getParameter("lastName")}

      email={request.getParameter("email")}

      profileID={request.getParameter("profileId")}

      JSSP_flag={"true"}

     />;    

   

  if( unLock == uuidKey ) { 

     nms.subscription.Subscribe(svc,rcp,create);

  }

  else 

  {   

    responseCode = 401;

    responseMessage = "Service Key is invalid";

    logWarning("Service called with unsupported key");

    addHeader.sendError(401);

    document.write('{\"responseCode\": \"'+responseCode+'\", \"message\": \"'+responseMessage+'\"}');

};

Accepted Solutions (0)

Answers (0)