Introducing the all-new TIBCO Community site!

For current users, please click "Sign In" to reset your password and access the enhanced features. If you're a first-time visitor, we extend a warm welcome—click "Sign Up" to become a part of the TIBCO Community!

If you're seeking alternative community sites, explore ibi, Jaspersoft, and Spotfire.

Jump to content

Unclear error while running REST service in BW6 (java.


Manoj Chaurasia

Recommended Posts

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.

Link to comment
Share on other sites

  • 2 months later...

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 ("

Link to comment
Share on other sites

  • 8 months later...

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.

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 3 years later...
×
×
  • Create New...