Skip to content

Caused by: com.gooddata.GoodDataRestException: 415: [request_id=xyz] Content type 'application/xml;charset=UTF-8' not supported #837

@BenDol

Description

@BenDol

Having trouble getting the Afm execution working.
Caused by: com.gooddata.GoodDataRestException: 415: [request_id=tzRYVbhAWy3Z8aTS] Content type 'application/xml;charset=UTF-8' not supported

Project insclixProject = goodDataService.getProjectService().getProjectById("XYZ");
ExecuteAfmService executeAfmService = goodDataService.getExecuteAfmService();
MetadataService metadataService = goodDataService.getMetadataService();

Attribute attr = metadataService.getObj(insclixProject, Attribute.class, Restriction.title("PaymentMethod"));
Metric metric = metadataService.getObj(insclixProject, Metric.class, Restriction.title("@NetUnits"));

Afm afm = new Afm()
    // How
    .addAttribute(new AttributeItem(new IdentifierObjQualifier(attr.getDefaultDisplayForm().getIdentifier()), "a1"))
    // What
    .addMeasure(new MeasureItem(new SimpleMeasureDefinition(new UriObjQualifier(metric.getUri())), "m1"));
    // TODO Filter

Execution execution = new Execution(afm);
ExecutionResponse response = executeAfmService.executeAfm(insclixProject, execution);
logger.info(response.getExecutionResultUri());
logger.info(response.toString());

Results in:

java.lang.IllegalStateException: Failed to execute CommandLineRunner
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:816)
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:797)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:324)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
	at com.insclix.dashboard.EmbeddedWebApplication.main(EmbeddedWebApplication.java:54)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:67)
Caused by: com.gooddata.GoodDataException: Unable to execute AFM
	at com.gooddata.sdk.service.executeafm.ExecuteAfmService.executeAfm(ExecuteAfmService.java:77)
	at com.insclix.dashboard.DevIntitializer.lambda$testData$0(DevIntitializer.java:103)
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:813)
	... 10 common frames omitted
Caused by: com.gooddata.GoodDataRestException: 415: [request_id=e0WU2jcSXi0r9LAb] Content type 'application/xml;charset=UTF-8' not supported
	at com.gooddata.sdk.service.util.ResponseErrorHandler.handleError(ResponseErrorHandler.java:55)
	at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
	at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:778)
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:736)
	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:670)
	at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:414)
	at com.gooddata.sdk.service.executeafm.ExecuteAfmService.executeAfm(ExecuteAfmService.java:71)
	... 12 common frames omitted

I wasn't able to find any resource on this particular issue.
Any help is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions