Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.6
-
None
-
Unknown
Description
I want to expose some existed class as webservice use below logic:
1. Define the SEI as below:
@javax.jws.WebService
public interface AddNumbersInterface extends IrisSuperInterface{
}
2. Define the implementation as below:
@javax.jws.WebService (serviceName="AddNumbers")
public class AddNumbers extends AddNumbersBusiness implements AddNumbersInterface{
}
3. Below the original business logic class:
public class AddNumbersBusiness implements IrisSuperInterface{
public String addNumbers(int arg0, int arg1) throws AddNumbersException {
if(arg0 + arg1 <0)
return "Result = " + String.valueOf(arg0 + arg1);
}
public String addNegatives(int arg0, int arg1) throws AddNegativesException {
// expect 2 negative numbers
if(arg0>0 || arg1>0)
return "Result = " + String.valueOf(arg0 + arg1);
}
public String useAnno(int arg0, int arg1) throws AnnoException {
if(arg0 + arg1 <0)
return "Result = " + String.valueOf(arg0 + arg1);
}
}
4. Below is the original business interface:
public interface IrisSuperInterface {
public String addNumbers(int arg0, int arg1) throws AddNumbersException;
public String addNegatives(int arg0, int arg1) throws AddNegativesException;
public String useAnno(int arg0, int arg1) throws AnnoException;
}
Now if I deploy below ear into server and the generated wsdl is like below:
<wsdl:definitions name="AddNumbers" targetNamespace="xxxxxxxx">
<wsdl:portType name="AddNumbersInterface">
</wsdl:portType>
<wsdl:binding name="AddNumbersSoapBinding" type="tns:AddNumbersInterface"><soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
</wsdl:binding>
<wsdl:service name="AddNumbers">
<wsdl:port binding="tns:AddNumbersSoapBinding" name="AddNumbersPort"><soap:address location="http://xxxxxxxxxx/AddNumbers"/></wsdl:port>
</wsdl:service>
</wsdl:definitions>
The portType part is empty. I have a look into CXF and found :org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.isWebMethod(Method)
will check whether the super interface has @webservice annotation defined. so in our case it fails.
According to :
3.4.1 Inheritance
WSDL 1.1 does not define a standard representation for the inheritance of wsdl:portType elements.
When mapping an SEI that inherits from another interface, the SEI is treated as if all methods of the inherited
interface were defined within the SEI.
we should not check the @webservice annotation in SEI's super interface.
I propsed to add below lines into org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.isWebMethod(Method), do you have any comments for it?
Class<?> cls = method.getDeclaringClass();
if (cls.isInterface() && ( cls.isAssignableFrom(implInfo.getImplementorClass()) || cls.isAssignableFrom(implInfo.getSEIClass())))
Thanks a lot!
Attachments
Attachments
Issue Links
- is duplicated by
-
CXF-4779 Java First Web Service broken when SEI extends from another interface
- Closed