Peter Palaga created CXF-8834:
---------------------------------

             Summary: "Operation [{.../wsdl}Issue] already exists" when calling 
JaxWsServerFactoryBean.create() for SecurityTokenService
                 Key: CXF-8834
                 URL: https://issues.apache.org/jira/browse/CXF-8834
             Project: CXF
          Issue Type: Bug
          Components: STS
    Affects Versions: 4.0.0
            Reporter: Peter Palaga


In quarkus-cxf, we are executing the following snippet

{code}
JaxWsServerFactoryBean factoryBean = new JaxWsServerFactoryBean();
factoryBean.setServiceClass(Thread.currentThread().getContextClassLoader().loadClass(sei));
factoryBean.setAddress(path);
Server server = factoryBean.create();
{code}

for all service interfaces available in the class path of an application. We do 
it at build time, for the sake of generating all necessary ancillary classes. 

When doing this for 
{{org.apache.cxf.ws.security.sts.provider.SecurityTokenService}}, the following 
exception is thrown: 

{code}
java.lang.IllegalArgumentException: An operation with name 
[{http://docs.oasis-open.org/ws-sx/ws-trust/200512/wsdl}Issue] already exists 
in this service
        at 
org.apache.cxf.service.model.InterfaceInfo.addOperation(InterfaceInfo.java:78)
        at 
org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.createOperation(ReflectionServiceFactoryBean.java:1008)
        at 
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.createOperation(JaxWsServiceFactoryBean.java:631)
        at 
org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.createInterface(ReflectionServiceFactoryBean.java:1000)
        at 
org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:460)
        at 
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:693)
        at 
org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:529)
        at 
org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:262)
        at 
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199)
        at 
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103)
        at 
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168)
        at 
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:210)
        at 
io.quarkiverse.cxf.deployment.CxfDeploymentUtils.createServer(CxfDeploymentUtils.java:42)
        at 
io.quarkiverse.cxf.deployment.QuarkusCxfProcessor.lambda$generateClasses$2(QuarkusCxfProcessor.java:213)
...
{code}

This is caused by the fact that there are two methods annotated with 
{{@WebMethod(operationName = "Issue")}} in 
{{org.apache.cxf.ws.security.sts.provider.SecurityTokenService}}:

{code}
    @WebResult(name = "RequestSecurityTokenResponseCollection",
               targetNamespace = 
"http://docs.oasis-open.org/ws-sx/ws-trust/200512";,
               partName = "responseCollection")
    @Action(input = 
"http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue";,
            output = 
"http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTRC/IssueFinal";)
    @WebMethod(operationName = "Issue")
    RequestSecurityTokenResponseCollectionType issue(
        @WebParam(partName = "request",
                  name = "RequestSecurityToken",
                  targetNamespace = 
"http://docs.oasis-open.org/ws-sx/ws-trust/200512";)
        RequestSecurityTokenType request
    );

    @WebResult(name = "RequestSecurityTokenResponse",
              targetNamespace = 
"http://docs.oasis-open.org/ws-sx/ws-trust/200512";,
              partName = "response")
    @Action(input = 
"http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue";,
            output = 
"http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTRC/IssueFinal";)
    @WebMethod(operationName = "Issue")
    RequestSecurityTokenResponseType issueSingle(
        @WebParam(partName = "request",
                  name = "RequestSecurityToken",
                  targetNamespace = 
"http://docs.oasis-open.org/ws-sx/ws-trust/200512";)
        RequestSecurityTokenType request
    );
{code}

I wonder whether one of the operationNames in SecurityTokenService needs to be 
changed?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to