For persistence layer I'm using JPA entity with two Named Queries - Countries.findAll and Countries.findByName. When creating EJB Session Bean, Web Service Endpoint Interface is declared in the same way as in JDeveloper 10.1.3:
Generated interface for EJB Session Bean contains @WebService annotation, that in fact allows to use EJB Session Bean as Web Service directly:
Developed application structure in Application navigator window:
Oracle JDeveloper 11g provides embedded tool, that allows to test developed Web Service without deploying it to the server - just right click on EJB Session Bean and select - Test Web Service:
HTTP Analyzer window will be opened, where you can choose available operations to test, provide values for parameters and browse through generated result. Four views are provided - SOAP structure, HTTP Content, Hex Content and Raw Message. In our case, queryCountriesFindAll() generates similar result:
And, for queryCountriesByName(parameter) only result that is correct for specified parameter is shown:
6 comments:
Hi Andre,
I was trying to use your example on my local database with the same schema.
I created a "New" db connection called HR under Application Resources sub-tab.
How do i attach this to project, be'coz running as is i get an error:
Internal Exception: java.sql.SQLException: ORA-01005: null password given; logon denied
Error Code: 1005
Any help would be appreciated.
Hi,
If you right click on Model project and choose Project Properties, you will see in EJB Module section that jdbc/HrDS data-source is used by application.
You can define data-source in Tools -> Embedded OC4J Server Preferences -> Current Workspace -> Data Sources.
Regards,
Andrejus
Thanks for the solution. It worked for me in embedded as well as in standalone OC4J servers.
One problem I face is the repeater tags in Response of this WebService are return..return.
In an application I am trying to retrieve data from this WebService, the word return is a reserved word and so cannot be used.
Is there a way that this repeater tag can be changed as myreturn..myreturn
Thanks in advance.
Hi,
Not sure about this.
Regards,
Andrejus
Found the solution:
At the Method level (wherever your @WebService annotation is) if you use the annotation @WebResult(name = "myreturn"), then I was able to change the repeater tags to myreturn.
Thanks for posting solution Sanjay.
Regards,
Andrejus
Post a Comment