Skip to main content

We have created a Swagger (file attached) Rest Service instance with Smart Objects, however on a view when running Serialize then GetData method the HTTP response code this is coming back as error 415.

 

In the service instance I have now added in the default HTTP response headers the below so this knows that this is JSON:

 

{"$type": "SourceCode.SmartObjects.Services.Endpoints.Common.HttpHeadere], SourceCode.SmartObjects.Services.Endpoints.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null", "$values": : { "$type": "SourceCode.SmartObjects.Services.Endpoints.Common.HttpHeader, SourceCode.SmartObjects.Services.Endpoints.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null", "Name": "Accept", "Value": "application/json" }, {"$type": "SourceCode.SmartObjects.Services.Endpoints.Common.HttpHeader, SourceCode.SmartObjects.Services.Endpoints.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null","Name": "Content-Type","Value": "application/json"} ]}

 

However this then brings back error 500 and on the Endpoint this is passing an empty value.

 

I have looked over the guides and searched the forum however I am just looking for something basic as a starting point before building out from there.

Hi,



 



A 500 error is an internal server error so this may be something in you REST service that is failing. Incorrect input format or something of that nature. Worth checking the logs to see if there is anything there that can point you in the right direction. Also worth checking the K2 logs.



 



is this API something you are writing yourself or something pre-existing that you want to consume? If you are writing it yourself what language are you using?



 



Tools like editor.swagger.io are great for visualising your REST service. You can paste the JSON straight into there and it will show you if you have any issues.


Hi NicS,



 



This API is just a test setup on our internal only Mulesoft platform as a proof of concept to get it working before this is expanded onto live data.



Everything is setup to use the JSON language.



 



I have checked on editor.swagger.io and the removed the examples as this was flagging an error regarding this should not have additional properties. I have corrected this however this is still the same error response codes when trying to process in K2.



 



Mulesoft states "unable to parse empty input", this is because it is expecting an employee name to specified which is being sent in in the serialized string 



{"$type":"Stevo_TestREST.k2RESTidentifier_InboundGetDataSchema, Stevo_TestREST, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null","employeeName":"Martin Dunn"}



 



Is there a specific location I should be looking for the logs as there is nothing related to this in C:Program FilesK2Host ServerBin?



 



Thanks.


The 500 is usually a response from the server and usually there isn't much detail, so there may be logging on mulesoft side regarding why it is returning 500.





Another possible mean of debugging, is to install fiddler on the k2 server, and configure k2 to go through the fiddler proxy as per:



https://community.nintex.com/t5/Nintex-K2-Five/Using-Fiddler-to-capture-K2-Host-Server-requests/ta-p/123761





You may also need the following for it to work:



https://community.nintex.com/t5/Nintex-K2-Five/Cannot-setup-Fiddler-as-HostServer-Proxy-on-K2-Five-5-3-due-to/ta-p/126245





But if you are able to get this to work, you can see the outgoing request from K2 so you can inspect the header and body to see if it is correct.





Then you can install something like Postman on the K2 server and see if you can make the same request through Postman and compare the request from Postman vs K2.




Reply