Cleint not receive response: “No handlers could be found for message type” - nservicebus

I have a .net core service that needs to send a request via nservicebus.
I resolve IMessageSession with DI and send a request like this:
var response = await messageSession.Request<CreateDeviceResponse>(request);
In the logs I see that another service received this request and send a reply:
The problem that I never receive a response.
Client receive such errors:
I know that such an issue can occur if the client and server endpoint names are same, but I checked and I use different names
asp net mvc 4.7.2

First of all, the message isn't lost, but in the error queue.
I suggest to follow the tutorial to understand how NServiceBus works and what you need to have in place where. The tutorials start here but an entire learning path starts here and it explains broader, including about general concepts and architecture.
Like #tchelidze mentions, you need to have an implementation of the IHandleMessages<CreateDeviceReponse> interface, like is outlined here in the tutorial. Also, it doesn't matter to which endpoint you send it to. EndpointA can send to both EndpointB and EndpointA. What you cannot do is have two endpoints with the same name. It's like having two computers with the same name called MachineA and then from MachineB try to access files on MachineA. Which of the two should MachineB connect to? There is something else called 'competing consumer pattern', but that's of later concerns ;-)
If you need more help, feel free to ask at https://discuss.particular.net/ where more NServiceBus community members are located, as well as engineers of NServiceBus itself.

For some reason, it helped to make a request inside a task:
Task.Run(async () => await messageSession.Request<CreateDeviceResponse>(request))
I still not understand what is the problem, but it works only with such implementation.
In .net core web API, it works even without Task.Run, so I believe it has something to do with the fact that I am making this request in asp net mvc 4.7.2

Related

SAP Cloud SDK JS receives empty data from Enterprise Messaging Queue

I have build a simple cloud-SDK based application for adding as a Webhook in Enterprise messaging queue to receive the events as soon as it gets inside the queue.
I have an OPTIONS and POST function. OPTIONS is for the handshake with the queue and it works.
Now, when there is message in the Queue, it hits my application with the POST block but the request body is coming as empty object.
I have tried the same from the postman, i'm able to receive the data in request body. Only from the Enterprise messaging queue, the data is empty.
In contrast, to verify this, I have used a Express based nodejs application, there i'm able to receive the data from the queue.
What am i missing in the Cloud-SDK based code ?
POST block, looks like this
#Post('ems-events')
receiveEmsEvents(#Body() requestBody: string, #Req() req:Request) {
Logger.log("Event Received with Data:");
Logger.log(requestBody);
Logger.log(req.body);
Logger.log("Log over--");
Logger.log(Object.keys(req));
return {};
}
The SAP Cloud SDK for JavaScript does not offer any support for Enterprise Messaging as of today. The code you're writing here is most likely Nest.js code, which is an independent framework.
That being said, Nest.js does run Express.js under the hood by default. So if you've been able to make it work in Express, you should be able to make it work in Nest.

FLOWABLE: Authenticating flowable-task from another application via rest call

So, I am creating an application which will be using flowable.
We can say that once my application starts, it's gonna start a particular process deployed on flowable, proceed ahead accordingly.
So, in a way there will be lot of talking between flowable and other application, but for now suppose I just want to call flowable applications from POSTMAN (outside FLOWABLE).
I have used 3 modules: flowable-idm, flowable-modeler, flowable-task in my application.
Everything works fine when I am starting my deployed process from UI of flowable task, problems come when I want to start the processInstance using REST endpoint.
In flowable-task application, there is already a REST endpoint to start the process deployed: http://localhost:8080/flowable-task/app/rest/process-instances.
Now, if I call this from Swagger of flowable-task application, it works fine.
But it doesn't work when I try to call it from another application or POSTMAN for now (once POSTMAN call works, I can make the same arrangement in code), where I'm doing a basic auth and providing what's required in body.
Also, there is no error or exception displayed on console, I believe that is because of something catching that error or exception and not displaying anything.
However, to overcome the problem of starting process from POSTMAN, I can use REST endpoint http://localhost:9999/flowable-task/process-api/runtime/process-instances, but this is just a workaround, in future if I create new endpoints I would have to figure out a way to call those endpoints.
I saw this post and I guess this guy was also trying to achieve something similar but for flowable-modeler.
It's been suggested to make changes in SecurityConfiguration.java of flowable-task-conf module for my case, but I haven't done such changes before so not exactly sure where to start and how to proceed.
So, my question is how to talk to flowable-applications from outside flowable applications.
Edit:
Forum post about getting exception when imported flowable-rest module in workspace
The flowable-task UI Application is an example application that exposes non public REST API for the UI. However, the application also exposes the full REST API of Flowable.
There is also the flowable-rest application that has the Swagger doc and exposes the full REST API without a UI.
You would want to communicate with those REST endpoints.
The endpoints are under the following contexts:
process-api for the Process Engine
cmmn-api for the CMMN Engine
dmn-api for the DMN Engine
idm-api for the IDM Engine
form-api for the Form Engine
content-api for the Content Engine
For your example you would need to use POST to /process-api/runtime/process-instances for Starting a Process Instance

