Duo_Liang submitted April 21 2021

Before you applying this code to your Salesforce environment, make sure you have read the my blog series and completed the following tasks:

  • Register a Salesforce Connected App and enable Oauth2 authentication
  • Retrieve a refresh token for this app
  • Update OneSpan Sign Callback Service

OAuth Event Notification for Salesforce – Part 1
OAuth Event Notification for Salesforce – Part 2
OAuth Event Notification for Salesforce – Part 3
 

Rate this Code Share

Comments

Reply to: Set up Callback Listener in Salesforce

0 votes

Hi Duo

Could you please provide documentation on how to set up callback listener in Guidewire ClaimCenter v8.

Thanks

Reply to:

0 votes

Hi bthirupathireddy,

 

Have you downloaded the OSS Guidewire v9 Accelerator from marketplace? Not sure how different it is from v8, but it exposes a callback endpoint by creating and registering a servlet class.

Step1:

It's registered at the \modules\configuration\config\servlet\servlets.xml

Step2: the servlet looks like below: (I've simplified the code)

@Servlet("/onespanstatus")
public class OneSpanListener extends AbstractBasicAuthenticationServlet {

  ......
  override function doPost(request : HttpServletRequest, response : HttpServletResponse) {

    try {
      var servletUser : User

      servletUser = ServletUtils.getBasicAuthenticatedUser(request)

      response.setContentType("text/html")
      response.setStatus(HttpServletResponse.SC_OK)

      var content = new StringBuilder()
      var inputLine = request.getReader().readLine()
      while (inputLine != null) {
        content.append(inputLine)
        inputLine = request.getReader().readLine()
      }
      var text = content.toString()

      //process callback payload

      ......

    } catch (ex : Exception) {
      response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)
    }
  }


  override function isAuthenticationRequired(req : HttpServletRequest) : boolean {
      return true
  }

}

Step3: in this case, the endpoint is exposed at {server_url}/cc/service/onespanstatus

Step4: Guidewire servlet accepts Basic authentication, therefore, base64 encode your Guidewire username and password in format of:

{username}:{password}

And use it as the callback key in your OneSpan Sign account.

setup_callback_notification_2_0.png

 

Duo

Reply to: Set up Callback Listener in Salesforce

0 votes

Thanks Duo for replying. We did as you said but we are getting exception 503 service unavailable 

Our URL :http://localhost:8080//cc/service/onespanstatus 

Exception:Payload:

{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"PACKAGE_COMPLETE","sessionUser":"Signer1","packageId":"**********","message":null,"documentId":null,"createdDate":"2021-07-14T17:33:09.784Z"}
Reason(s): status code: 503, reason phrase: 503: Service Unavailable 

What should we do in this case ?

Reply to: Set up Callback Listener in Salesforce

0 votes

Thanks Duo for replying. We did as you said but we are getting exception 503 service unavailable 

Our URL :http://localhost:8080//cc/service/onespanstatus 

Exception:Payload:

{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"PACKAGE_COMPLETE","sessionUser":"Signer1","packageId":"**********","message":null,"documentId":null,"createdDate":"2021-07-14T17:33:09.784Z"}
Reason(s): status code: 503, reason phrase: 503: Service Unavailable 

What should we do in this case ?

Reply to: Set up Callback Listener in Salesforce

0 votes

Thanks Duo for replying. We did as you said but we are getting exception 503 service unavailable 

Our URL :http://localhost:8080//cc/service/onespanstatus 

Exception:Payload:

{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"PACKAGE_COMPLETE","sessionUser":"Signer1","packageId":"**********","message":null,"documentId":null,"createdDate":"2021-07-14T17:33:09.784Z"}
Reason(s): status code: 503, reason phrase: 503: Service Unavailable 

What should we do in this case ?

Reply to: Set up Callback Listener in Salesforce

0 votes

Thank you Duo I appreciate your help :)

Reply to: Set up Callback Listener in Salesforce

0 votes

Hi Duo,

 

Can you respond to this question if you have any insights on this issue ?

https://community.onespan.com/forum/getting-noclassdeffounderror-gwacceleratorsonespanonespanjsonutils

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off