Test connection fails in Webservices COnnector

Hi Team,

I am getting the below error when attempting a test connection for a Web Services Connector. Any Ideas?

Exception occurred in Test Connection. Error: class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap')

Hi Marvin,

Could you show us what your Test Connection operation configuration looks like? Are you attempting to map any attributes in the Test Connection operation?

Thanks,

Liam

1 Like

Hi Liam,

Thanks for chiming in. I am not attempting to map attributes in the test connection.

See below.

Test Connection
Operation Name
Test Connection
Operation Type
Test Connection
Use cURL Command
false
Context URL
odatav4/searchStudent/v1/Students?$filter=criteria/domainIDs eq %2785350%27
HTTP Method
GET
Authorization
Bearer $application.accesstoken$
Root Path
Success Codes (1)
2**
Account Aggregation
Operation Name
Account Aggregation
Operation Type
Account Aggregation
Use cURL Command
false
Context URL
odatav4/searchStudent/v1/Students?$top=200&$skip=0
HTTP Method
GET
Authorization
Bearer $application.accesstoken$
Content-Type
application/json;odata.metadata=minimal
Root Path
$.value
Success Codes (1)
2**
studentID
studentID
personExternalID
personExternalID
emailAddr
emailAddr
Parent Endpoint Name
Initial Page Offset
0
Page Size
200
Paging Steps
$sysparm_limit$ = 200 TERMINATE_IF $RECORDS_COUNT$ < $sysparm_limit$ $sysparm_offset$ = $sysparm_offset$ + $sysparm_limit$ $endpoint.fullUrl$ = $application.baseUrl$ + "odatav4/searchStudent/v1/Students?$top=200&$skip=" + $sysparm_offset$
Account Aggregation 2
Operation Name
Account Aggregation 2
Operation Type
Account Aggregation
Use cURL Command
false
Context URL
odatav4/public/user/learningHistory/v1/learninghistorys?$filter=criteria/targetUserID%20eq%20'$response.studentID$'
HTTP Method
GET
Authorization
Bearer $application.accesstoken$
Content-Type
application/json;odata.metadata=minimal
Root Path
Success Codes (1)
2**
componentID
$.value[*].componentID
title
$.value[*].title
status
$.value[*].status
Parent Endpoint Name
Account Aggregation
Initial Page Offset
0
Page Size
200
Paging Steps
Entitlement Aggregation
Operation Name
Entitlement Aggregation
Operation Type
Group Aggregation
Use cURL Command
false
Context URL
odatav4/public/admin/searchItem/v1/Items?$filter=criteria/itemTypeIDs eq 'COURSE'&$top=200&$skip=0
HTTP Method
GET
Authorization
Bearer $application.accesstoken$
Content-Type
application/json;odata.metadata=minimal
Root Path
$.value
Success Codes (1)
2**
itemID
itemID
title
title
Parent Endpoint Name
Initial Page Offset
0
Page Size
200
Paging Steps
$sysparm_limit$ = 200 TERMINATE_IF $RECORDS_COUNT$ < $sysparm_limit$ $sysparm_offset$ = $sysparm_offset$ + $sysparm_limit$ $endpoint.fullUrl$ = $application.baseUrl$ + "odatav4/public/admin/searchItem/v1/Items?$filter=criteria/itemTypeIDs eq 'COURSE'&$top=200&$skip=" + $sysparm_offset$
Entitlement Aggregation 2
Operation Name
Entitlement Aggregation 2
Operation Type
Group Aggregation
Use cURL Command
false
Context URL
odatav4/public/admin/searchItem/v1/Items?$filter=criteria/itemTypeIDs eq 'ILT'&$top=200&$skip=0
HTTP Method
GET
Authorization
Bearer $application.accesstoken$
Content-Type
application/json;odata.metadata=minimal
Root Path
$.value
Success Codes (1)
2**
itemID
itemID
title
title
Parent Endpoint Name
Initial Page Offset
0
Page Size
200
Paging Steps
$sysparm_limit$ = 200 TERMINATE_IF $RECORDS_COUNT$ < $sysparm_limit$ $sysparm_offset$ = $sysparm_offset$ + $sysparm_limit$ $endpoint.fullUrl$ = $application.baseUrl$ + "odatav4/public/admin/searchItem/v1/Items?$filter=criteria/itemTypeIDs eq 'ILT'&$top=200&$skip=" + $sysparm_offset$
Entitlement Aggregation 3
Operation Name
Entitlement Aggregation 3
Operation Type
Group Aggregation
Use cURL Command
false
Context URL
odatav4/public/admin/searchItem/v1/Items?$filter=criteria/itemTypeIDs eq 'CHECKLIST'&$top=200&$skip=0
HTTP Method
GET
Authorization
Bearer $application.accesstoken$
Content-Type
application/json;odata.metadata=minimal
Root Path
$.value
Success Codes (1)
2**
itemID
itemID
title
title
Parent Endpoint Name
Initial Page Offset
0
Page Size
200
Paging Steps
$sysparm_limit$ = 200 TERMINATE_IF $RECORDS_COUNT$ < $sysparm_limit$ $sysparm_offset$ = $sysparm_offset$ + $sysparm_limit$ $endpoint.fullUrl$ = $application.baseUrl$ + "odatav4/public/admin/searchItem/v1/Items?$filter=criteria/itemTypeIDs eq 'CHECKLIST'&$top=200&$skip=" + $sysparm_offset$

