0

I am very new with SCIM. I've tried to use SCIM 2.0 for WSO2 identity server to create new user in my project. Below is my code

public void callSCIM() throws URISyntaxException, ScimException {

        final String bearerToken = "Basic ..basic token...=";
        ClientConfig config = new ClientConfig();
        ApacheConnectorProvider connectorProvider = new ApacheConnectorProvider();
        config.connectorProvider(connectorProvider);
        Client restClient = ClientBuilder.newClient(config).register(OAuth2ClientSupport.feature(bearerToken));
        WebTarget target1 =
            restClient.target(new URI("https://localhost:9443/wso2/scim/"));
        ScimService scimService = new ScimService(target1);

        UserResource user = new UserResource();
        user.setUserName("babs");
        user.setPassword("secret");
        user = scimService.create("Users", user);

    }
}

i've logged the error message as below :

2018-12-10 15:26:37.699 ERROR 2568 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.unboundid.scim2.client.ScimServiceException: Error reading entity from input stream.] with root cause

com.fasterxml.jackson.databind.exc.MismatchedInputException: Missing required creator property 'status' (index 0)
 at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 84]
    at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59) ~[jackson-databind-2.9.6.jar:2.9.6]
    at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1316) ~[jackson-databind-2.9.6.jar:2.9.6]
    at com.fasterxml.jackson.databind.deser.impl.PropertyValueBuffer._findMissing(PropertyValueBuffer.java:193) ~[jackson-databind-2.9.6.jar:2.9.6]
    at com.fasterxml.jackson.databind.deser.impl.PropertyValueBuffer.getParameters(PropertyValueBuffer.java:159) ~[jackson-databind-2.9.6.jar:2.9.6]
    at com.fasterxml.jackson.databind.deser.ValueInstantiator.createFromObjectWith(ValueInstantiator.java:229) ~[jackson-databind-2.9.6.jar:2.9.6]
    at com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator.build(PropertyBasedCreator.java:195) ~[jackson-databind-2.9.6.jar:2.9.6]
    at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:488) ~[jackson-databind-2.9.6.jar:2.9.6]
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1287) ~[jackson-databind-2.9.6.jar:2.9.6]
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:326) ~[jackson-databind-2.9.6.jar:2.9.6]
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159) ~[jackson-databind-2.9.6.jar:2.9.6]
    at com.fasterxml.jackson.databind.ObjectReader._bind(ObjectReader.java:1574) ~[jackson-databind-2.9.6.jar:2.9.6]
    at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:965) ~[jackson-databind-2.9.6.jar:2.9.6]

please help...

Jens
  • 67,715
  • 15
  • 98
  • 113
  • 1
    The error is in parsing your JSON to an object. *Missing required creator property 'status' (* – Jens Dec 10 '18 at 07:47
  • thanks Jens for the respond. Could you pls elaborate more..i still dont understand..sorry i'm very new. – yante hasbullah Dec 10 '18 at 07:54
  • 1
    Looks like your JSON should have a property `Status` which is not send. print out the json object and take a look at it – Jens Dec 10 '18 at 07:55

1 Answers1

0

@Jens has the correct answer in the comment.

Here are the steps to debug your program and find that answer for yourself:

  1. In the exception stack traces of java your problem is almost always described in the very first line or the "caused by" line. It's a bit of an art to learn which part of the stack trace applied for your situation. In this case it's that first line:

    com.fasterxml.jackson.databind.exc.MismatchedInputException: Missing required creator property 'status' (index 0)

  2. Now that we know that status is missing and it's required we can look at the source system that is sending us the payload and see why it's not including the status field. This would really be the root cause of this error condition. Since you are writing and sending the payload you could simply add a System.prinln(user.toString()); before that last line of: user = scimService.create("Users", user);

Scott
  • 46
  • 5