Manoj Chaurasia Posted December 5, 2014 Posted December 5, 2014 Unclear error while running REST service in BW6 (java.lang.IllegalArgumentException) I've built a simple REST Resource in BW6. The GET method does nothing more than call a REST service, parse the returned JSON to XML and then return a value from that result set. When I debug and test the process, I get the following error: 11:48:10.095 ERROR [bwEngThread:In-Memory Process Worker-2] com.tibco.bw.core - TIBCO-BW-CORE-500050: The BW process [com.example.tibco.demo.sharepoint.module.Sharepoint] instance faulted, JobId [bw0a100], ProcessInstanceId [bw0a100], ParentProcessInstanceId [-], Module [com.example.tibco.demo.sharepoint.module:1.0.0.qualifier], Application [com.example.tibco.demo.sharepoint:1.0]. TIBCO-BW-CORE-500051: Activity [invokeRESTAPI] fault. com.tibco.bw.runtime.ActivityFault: null-{ActivityName=InvokeRESTAPI, ProcessName=com.example.tibco.demo.sharepoint.module.Sharepoint, ModuleName=com.example.tibco.demo.sharepoint.module} java.lang.IllegalArgumentException: mediaType, language, encoding all null Anyone have a clue what is causing this Thanks.
Manoj Chaurasia Posted February 5, 2015 Author Posted February 5, 2015 Hi Aditya , Apologies, been working on other projects for a while. Please also note, using my original acccount. I think some background on the call I'm doing is useful here. I am trying to make a call to a Sharepoint site. In order to be able to update a list on Sharepoint, I first need to get a token (called DigestValue) but making a "contextinfo" call to the Sharepoint site. The call is pretty straightforward: http:///site/_api/contextInfo. It has no input and returns something like this: 1800 0x088D1DE63D7D8098338EE7C23619F3B14F1D7A6CA4BB6E7065017A25FE9686E7CBD3D82EC42F19AB289F44B1F3BD5226C5DB903F338388DC9348E1475DCE24E1,04 Feb 2015 14:19:50 -0000 15.0.4641.1000 http://www.example.com 14.0.0.0 15.0.0.0 http://www.example.com/site However, the catch is that the call must be done using POST method, eventhough no input is required (you'd expect GET). This is the reason why I am doing a POST without input (body). In the meantime, I have tried some of your suggestions. I have tried filling the ContentType header, but no difference. Then I tried putting some dummy text in the asciiContent of the InvokeRESTAPI activity mapping. This got me a bit further, but now I'm getting the following: TIBCO-BW-PALETTE-REST-2000027: Client received a 4xx response for invocation at resource path http://www.example.com:80/tibco/_api/contextinfo-{ActivityName=InvokeRESTAPI, ProcessName=demolist.demolist, ModuleName=DemoList} I traced the call in Wireshark and found it's now giving back a 400 Bad Request, so I wander if this is caused by the asciiContent I don't suspect so, because when I do the same call in Postman (with 'none' body) the call still works fine. I'm also worried that the port is in the resource path ("
Aditya Wagle Posted October 24, 2015 Posted October 24, 2015 It looks like the mediaType is null so the parser cannot parse the message body. Can you confirm the REST service can be invoked outside BW successfully It would help if you could upload the project.
Manoj Chaurasia Posted October 24, 2015 Author Posted October 24, 2015 What I don't understand is where I need to fill these values. The REST service I am invoking is a Sharepoint OData service and works fine outside of BW. Also, I don't think the issue is in the service being called because as far as I can tell (using Wireshark) the call never leaves BW, so the error occurs before the outgoing call is made. Most likely I've forgotten some configuration somewhere, but I'm not seeing it. Unfortunately, I can't attach the project due to company export policy, but if anyone could give me an example of a working REST call, that would help. Thanks.
Aditya Wagle Posted October 24, 2015 Posted October 24, 2015 If you can provide just how you invoke the REST Service outside BW, I can help you out. Can you also run the the engine in Debug mode It would give a proper stack trace which will give us some more insight into the issue. You can turn on debug by going to the Advanced tab of the launch configuration and using the logback_leveldebug.xml file as the logging configuration file.
Manoj Chaurasia Posted October 24, 2015 Author Posted October 24, 2015 Hi Aditya, I've attached screenshots of my Invoke REST call and the HTTPResource used. I tried the extra debug logging, I've attached that as text file. This is the logging of exactly one attempt to make the call. I'm posting it here for now, but haven't finished digging through it yet.
Aditya Wagle Posted October 24, 2015 Posted October 24, 2015 Hi Bas, Based on what I see, the config is set as custom for Request Type. Which means the Content-Type header in the Input tab has to be set. If you have set the Content-Type Header you message body needs to be added in the asciiContent in the Input tab. Now what I also see that you have the HTTP Method as GET. In this case you can leave the Request Type to JSON which is the default since there is supposed to be no message body. However from the trace I see that the code executed is for POST. Do you have both POST and GET methods Can you try populating the asciiContent and the ContentType header in the Input tab for the POST method
Aditya Wagle Posted October 24, 2015 Posted October 24, 2015 Hi Bas, Firstly apologies I couldn't reply earlier. If you are worried about the hardcoding of application/json, set the Request Type on the General tab of the REST Invoke to CUSTOM and then specify text/plain as the content-type header. The content-type header is only read when the Request Type is set to Custom. Can you please try this out
AparnaVelagapudi - Posted July 18, 2019 Posted July 18, 2019 <CausedBy> java.lang.IllegalArgumentException: mediaType, language, encoding all null Is this resolved please Can you guide me on the solution
AparnaVelagapudi - Posted July 18, 2019 Posted July 18, 2019 Im facing the same issue . Any solution please
Hitesh Nembhwani Posted July 25, 2019 Posted July 25, 2019 Try this: Add an empty string ('') into AsciiContent field in the Input tab of the Invoke REST API activity and retry the scenario.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now