I am using the VersionOne Java SDK. When I try to save a new story, I get a connectionException. Any idea what I'm doing wrong?
Oid projectId = Oid.fromToken("Scope:2004", _metaModel);
IAssetType storyType = _metaModel.getAssetType("Story");
Asset newStory = _services.createNew(storyType, projectId);
IAttributeDefinition nameAttribute = storyType.getAttributeDefinition("Name");
IAttributeDefinition ownerNameAttribute = storyType.getAttributeDefinition("Owners");
newStory.setAttributeValue(nameAttribute, story.getName());
_services.save(newStory);
The exception we're getting is:
com.versionone.apiclient.ConnectionException: Error writing to output stream
at com.versionone.apiclient.V1APIConnector.sendData(V1APIConnector.java:235)
at com.versionone.apiclient.Services.save(Services.java:229)
at com.versionone.apiclient.Services.save(Services.java:192)
at com.disney.versionOne.service.VersionOneRepository.add(VersionOneRepository.java:101)
at com.disney.serviceNow.versionOneIntegration.App.integration_test(App.java:142)
at com.disney.serviceNow.versionOneIntegration.App.main(App.java:81)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://fldcvdswa5890/VersionOneRAD/rest-1.v1/Data/Story
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at com.versionone.apiclient.V1APIConnector.sendData(V1APIConnector.java:226)
... 5 more
It turned out the issue was that the project I was using to create the story was no longer active. Once I used the right project id, the error went away.