Do you have any rules attached to the Test Connection operation?

Also if you could get snapshots/json of the Test Connection operation would help us to debug the issue.

Hello,

There is high possible that you are getting this Java exception of “Exception occurred in Test Connection. Error: class java.lang.String cannot be cast to class java.util.Map” because of an Web Service Before Ops Rule or Before Prov Rule which is attached to your source which is using web service connector where for a particular operation, the data is in key value pair but you have declared the variable to capture that data as String due to which you are getting cannot cast exception.

Regards,
Rohit

Hi Zeel,

Not the test Operation but for the Account Aggregation 2 there is a WebServiceAfterOperationRule attached. See below from the Source Config.

{
                "httpMethodType": "GET",
                "sequenceNumberForEndpoint": "2",
                "uniqueNameForEndPoint": "Test Connection",
                "afterRule": null,
                "curlCommand": null,
                "rootPath": null,
                "body": {
                    "jsonBody": null,
                    "bodyFormat": "raw"
                },
                "responseCode": [
                    "2**"
                ],
                "resMappingObj": null,
                "contextUrl": "odatav4/searchStudent/v1/Students?$filter=criteria/domainIDs eq %2785350%27",
                "curlEnabled": false,
                "header": {
                    "Authorization": "Bearer $application.accesstoken$"
                },
                "operationType": "Test Connection",
                "beforeRule": null,
                "xpathNamespaces": null,
            }
{
                "httpMethodType": "GET",
                "pagingInitialOffset": 0,
                "sequenceNumberForEndpoint": "4",
                "uniqueNameForEndPoint": "Account Aggregation 2",
                "afterRule": "Parkland Pathways Concatenate Course",
                "curlCommand": null,
                "rootPath": null,
                "body": {
                    "bodyFormData": null,
                    "jsonBody": null,
                    "bodyFormat": "raw"
                },
                "customAuthUrl": null,
                "paginationSteps": null,
                "responseCode": [
                    "2**"
                ],
                "resMappingObj": {
                    "componentID": "$.value[*].componentID",
                    "title": "$.value[*].title",
                    "status": "$.value[*].status"
                },
                "contextUrl": "odatav4/public/user/learningHistory/v1/learninghistorys?$filter=criteria/targetUserID%20eq%20'$response.studentID$'",
                "pagingSize": 200,
                "curlEnabled": false,
                "header": {
                    "Authorization": "Bearer $application.accesstoken$",
                    "Content-Type": "application/json;odata.metadata=minimal"
                },
                "operationType": "Account Aggregation",
                "beforeRule": null,
                "xpathNamespaces": null,
                "parentEndpointName": "Account Aggregation"
            }

Hi Rohit,

I was thinking down the same path as you but the only rule I see connected is the one below.

{
                "httpMethodType": "GET",
                "pagingInitialOffset": 0,
                "sequenceNumberForEndpoint": "4",
                "uniqueNameForEndPoint": "Account Aggregation 2",
                "afterRule": "Parkland Pathways Concatenate Course",
                "curlCommand": null,
                "rootPath": null,
                "body": {
                    "bodyFormData": null,
                    "jsonBody": null,
                    "bodyFormat": "raw"
                },
                "customAuthUrl": null,
                "paginationSteps": null,
                "responseCode": [
                    "2**"
                ],
                "resMappingObj": {
                    "componentID": "$.value[*].componentID",
                    "title": "$.value[*].title",
                    "status": "$.value[*].status"
                },
                "contextUrl": "odatav4/public/user/learningHistory/v1/learninghistorys?$filter=criteria/targetUserID%20eq%20'$response.studentID$'",
                "pagingSize": 200,
                "curlEnabled": false,
                "header": {
                    "Authorization": "Bearer $application.accesstoken$",
                    "Content-Type": "application/json;odata.metadata=minimal"
                },
                "operationType": "Account Aggregation",
                "beforeRule": null,
                "xpathNamespaces": null,
                "parentEndpointName": "Account Aggregation"
            }

In your Account Aggregation 2 operation you does not have rootpath configured. Can you put a sample response on how you are getting compoentID, title and status. You might have to check your rule where this error would be throwing.

Hey Marvin,

High chance you are getting this error because of your after rule. Check if you’re assigning a variable to a Map.

I had got similar error when mapping rawResponseObject directly to a Map. Could be the same reason for you.

Please check this once.

Hello,

Validate the rule as highlighted below.

There could be some issues there because the error which you are getting is more of sort of Java Error and high changes that you will get it in before or after create web service rule.

Thank You,

Regards,
Rohit

Thanks Rohit and everyone,

Let me dig into your suggestions. I’ll keep you posted.

1 Like

Hi Team,

I ended up having to create another source as I was not able to determine what part of the rule was causing the issue. Thanks everyone for the assist. Much appreciated.

You didn’t find any root cause of this, Otherthan creating new source ?

That’s correct my friend