WebService After Rule - Returning The application script threw an exception: java.lang.NullPointerException: Null Pointer in Method Invocation BSF info

I have a Web Service Connector rule that during aggregation take the api response from the connector and then pulls populates the required data on the source account. After which it makes a secound API call to the source system to pull a secondary api call to pull the needed profile to capture the manager information to populate on the Cube.

I have added a number of checks into the rule to capture Null values and to ensure that the rule only send the second api call on active accounts that are being aggregated in for the source. I have been able to validate the rule is working perfectly in our Sandbox tenant. But as soon as I move this rule over to our Production tenant the rule keeps throwing a Null Exception Pointer Error message.

I have added the following checks into the code for capturing and dealing with the error message but no matter what I add to the code it does not seem like the VA is processing that line of code. This only happens in our Production environment and I have been unable to narrow down why this would be the case I would of expected that this would of failed in both instances but it does not. I copy the exact same code that is working in our Sandbox up to production no modifications. Verified that the call is correct in PostMan. And yet I am still getting this error message. I am wonder has anyone else run into this issue? Or did I make a mistake in the below code that I am just not able to fully capture?

Exact Code being run but redacted any sensitive info:

import connector.common.JsonUtil;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import org.apache.http.client.ClientProtocolException;
import java.io.IOException;

log.error( "[ENTERING] WebServiceAfterOperationRule - SecZetta." );

