Tuesday, June 21, 2011

Top down web service and faults in RAD 8

If you create a topdown web service in RAD 8, using a WSDL you created in RAD with the WSDL wizard and the WSDL editor, java exceptions are not created or generated for the web service faults you added.

The reason for this is that the editor does not add a wsdl:fault to the binding section, when you add a fault to the portType. When you add the wsdl fault manually, the Java Exception will be generated.

I will demonstrate in detail what happens:

In RAD, create a new web project. Create a new WSDL file using the wizard in your project.


With the following options


A WSDL file with skeleton is created. When you open this file using the WSDL editor, it will look like this:


You can right click the operation name to add a fault:


NewOperation now has a fault:


Now we will create a java topdown web service using this wsdl. Right click your WSDL file and choose Generate Java Bean Skeleton:


The Web Service wizard will appear, no special options are selected:


We finish the wizard, and our Java implementation is generated. What do we see? The generated Java implementation has no Exception in its signature!


Now what is missing? The WSDL editor did not add the WSDL fault to the binding. You have to put that in place manually to make the exceptions work.


When we generate the Java Bean Skeleton again, the Exception is present in the signature

No comments:

Post a Comment