Pregunta

I am using spring spring-ws-core 2.1.4.RELEASE I am generatin request and response classes from XSD using Jibx 1.2.5 and I am running the application using Jboss EAP 5.1.2 server While invoking the service from soap UI I am getting the following error response.

    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
   <env:Header/>
   <env:Body>
      <env:Fault>
         <env:Code>
            <env:Value>env:Receiver</env:Value>
         </env:Code>
         <env:Reason>
            <env:Text xml:lang="en">No adapter for endpoint [public auk.dp.cpd.soap.messages.CPDataServiceResponse auk.dp.spring.sample.service.CPDataEndPoint.getCPDetails(auk.dp.cpd.soap.messages.CPDataServiceRequest)]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</env:Text>
         </env:Reason>
      </env:Fault>
   </env:Body>
</env:Envelope>

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.sample.spring</groupId>
    <artifactId>springWS</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>Spring webservice Sample</name>
    <description>A sample spring web service applicaiton</description>

    <dependencies>
        <dependency>
            <groupId>com.dp.cp.model</groupId>
            <artifactId>cpmodel</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-ws-core</artifactId>
            <version>2.1.4.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.jibx</groupId>
            <artifactId>jibx-run</artifactId>
            <version>1.2.5</version>
            <exclusions>
                <exclusion>
                    <groupId>xpp3</groupId>
                    <artifactId>xpp3</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>2.0.2</version>
        </dependency>
        <dependency>
            <groupId>jaxen</groupId>
            <artifactId>jaxen</artifactId>
            <version>full</version>
        </dependency>
</dependencies>

    <build>
        <finalName>springWS</finalName>
    </build>
</project>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">

    <display-name>Archetype Created Web Application</display-name>


    <servlet>
        <servlet-name>spring-ws</servlet-name>
        <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
        <init-param>
            <param-name>transformWsdlLocations</param-name>
            <param-value>true</param-value>
        </init-param>
    </servlet>

    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/xsd/log4j.properties</param-value>
    </context-param>

     <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>
    <servlet-mapping>
        <servlet-name>spring-ws</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

</web-app>

spring-ws-servlet.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:util="http://www.springframework.org/schema/util"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:sws="http://www.springframework.org/schema/web-services"
       xmlns:oxm="http://www.springframework.org/schema/oxm"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd
       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

    <context:component-scan base-package="auk.dp.spring.sample.service" />
    <context:component-scan base-package="auk.dp.cpd.soap.messages" />
<sws:annotation-driven/>
    <sws:interceptors>
        <bean class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
            <property name="schema" value="/WEB-INF/xsd/CPDataService.xsd"/>
            <property name="validateRequest" value="true"/>
            <property name="validateResponse" value="true"/>
        </bean>
        <bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>           

        <bean class="org.springframework.ws.soap.server.endpoint.interceptor.SoapEnvelopeLoggingInterceptor">
        <property name="logRequest" value="true"/>
        <property name="logResponse" value="true"/>
    </bean>
</sws:interceptors>

    <sws:dynamic-wsdl id="CPData" portTypeName="CPDataResource" locationUri="/CPDataServices/">
        <sws:xsd location="/WEB-INF/xsd/CPDataService.xsd"/>
    </sws:dynamic-wsdl>
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
        <property name="soapVersion">
            <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12"/>
        </property>
    </bean>
<oxm:jibx-marshaller id="CPDataServiceRequest" target-class="auk.dp.cpd.soap.messages.CPDataServiceRequest" />
    <oxm:jibx-marshaller id="CPDataServiceResponse" target-class="auk.dp.cpd.soap.messages.CPDataServiceResponse" />
</beans>

CPDataService.xsd

    <?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www-example/GetCPDataService"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:gs="http://www-example/GetCPDataService"
    elementFormDefault="qualified">


    <xs:element name="CPDataServiceRequest" >
        <xs:annotation>
            <xs:documentation>Request object for Retrieving Individual Details
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>

            <xs:sequence>
                <xs:element name="partyId" type="xs:long" />
                <xs:element name="partyType" type="xs:string" />
                <xs:element name="inquiryLevel" type="xs:string" />
                <xs:element name="brandOwnerType" type="xs:string" />
            </xs:sequence>

        </xs:complexType>
    </xs:element>
    <xs:element name="CPDataServiceResponse">

        <xs:annotation>
            <xs:documentation>Response object for Retrieving Individual Details
            </xs:documentation>
        </xs:annotation>

        <xs:complexType>

            <xs:sequence>
                <xs:element name="name" type="xs:string" />
                <xs:element name="contactDetails" type="xs:string" />
                <xs:element name="gender" type="xs:string" />
                <xs:element name="dateOfBirth" type="xs:dateTime" />
            </xs:sequence>

        </xs:complexType>
    </xs:element>

</xs:schema>

CPDataEndPoint.java

    package auk.dp.spring.sample.service;

import java.util.Date;

import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;

import auk.dp.cpd.soap.messages.CPDataServiceRequest;
import auk.dp.cpd.soap.messages.CPDataServiceResponse;


@Endpoint
public class CPDataEndPoint implements GetCPDataService {



    @PayloadRoot(localPart=CPDATA_REQUEST, namespace=NAMESPACE)
    public @ResponsePayload CPDataServiceResponse getCPDetails(@RequestPayload CPDataServiceRequest request){
        System.out.println("service hitted ====");
        CPDataServiceResponse response = new   CPDataServiceResponse();
        response.setDateOfBirth(new Date());
        response.setGender("MALE");
        response.setName("Sreekanth");
        response.setContactDetails("contact Me");

        return response;
    }

}

GetCPDataService.java

    package auk.dp.spring.sample.service;

import auk.dp.cpd.soap.messages.CPDataServiceRequest;
import auk.dp.cpd.soap.messages.CPDataServiceResponse;


public interface GetCPDataService {
    public final static String NAMESPACE = "http://www-example/GetCPDataService"; 
    public final static String CPDATA_REQUEST = "CPDataServiceRequest";

    public CPDataServiceResponse getCPDetails(CPDataServiceRequest request);

}

Soap UI request

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:get="http://www-example/GetCPDataService">
   <soapenv:Header/>
   <soapenv:Body>
      <get:CPDataServiceRequest>
         <get:partyId>123</get:partyId>
         <get:partyType>xdf</get:partyType>
         <get:inquiryLevel>fgh</get:inquiryLevel>
         <get:brandOwnerType>ghf</get:brandOwnerType>
      </get:CPDataServiceRequest>
   </soapenv:Body>
</soapenv:Envelope>
¿Fue útil?

Solución

Finally I found the problem. Because of some jar conflict application can't properly Identified the End point mapping. I have added Jboss-classloading.xml, then it is working fine.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top