Map updatedMapInfo = new HashMap();
List listOfUsers = new ArrayList();
Map jsonMap = JsonUtil.toMap( rawResponseObject );
List profiles = jsonMap.get( "profiles" );
for ( Map profile : profiles ) {
    Map returnProfile = new HashMap();
    returnProfile.put( "id" , profile.get( "id" ) );
    returnProfile.put( "uid" , profile.get( "uid" ) );
    returnProfile.put( "name" , profile.get( "name" ) );
    returnProfile.put( "person_status" , profile.get( "status" ) );
    String status = profile.get( "status" );
    returnProfile.put( "IIQDisabled", status.equalsIgnoreCase( "Active" ) ? "false" : "true" );
    returnProfile.put( "professional_phone_number" , profile.get( "attributes" ).get( "professional_phone_number" ) );
    returnProfile.put( "day_of_birth_ne_attribute" , profile.get( "attributes" ).get( "day_of_birth_ne_attribute" ) );
    returnProfile.put( "birth_month_ne_attribute" , profile.get( "attributes" ).get( "birth_month_ne_attribute" ) );
    returnProfile.put( "state_license_ne_attribute" , profile.get( "attributes" ).get( "state_license_ne_attribute" ) );
    returnProfile.put( "personal_first_name" , profile.get( "attributes" ).get( "personal_first_name" ) );
    returnProfile.put( "personal_last_name" , profile.get( "attributes" ).get( "personal_last_name" ) );
    returnProfile.put( "personal_phone_number" , profile.get( "attributes" ).get( "personal_phone_number" ) );
    returnProfile.put( "professional_active_engagements" , profile.get( "attributes" ).get( "professional_active_engagements" ) );
    returnProfile.put( "suffix_ne_attribute" , profile.get( "attributes" ).get( "suffix_ne_attribute" ) );
    returnProfile.put( "professional_email" , profile.get( "attributes" ).get( "professional_email" ) );
    returnProfile.put( "state_license_expiration_ne_attribute" , profile.get( "attributes" ).get( "state_license_expiration_ne_attribute" ) );
    returnProfile.put( "assignment_location_id_ne_attribute" , profile.get( "attributes" ).get( "assignment_location_id_ne_attribute" ) );
    returnProfile.put( "preferred_name_ne_attribute" , profile.get( "attributes" ).get( "preferred_name_ne_attribute" ) );
    returnProfile.put( "npi_ne_attribute" , profile.get( "attributes" ).get( "npi_ne_attribute" ) );
    if(profile.get( "attributes" ).get( "do_not_auto_provision_ne_button_attribute" ) == null)
    {
        returnProfile.put( "do_not_auto_provision_ne_button_attribute" , "True" );
    }
    else
    {
        returnProfile.put( "do_not_auto_provision_ne_button_attribute" , profile.get( "attributes" ).get( "do_not_auto_provision_ne_button_attribute" ) );
    }
    returnProfile.put( "sailpoint_username_ne_attribute" , profile.get( "attributes" ).get( "sailpoint_username_ne_attribute" ) );
    returnProfile.put( "last_4_ssn_ne_attribute" , profile.get( "attributes" ).get( "last_4_ssn_ne_attribute" ) );
    returnProfile.put( "assignment_facility_id_ne_attribute" , profile.get( "attributes" ).get( "assignment_facility_id_ne_attribute" ) );
    String personal_email = profile.get( "attributes" ).get( "personal_email" );
    returnProfile.put( "personal_email" , personal_email );
    returnProfile.put( "personal_middle_name" , profile.get( "attributes" ).get( "personal_middle_name" ) );
    String personal_last_name = profile.get( "attributes" ).get( "personal_last_name" );
    String day_of_birth_ne_attribute = profile.get( "attributes" ).get( "day_of_birth_ne_attribute" );
    String birth_month_ne_attribute = profile.get( "attributes" ).get( "birth_month_ne_attribute" );
    String last_4_ssn_ne_attribute = profile.get( "attributes" ).get( "last_4_ssn_ne_attribute" );
    returnProfile.put( "correlation_key" , personal_last_name != null && day_of_birth_ne_attribute != null && birth_month_ne_attribute != null && last_4_ssn_ne_attribute != null ? personal_last_name + day_of_birth_ne_attribute + birth_month_ne_attribute + last_4_ssn_ne_attribute : null );
    if ( personal_email != null  && status.equalsIgnoreCase("Active")) {
        String url = application.getAttributeValue( "genericWebServiceBaseUrl" ) + "/advanced_search/run";
        String payload = "{" +
            "    \"advanced_search\": {" +
            "        \"label\": \"All the Toms\"," +
            "        \"condition_rules_attributes\": [" +
            "            {" +
            "                \"type\": \"ProfileAttributeRule\"," +
            "                \"condition_object_id\": \"VALUEHERE\"," +
            "                \"object_type\": \"NeAttribute\"," +
            "                \"comparison_operator\": \"==\"," +
            "                \"value\": \""+ personal_email +"\"" +
            "            }," +
            "            {" +
            "                \"type\": \"ProfileTypeRule\"," +
            "                \"comparison_operator\": \"==\"," +
            "                \"value\": \"VALUEHERE\"" +
            "            }," +
            "            {" +
            "                \"type\": \"ProfileStatusRule\"," +
            "                \"comparison_operator\": \"==\"," +
            "                \"value\": \"Active\"" +
            "            }" +
            "        ]" +
            "    }" +
            "}";
        try{
            String profiles = restClient.executePost(url, payload, requestEndPoint.getHeader(), requestEndPoint.getResponseCode());
            Map jsonMap = JsonUtil.toMap( profiles );
            List listOfProfiles = jsonMap.get( "profiles" );
            if ( listOfProfiles.size() > 0) {
                if( listOfProfiles.get(0).get("attributes").get("manager_ne_attribute") != null){
                    String manager = (String) listOfProfiles.get(0).get("attributes").get("manager_ne_attribute");
                    String managerDisplayName = manager.substring( 0, manager.indexOf( '(' ) - 1 );
                    String managerEmail = manager.substring( manager.indexOf( '(' ) + 1, manager.indexOf( ')' ) );
                    returnProfile.put( "manager_display_name", manager );
                    returnProfile.put( "manager_email", managerEmail );
                }else if (listOfProfiles.get(0).get("attributes").get("manager_ne_attribute") == null){}
            }
        } catch (ClientProtocolException e) {
            log.error("Set Voalte Token :: an error occurred with the message: " + e.getMessage() );
        } catch (IOException e) {
            log.error("Set Voalte Token :: an IOException occurred with the message: " + e.getMessage() );
        }
    }
    listOfUsers.add( returnProfile );
}
log.error( jsonMap );
updatedMapInfo.put( "data", listOfUsers );
return updatedMapInfo;

log.error( "[EXITING] WebServiceAfterOperationRule - SecZetta." );

Hi Mark,
Did you try to create a new rule with different name and same code and try it out if that code gets picked up ?

I did not. However on Friday evening it just started working again. We have been successfully aggregating since then. So I am at a loss on why it was not working to begin with.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.