it seems that Java class is throwing the runtime excpetion,can you put try and catch in java class and log the exception.
Copy your java code and run it in eclipse to find the exact error with line#.
You need to use XMLSerializer and JSONSerializer classes.
Key point to remember will be:
- You are passing JSON string as input
- You need to parse this JSON string into JSON object first using JSONSerializer object
- JSON object will be assigned to XML string using XMLSerializer object
- In response of Java callout, you will receive XML string. So within proxy, you will have to use InlinedXML function to convert it into XML object.
In eclipse create maven project. you can use code and pom snippet from link mentioned below. Once you will build project in eclipse, it will download required and dependent jar files mentioned in below link. Now that code will work in your local machine. In order to put this code running in OSB server, eaisiest way which i think will be to copy those downloaded jar from your eclipse workspace into <Domain_Home>/lib directory of osb server. That is how imported class in java code will be made available at runtime to OSB. Then just import the java snippet jar from eclipse and import it in your osb project.
Hope this helps.
I think there is a unhandled null pointer exception. You could put exception handler for that and get stacktrace to get the exact location
Thank you all. I was able to resolve this by referring http://www.rubix.nl/blogs/converting-json-xml-osb-when-consuming-rest-service as the java code I was referring resembled the code from this link.
As mentioned in this link, some of the dependent jars had to be placed at $Domain/lib
Though the issue is resolved, still want to know how to determine which of the depending jars need to be placed at $Domain/lib. There are many dependent jars, but placing only few of them resolved the issue.
When you build maven project then it downloads any jar which are referred directly in POM and also the jars which are referred by classes within those jars.
When we say jars, then those are nothing but having specific java libraries. Eclipse workspace where you created project, was vanilla so it needed everything.
While when you talk about Oracle service bus then it already consist of many jars like oracle-common etc.. I don't remember exact name of the directory but i think it was in "<Server_Home>/bin/". You can search that by exploring installed directory of oracle service bus.
When server is started then all these classes are made available to weblogic server and that is how after that OSB understands if any of its unerlying code is referring to any of those classes. For this to happen, all it needs is those jars to be present in classpath whether it is <Domain_Home>/lib or <Server_Home>/bin or something else.
You need to have surface knowledge of typically what kind of jars are already present in weblogic server classpath by exploring file structure of your installed directory. Ofcourse it is huge so even if you do, it will be difficult to remember. So you can try by putting all the jars first then start removing generic ones and verify if it is working. If it is then that jar or advanced version of that jar wil already be present somewhere in classpath.
Hope this helps.