Silverlight ClientHttp Stack / windows authentication / and RIA services issue (I'm guessing it's a cookie thing)

I was investigating how to get status code 500 error messages to give me more information when these occur and happened upon the MSDN post about using the ClientHttp stack.. Which was all just so magical seeming until the application got deployed on the staging servers and it seems to completely fail now with authentication
I'm guessing this is due to the whole cookie issue as it relates to the ClientHttp stack...
I'm using RIA services and when the application starts it runs 3 or 4 RIA WCF service calls preloading data in the background and now with the new ClientHttpStack an authentication dialog pops up pretty much every single time a request is made. We're using Windows Authentication so before it would just make you authenticate in order to access the page serving the XAP file... But now you login with Win Auth and then all the subsequent calls repetitively ask for your credentials...
I'm assuming the only way I can fix this is by doing this
http://msdn.microsoft.com/en-us/library/dd920298(v=vs.95).aspx
And then possibly adding an endpoint behavior onto the DomainClient so that before requests are handled it tacks on the cookies...
I've tried doing this for a bit now and I'm not really succeeding... When I run the app in FF or Chrome it still pops up with a whole bunch of login boxes. So I'm just curious if I'm barking up the wrong tree or if I should continue trying to figure out where I'm not quite propagating the cookies through
If you are using the ClientHttp stack, you'll need a place to store your cookie client side, said a HttpCookieContainer. It's just a wcf behaviour to be inserted in the ClientHttp stack. Please, have a look at this post from Kile McClellan and see if it helps you.

REST API Works in Browser, But Not Client

I am developing a REST API, and have found a very interesting problem.
When I access the resources in a web browser (in my case Chrome), everything works fine. However, when I access the resources using a REST client (Google Chrome plugin, web-based client, and a Java applet), NONE of the variables pass to the API. This happens both with GET and POST methods.
I have absolutely no idea why this would be the case, and it's proving very difficult to test the methods before putting them into production (especially with POST methods).
Please help!
At first glance it sounds it could be 2 things:
You are not correctly passing API parameters via your client or
applet
A problem with authentication or cookie management. Does the API require any type of authorization?
Are you forgetting to set a necessary HTTP header?
Do you have control of the API also or is it a third party API? If so, do the params arrive at all or do they arrive empty? What's the error code? - a 403 not authorized (which would make sense if the key doesn't pass) or something else due to missing params.
Try the intermediate step of doing it with CURL form the command line - that'll give you more detail on what's coming back.

I need a simple web server with a console

My problem is I am adding an Ajax client to an existing RPC web service. i have a PHP client that talks to it, a java jibx.POX client that talks to it, a pure java http client that i wrote that talks to it, everything. but when i try to put my jquery ajax client im working on at it, the server sees the connection, but doesn't receive any data. same on the response, the service sends its error response xml and the ajax client says nothing came back.
what i need to debug this is a simple web server. i want something that is a stand alone program. where i can enter a port number and a start button. point my ajax interface to it, and it displays in a text area all the information possible on the request. then i can point one of my other interfaces to the same port and compare the two and hopefully figure out why 4 interfaces work and 1 doesn't.
does that exist out there somewhere? maybe in one of your arsenals somewhere.
OOPS, never mind, i found one. TCPMon, its a java system a friend of mine emailed me a while ago. does exactly this.
thanks