Could the web service generated with `java2wsdl` include API from more than one Java class?

前端 未结 2 1691
天命终不由人
天命终不由人 2021-01-15 14:13

I am using Axis2 to run a web service. Here is a services.xml file that defines a service:



        
2条回答
  •  野的像风
    2021-01-15 14:37

    No, this is not possible as Axis2 generation tool maps Java class : WSDL as 1:1 in a code-first approach. Hypothetically, they could have provided feature to map multiple Java classes to a single WSDL (that would require additional parameters in generation tool).

    Axis2 uses 'extra classes' for additional types - subclasses of original complex types used as input/output.

    If neat and compact code is the only issue, I would suggest refactoring it the way that only one single class defines all the required operations, but delegates execution to specific & appropriate (multiple) classes. This can be considered as an application of a Façade pattern.

提交回复
热议问题