JBPM : POST request for execute process go wrong - java

I am new to jBPM.
I reference jbpm.org for tutorial. And I tried "My First Business Application" example. It is OK.
And then I tried the next tutorial "Business Application with Business Asset". The first steps are going well. I successfully done installation of jBPM Console, drawing business process asset in KIE process and starting the application are going well.
And I tested according to reference. I got a problem for sending POST request to my application. I use Chrome Postman client for sending POST request.
In tutorial, they give the following link to make POST request.
http://localhost:8090/rest/server/containers/business-application-kjar/processes/business-application-kjar.process/instances
I do but I always get "415 Unsupported Media Type" in every time. I also research for error. I can't find anywhere.
Please help me.
I am trouble for continue the next examples.
I want to know is any way to continue or am I wrong in sending request.
Thanks.

415 - Unsupported Media Type error occurs when the request is in a format not supported by the server.
Add the following http header parameters to your request.
Accept: application/json
Content-type: application/json
X-KIE-ContentType: JSON

Related

Http 503 for some Rest api call

I am running an SpringBoot application and I have a controller which defines Rest Api and accepts a request by a list of ids. Normally it works fine but if number of ids gets bigger, then I receive http 503. Interesting thing is that I cannot see any logs that my request was received by controller as well. Therefore I am not able to understand what is happening. Do you have any idea what can be worth to check ?
503 is a error code, which means service or url or controller, that you are requested is not running/available, make sure your jar file is running and also make sure the url you requested is valid. since service is not available you cant see any logs or error messages. because your controller dint receive any request yet.
The 503 error indicate that the server is not ready to handle the request.
There are some limitations for transferring data through URL , basically the length of the URL
In general the limit was 2047 chars and it is different for different browsers
503 means Service Unavailable.
I think something is wrong with your request.
You can try to add a custom OncePerRequestFilter and log your HTTP Request.

CORS Restful Webservice getting blocked

Seems like there is a lot of CORS stuff on here. A million ways to handle it.
Converting over an app to Ionic. Because of WKWebView
This seems to run the code as local host on the ios. Which in tern means I need to handle CORS.
Followed this example.
https://amodernstory.com/2014/12/27/using-cors-headers-with-java-example/
At this point its just the web.xml has the CorsFilter setup. (defaults)
I thought I was going to have to do something in the code, but nothing I have added seems to make any difference.
What happens, is I login, and I trace that through and that seems to work fine.
Then the code pulls the users profile info. This is a seperate web service call.
That is getting blocked.
polyfills.js:3 POST [webserviceURL]/user/getUser 403 (Forbidden)
(index):1 Failed to load [webserviceURL]/user/getUser:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8100' is therefore not allowed access.
The response had HTTP status code 403.
The first call to login goes through. The second call never hits the web server.
Not sure why. Maybe I need to tell it to remember the Origin?
Try adding proxy URLs:
From Handling CORS issues in Ionic:
Set up your ionic.project file to be something like:
{
"name": "proxy-example",
"app_id": "",
"proxies": [
{
"path": "/api",
"proxyUrl": "http://cors.api.com/api"
}
]
}
You have to add following in your web services header:
Access-Control-Allow-Origin: http://localhost:8100
Also, You can use ionic native http plugin to resolve cors issue.
I have used this in our projects successfully to resolve cors issue.
Here is the link of this plugin: https://ionicframework.com/docs/native/http/

Blackboard Java Web Services error, using AXIS2 through SOAP - Security Header

I need to use Blackboard Web Services and I don't know how to establish a connection throught SOAP. I need something like Security Header. I read a lot, but always when I try to connect I get this kind of error.
I have a little big problem with this exception. Nothing is clear for me. I have nothing at the application log. I cannnot guess what should be the problem. I read also about AXIS2, Timestamps...
2016-03-08 20:53:58,739 ERROR edu.ku.it.si.registerproxytool.controller.RegisterToolController.registerProxyToolWithBlackboard:84 - There was an error in registering the tool: WSDoAllReceiver: Incoming message does not contain required Security header
Process finished with exit code 0
I'm looking to connect with a Blackboard web service through SOAP, and I can not send a correct Security Header
I read a lot about it, and finally I found this article. I'm using the project this guy post in the pdf. I have a Blackboard instance working at localhost on port 9876. I can do everything I want with it. It works fully.
I also tried to use SOAPui and I'm reaching a different error:
WSDoAllReceiver: security processing failed (actions mismatch)
I don't want to read more, I read more than 150 articles about it, and nothing.
Thanks :)
I have just started playing around with Blackboard web services, at the moment I am just accessing using SOAPui.
I am able to connect and send various functions, along the way I experienced the same error via SOAPui as you and so I found your question.
I overcame this error by doing the following:
Create a session using ContextWS.initialize, the username should be 'session' and the password 'nosession'. If successful this should return a token string.
Login using ContextWS.login. The username in the header should be 'session' and the password should be the token returned in 1. The userid and password in the body should be those of a user with sufficient web services permissions. If successful this should return 'true'.
Call whichever WS functions you wish. Always send the 'session' and token username and password in the header.
I found this here:
https://community.blackboard.com/docs/DOC-1116
I also found https://community.blackboard.com/thread/2147 and the linked youtube video useful to understand how to send the data correctly using SOAPui - you may need to change the wsdl url to https as SOAPui reverts it to a standard http. You also need to add a timestamp for every call.

Simulate form post using http client in Android app?

So, I'm currently developing an app for a service which has a json-based (unfortunately) read only API. Retrieving content is no problem at all, however the only way to post content is using a form on their site which location is a PHP script. The service is open source so I know which fields the form expects, but whatever I send, it always results in a BAD REQUEST.
I captured the network traffic inside my browser and as far as I can see, the browser constructs a multipart form request, however when I copy the request and invoke it again using a REST client, a BAD REQUEST gets returned.
Is there a way to construct a http request in Android that simulates a form post?
If it's readonly I think you wouldn't be able to make requests with POST (it's assume for editing or adding things).
If you let me make you an advise, I recommend you using this project as a Library.
https://github.com/matessoftwaresolutions/AndroidHttpRestService
It makes you easy deal with apis, control network problems etc.
You can find a sample of use there.
You only have to:
Build your URL
Tell the component to execute in POST mode
Build your JSON
As I told you, I don't know even if it will work.
I hope it helps!!!

How can I send a GWT-RPC request with HttpClient?

I am using the Apache HTTPClient API to send HTTPRequests, and so far it's worked with standard requests. Now I want to send a GWT-RPC request and show the response, but I always receive the following error from the GWT-RPC server:
//EX[2,1,"com.google.gwt.user.client.rpc.IncompatibleRemoteServiceException/3936916533","This application is out of date, please click the refresh button on your browser. ( Malformed or old RPC message received - expecting version 5 )"],0,5]
Actually, I have to send the following data with the request:
5|0|5|http://172.16.103.244:38081/kunagi/scrum.ScrumGwtApplication/|6E611C647A0C98D5A31A2506E16D81D6|scrum.client.ScrumService|startConversation|I|1|2|3|4|1|5|-1|
but I don't know how.
When I retrieve the request code from FireBug, I find the above data as a source in the post area.
Take a look at the gwt-syncproxy project. It does exactly what you are looking for, faking RCP calls from Java code. If you don't want to rely your project on gwt-syncproxy, you could look at it's implementation and find out how the create valid requests.

Categories

Resources