Wednesday, January 23, 2008

Creating a New Weblogic Service Cheatsheet

This is fairly implementation specific and needs more work but it gives a general idea of the steps needed to create a new webservice.

1. Create WSDL/Schema
2. Run scomp to generate XMLBeans jar and copy to project path
3. Copy types.xml from other service and edit (or generate using autotypes)
4. Run ant targets:
wsdl2service
clientgen

For info see:
http://e-docs.bea.com/wls/docs81/webserv/anttasks.html

5. Edit build.xml and run local build
6. Create test page HTML and JSP
7. Update properties file for WSDL URL (idMgmt.properties)
8. Build XML
1. Add jar to compile
2. Add war target
3. Add war to ear build
9. Add to application.xml
10. Add to config.xml

Debugging:

11. From wsdl: “Message” node attribute “type” must correspond to “types.xml”//”type-mapping”//”type-mapping entry” attribute “Type”.
12. XMLNS:xx in type-mapping-entry must correspond to wsdl->scheme::Target Namespace.

Monday, January 14, 2008

Customizing JUnit Logging

//create a console logger
Logger consLogger = Logger.getLogger(UpdateGPBenefitEligCommand.class);
Appender myAppender = new ConsoleAppender(new SimpleLayout());
consLogger.addAppender(myAppender);

//now you can pass this logger into a class
MyClass myClass = new MyClass();
myClass.setLogger(consLogger);

Obviously the class must have a setLogger method and the logger definition in the class cannot be "final". Now you could be using debugging and breakpoints instead but sometimes logging is easier and it's already there you just need to make it more accessible for testing.