Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 81128

Raw response https instead of JSON

$
0
0

Hi all,

 

Trying to call a rest service sitting behind https.

When using something like Postman I can get the expected response: 

 

[
  {"code": "1","description": "Venter"
  },
  {"code": "2","description": "Camp Master"
  }
]

When I implement this in the modeler I get an error trying to process the response String into a mapping: 

com.mendix.modules.microflowengine.MicroflowException: org.codehaus.jackson.JsonParseException: Unexpected character ('M' (code 77)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.ByteArrayInputStream@44da5e49; line: 1, column: 2]
	at Trailer.IVK_CallWS_GetTrailerMakes (Import with mapping : 'Import from JSON')
	at Trailer.IVK_SyncTrailerMakes (SubMicroflow : 'IVK_CallWS_GetTrailerMakes')

Advanced stacktrace:
	at com.mendix.modules.microflowengine.MicroflowUtil.processException(MicroflowUtil.java:143)

Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: org.codehaus.jackson.JsonParseException: Unexpected character ('M' (code 77)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.ByteArrayInputStream@44da5e49; line: 1, column: 2]
	at com.mendix.integration.importer.json.JsonImporter$$anonfun$importStream$1$$anonfun$apply$1.apply(JsonImporter.scala:44)

Caused by: org.codehaus.jackson.JsonParseException: Unexpected character ('M' (code 77)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: java.io.ByteArrayInputStream@44da5e49; line: 1, column: 2]
	at org.codehaus.jackson.JsonParser._constructError(JsonParser.java:1433)
	at org.codehaus.jackson.impl.JsonParserMinimalBase._reportError(JsonParserMinimalBase.java:521)
	at org.codehaus.jackson.impl.JsonParserMinimalBase._reportUnexpectedChar(JsonParserMinimalBase.java:442)
	at org.codehaus.jackson.impl.Utf8StreamParser._handleUnexpectedValue(Utf8StreamParser.java:2090)
	at org.codehaus.jackson.impl.Utf8StreamParser._nextTokenNotInObject(Utf8StreamParser.java:606)
	at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:492)
	at com.mendix.integration.importer.json.JsonParser.nextToken(JsonParser.scala:27)
	at com.mendix.integration.importer.json.JsonStreamingHandler$$anonfun$parse$1.apply(JsonStreamingHandler.scala:33)
	at com.mendix.integration.importer.json.JsonStreamingHandler$$anonfun$parse$1.apply(JsonStreamingHandler.scala:32)
	at com.mendix.integration.util.InputStreamUtil$.using(InputStreamUtil.scala:36)
	at com.mendix.integration.importer.json.JsonStreamingHandler.parse(JsonStreamingHandler.scala:32)
	at com.mendix.integration.importer.json.JsonImporter$$anonfun$com$mendix$integration$importer$json$JsonImporter$$parse$1$$anonfun$apply$2.apply(JsonImporter.scala:52)
	at com.mendix.integration.importer.json.JsonImporter$$anonfun$com$mendix$integration$importer$json$JsonImporter$$parse$1$$anonfun$apply$2.apply(JsonImporter.scala:51)
	at com.mendix.integration.util.InputStreamUtil$.using(InputStreamUtil.scala:36)
	at com.mendix.integration.importer.json.JsonImporter$$anonfun$com$mendix$integration$importer$json$JsonImporter$$parse$1.apply(JsonImporter.scala:51)
	at com.mendix.integration.importer.json.JsonImporter$$anonfun$com$mendix$integration$importer$json$JsonImporter$$parse$1.apply(JsonImporter.scala:50)
	at com.mendix.integration.util.InputStreamUtil$.using(InputStreamUtil.scala:36)
	at com.mendix.integration.importer.json.JsonImporter.com$mendix$integration$importer$json$JsonImporter$$parse(JsonImporter.scala:50)
	at com.mendix.integration.importer.json.JsonImporter$$anonfun$1.apply(JsonImporter.scala:32)
	at com.mendix.integration.importer.json.JsonImporter$$anonfun$1.apply(JsonImporter.scala:32)
	at scala.util.Try$.apply(Try.scala:192)
	at com.mendix.integration.importer.json.JsonImporter.importStream(JsonImporter.scala:32)
	at com.mendix.integration.internal.InternalIntegrationImpl.importStream(InternalIntegrationImpl.scala:298)
	at com.mendix.integration.actions.microflow.ImportAction.execute(ImportAction.scala:48)
	at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)
	at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:192)
	at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:149)
	at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49)
	at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260)
	at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248)
	at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168)
	at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
	at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:172)
	at com.mendix.core.component.InternalCore.executeSync(InternalCore.java:496)
	at com.mendix.modules.microflowengine.actions.SubMicroflowAction.execute(SubMicroflowAction.scala:43)
	at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)
	at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:192)
	at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:149)
	at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49)
	at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260)
	at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248)
	at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168)
	at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
	at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:172)
	at com.mendix.core.component.InternalCore.execute(InternalCore.java:414)
	at com.mendix.webui.actions.client.ExecuteAction.execute(ExecuteAction.java:144)
	at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply$mcV$sp(ClientRequestHandler.scala:311)
	at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:301)
	at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:301)
	at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2$$anon$1.execute(ActionDispatching.scala:143)
	at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
	at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2.apply(ActionDispatching.scala:145)
	at scala.util.Try$.apply(Try.scala:192)
	at com.mendix.core.session.Worker$$anonfun$receive$3.applyOrElse(ActionDispatching.scala:139)
	at akka.actor.Actor$class.aroundReceive(Actor.scala:465)
	at com.mendix.core.session.Worker.aroundReceive(ActionDispatching.scala:135)
	at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
	at akka.actor.ActorCell.invoke(ActorCell.scala:487)
	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
	at akka.dispatch.Mailbox.run(Mailbox.scala:220)
	at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
	at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
	at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
	at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
	at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

When I debug and inspect the string response I see:

 

The response comes back raw and cant be process with a mapping. I have included the Content-Type : application/json header. Any ideas?

 


Viewing all articles
Browse latest Browse all 81128

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>