Deunz
Deunz

Reputation: 1941

CXF : No method was found for the WSDL operation

I have been struggling with this for 2 days now so I must ask for help.

I have a multifaced Maven project using Spring.

GesAction
-ihm
-metier
-dao
-entite
-ws

The whole project compile, no problem with mvn:install.

The problem lies in the ws module : I may have a problem with CXF configuration : When I deploy the module on my tomcat (v7) I have these warning for each operations on my WSDL :

déc. 29, 2015 10:02:56 AM org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean initializeWSDLOperations
AVERTISSEMENT: No method was found for the WSDL operation {http://ws.gesaction.interiale.fr}Authentification.

But of course these operations are included in the WSDL... It drives me mad.

Here are the configuration files:

ws-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:context="http://www.springframework.org/schema/context" 
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans  
        http://www.springframework.org/schema/beans/spring-beans-4.1.xsd       
        http://www.springframework.org/schema/context       
        http://www.springframework.org/schema/context/spring-context-4.1.xsd   ">

    <context:component-scan base-package="fr.interiale.gesaction.ws.impl"/>
    <context:annotation-config />  
    <import resource="classpath:metier-context.xml"/>  
    <import resource="cxf-context.xml" />

</beans>

the cxf-context.xml :

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:jaxws="http://cxf.apache.org/jaxws"
    xmlns:soap="http://cxf.apache.org/bindings/soap" 
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-4.1.xsd 
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-4.1.xsd 
        http://cxf.apache.org/bindings/soap 
        http://cxf.apache.org/schemas/configuration/soap.xsd 
        http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

<!--    <bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor"/> -->

    <jaxws:endpoint 
        id="interialActionSocialAuthentification" 
        implementor="fr.interiale.gesaction.ws.InterialActionSocialAuthentification"
        endpointName="tns:InterialActionSocialAuthentificationPort"
        serviceName="tns:InterialActionSocialAuthentificationService" 
        address="/InterialActionSocialAuthentificationPort"
        xmlns:tns="http://ws.gesaction.interiale.fr"
        wsdlLocation="wsdl/interialactionsocialauthentification.wsdl">
    </jaxws:endpoint>

</beans>

And now the WSDL :

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions 
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://ws.gesaction.interiale.fr" 
    name="interialactionsocialauthentification"
    targetNamespace="http://ws.gesaction.interiale.fr" 
    >

    <wsdl:types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema">
            <import namespace="http://ws.gesaction.interiale.fr" schemaLocation="interialactionsocialauthentification_schema1.xsd" />
        </schema>
    </wsdl:types>


    <wsdl:message name="Authentification">
        <wsdl:part name="parameters" element="tns:Authentification"></wsdl:part>
    </wsdl:message>
    <wsdl:message name="AuthentificationResponse">
        <wsdl:part name="parameters" element="tns:AuthentificationResponse"></wsdl:part>
    </wsdl:message>

    <wsdl:message name="remiseANullTokenResponse">
        <wsdl:part name="parameters" element="tns:remiseANullTokenResponse">
        </wsdl:part>
    </wsdl:message>
    <wsdl:message name="remiseANullToken">
        <wsdl:part name="parameters" element="tns:remiseANullToken">
        </wsdl:part>
    </wsdl:message>
    <wsdl:message name="AuthentificationParTokenResponse">
        <wsdl:part name="parameters" element="tns:AuthentificationParTokenResponse">
        </wsdl:part>
    </wsdl:message>
    <wsdl:message name="AuthentificationParToken">
        <wsdl:part name="parameters" element="tns:AuthentificationParToken">
        </wsdl:part>
    </wsdl:message>
    <wsdl:message name="Exception">
        <wsdl:part name="Exception" element="tns:Exception">
        </wsdl:part>
    </wsdl:message>

    <wsdl:portType name="InterialActionSocialAuthentification">

        <wsdl:operation name="Authentification">
            <wsdl:input name="Authentification" message="tns:Authentification"></wsdl:input>
            <wsdl:output name="AuthentificationResponse" message="tns:AuthentificationResponse"></wsdl:output>
            <wsdl:fault name="Exception" message="tns:Exception"></wsdl:fault>
        </wsdl:operation>

        <wsdl:operation name="remiseANullToken">
            <wsdl:input name="remiseANullToken" message="tns:remiseANullToken">
            </wsdl:input>
            <wsdl:output name="remiseANullTokenResponse" message="tns:remiseANullTokenResponse">
            </wsdl:output>
            <wsdl:fault name="Exception" message="tns:Exception">
            </wsdl:fault>
        </wsdl:operation>
        <wsdl:operation name="AuthentificationParToken">
            <wsdl:input name="AuthentificationParToken" message="tns:AuthentificationParToken">
            </wsdl:input>
            <wsdl:output name="AuthentificationParTokenResponse"
                message="tns:AuthentificationParTokenResponse">
            </wsdl:output>
            <wsdl:fault name="Exception" message="tns:Exception">
            </wsdl:fault>
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="InterialActionSocialAuthentificationServiceSoapBinding"
        type="tns:InterialActionSocialAuthentification">
        <soap:binding style="document"
            transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="Authentification">
            <soap:operation soapAction="" style="document" />
            <wsdl:input name="Authentification">
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output name="AuthentificationResponse">
                <soap:body use="literal" />
            </wsdl:output>
            <wsdl:fault name="Exception">
                <soap:fault name="Exception" use="literal" />
            </wsdl:fault>
        </wsdl:operation>
        <wsdl:operation name="AuthentificationParToken">
            <soap:operation soapAction="" style="document" />
            <wsdl:input name="AuthentificationParToken">
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output name="AuthentificationParTokenResponse">
                <soap:body use="literal" />
            </wsdl:output>
            <wsdl:fault name="Exception">
                <soap:fault name="Exception" use="literal" />
            </wsdl:fault>
        </wsdl:operation>
        <wsdl:operation name="remiseANullToken">
            <soap:operation soapAction="" style="document" />
            <wsdl:input name="remiseANullToken">
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output name="remiseANullTokenResponse">
                <soap:body use="literal" />
            </wsdl:output>
            <wsdl:fault name="Exception">
                <soap:fault name="Exception" use="literal" />
            </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="InterialActionSocialAuthentificationService">
        <wsdl:port name="InterialActionSocialAuthentificationPort"
            binding="tns:InterialActionSocialAuthentificationServiceSoapBinding">
            <soap:address location="http://localhost:8080/gesAction-ws" />
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>

The XSD refered in the WSDL:

<xs:schema 
    xmlns:tns="http://ws.gesaction.interiale.fr" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    attributeFormDefault="unqualified" 
    elementFormDefault="unqualified" 
    targetNamespace="http://ws.gesaction.interiale.fr">

  <xs:element name="Authentification" type="tns:Authentification"/>
  <xs:element name="AuthentificationParToken" type="tns:AuthentificationParToken"/>
  <xs:element name="AuthentificationParTokenResponse" type="tns:AuthentificationParTokenResponse"/>
  <xs:element name="AuthentificationResponse" type="tns:AuthentificationResponse"/>
  <xs:element name="remiseANullToken" type="tns:remiseANullToken"/>
  <xs:element name="remiseANullTokenResponse" type="tns:remiseANullTokenResponse"/>
  <xs:element name="utilisateur" type="tns:utilisateur"/>

  <xs:complexType name="Authentification">
    <xs:sequence>
      <xs:element minOccurs="0" name="arg0" type="xs:string"/>
      <xs:element minOccurs="0" name="arg1" type="xs:string"/>
      <xs:element minOccurs="0" name="arg2" type="xs:boolean"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="AuthentificationResponse">
    <xs:sequence>
      <xs:element minOccurs="0" name="return" type="tns:utilisateur"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="utilisateur">
    <xs:sequence>
      <xs:element minOccurs="0" name="idutilisateur" type="xs:decimal"/>
      <xs:element minOccurs="0" name="nom" type="xs:string"/>
      <xs:element minOccurs="0" name="prenom" type="xs:string"/>
      <xs:element minOccurs="0" name="login" type="xs:string"/>
      <xs:element minOccurs="0" name="mdp" type="xs:string"/>
      <xs:element minOccurs="0" name="profil" type="xs:string"/>
      <xs:element minOccurs="0" name="token" type="xs:string"/>
      <xs:element minOccurs="0" name="tokenTimestamp" type="tns:timestamp"/>
      <xs:element minOccurs="0" name="maritalStatus" type="xs:string"/>
      <xs:element minOccurs="0" name="profilSummary" type="xs:string"/>
      <xs:element minOccurs="0" name="birthday" type="xs:dateTime"/>
      <xs:element minOccurs="0" name="ville" type="xs:string"/>
      <xs:element minOccurs="0" name="codePostal" type="xs:string"/>
      <xs:element minOccurs="0" name="mobileNumber" type="xs:string"/>
      <xs:element minOccurs="0" name="email" type="xs:string"/>
      <xs:element minOccurs="0" name="civilite" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="timestamp">
    <xs:sequence>
      <xs:element name="nanos" type="xs:int"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="remiseANullToken">
    <xs:sequence>
      <xs:element name="arg0" type="xs:int"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="remiseANullTokenResponse">
    <xs:sequence>
      <xs:element name="return" type="xs:boolean"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="AuthentificationParToken">
    <xs:sequence>
      <xs:element minOccurs="0" name="arg0" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="AuthentificationParTokenResponse">
    <xs:sequence>
      <xs:element minOccurs="0" name="return" type="tns:utilisateur"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="Exception" type="tns:Exception"/>
  <xs:complexType name="Exception">
    <xs:sequence>
      <xs:element minOccurs="0" name="message" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema>

I can deployed this properly and send some SOAP request with SOAP GUI tool.

But I cannot have this working :'(

If anything is needed to help for understanding I will edit my post with it.

Thank you very much for help.

Upvotes: 1

Views: 6512

Answers (2)

Deunz
Deunz

Reputation: 1941

In fact I was missing the CXF code generation ...This part generate the service interface with all the required annotations (@WebService etc ...)

Upvotes: 1

Shantaram Chavan
Shantaram Chavan

Reputation: 21

You need to map endpoint method with "Authentification" so that spring will detect and execute it once requested from soap client.

In spring we do it as follows :-

@Endpoint
public class MyEndpoint{

@PayloadRoot(localPart="Authentification", namespace=SOME_TARGET_NAMESPACE)
public @ResponsePayload MyResponse myMethod(@RequestPayload MyRequest request){

}

}

Add <context:component-scan base-package="package-name" /> in spring-config.xml

Upvotes: 1

Related Questions