We published some service last year using C# and WCF.

Now we are porting code into java and we need to keep wsdl compatibility. 

Some one gave me wsdl generated from C# code.

It looked real ugly. Each method was throwing its own version of same exception.

I used CXF wsdl2Java to general my code and I see 10s of exception representing 
same exceptiong.

For e.g Look at function definition generated via CXF wsdl2java

 public ComputerInfo getComputers(

  @WebParam(name = "groupId", targetNamespace = "XXX")Integer groupId,
  @WebParam(name = "onlyActiveComputers", targetNamespace = "XXX") Boolean 
onlyActiveComputers,
  @WebParam(name = "minComputerId", targetNamespace = "XXX")Integer 
minComputerId,
  @WebParam(name = "maxResults", targetNamespace = "XXX")Integer maxResults
    ) 
throws GetComputersObjectNotFoundFaultFaultFaultMessage,
           GetComputersInvalidDataFaultFaultFaultMessage, 
          GetComputersGeneralFaultFaultFaultMessage, 
          GetComputersDataAccessFaultFaultFaultMessage;

I should have only four exception classes (ObjectNotFoundFault, 
InvalidDataFault, GeneralFault, DataAccessFault)  but there are 100 opeartions 
in wsdl and each of them throw those same 4 exceptions but generated code has 
100 * 4 = 400 exception classes :-(. Each exception has prefixed method name + 
exception name + FaultFaultMessage"

We should have never publised such ugly wsdl but now nothing can't be done. Is 
there any to consoliodate those 400 exceptions into 4 same exception classes 
when I am generating code via CXF wsdl2java.

Any help would be really appreciated.

Thanks,





      

Reply via email to