Spring WS + JIBX“没有端点适配器”错误 [英] Spring WS + JIBX "No adapter for endpoint" Error

查看:128
本文介绍了Spring WS + JIBX“没有端点适配器”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 JIBX 从XSD文件创建实体类。它在pom.xml中配置,当我执行maven:compile时创建类

I use JIBX to create my entity classes from XSD files. It is configured in pom.xml and creates classes when I do a "maven: compile"

我也使用spring-ws。当我使用SOAPUI测试我的Web服务时,我得到了臭名昭着的错误;

I also use spring-ws. When I test my web service with SOAPUI I get the infamous error;

"No adapter for endpoint GetTransactionsResponse getTransactions(GetTransactionsRequest),  Is your endpoint annotated with @Endpoint, or does.." 

我在这里查看了有关该错误的所有主题但没有帮助。

I checked all the threads here about that error but didn't help.

我有一个Parent.xsd并导入2个子xsd。它们都在同一个文件夹中。这就是我的spring-ws-servlet的样子;

I have one Parent.xsd and it imports 2 child xsd's. They are all in the same folder. This is how my spring-ws-servlet looks like;

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:sws="http://www.springframework.org/schema/web-services"
   xmlns:context="http://www.springframework.org/schema/context"
   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.1.xsd">

<bean name="xsdCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
    <property name="xsds">
        <list>
            <value>/WEB-INF/Parent.xsd</value>
        </list>
    </property>
</bean>


<context:component-scan base-package="mypackage"/>

<sws:annotation-driven/>

<sws:dynamic-wsdl id="my" portTypeName="myResource" locationUri="/ws/my"
                  targetNamespace="myschame">
    <sws:xsd location="/WEB-INF/Parent.xsd"/>
</sws:dynamic-wsdl>

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

    <bean class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
        <property name="xsdSchemaCollection" ref="xsdCollection"/>
        <property name="validateRequest" value="true"/>
        <property name="validateResponse" value="true"/>
    </bean>
</sws:interceptors>

这是我的端点类;

@Endpoint
public class TransactionsEndpoint {

public static final String NAMESPACE = "nmapespace";


@PayloadRoot(namespace = NAMESPACE, localPart = "getTransactionsRequest")
@ResponsePayload
public GetTransactionsResponse getTransactions(@RequestPayload  GetTransactionsRequest request) {
     GetTransactionsResponse transactionsResponse = new GetTransactionsResponse();
     return transactionsResponse;
}


}

GetTransactionsResponse / Request由JIBX创建的类。

GetTransactionsResponse/Request classes created by JIBX.

我的wsdl看起来像这样;

My wsdl looks like this;

 <wsdl:operation name="getTransactions"><wsdl:input message="tns:getTransactionsRequest" name="getTransactionsRequest">
</wsdl:input><wsdl:output message="tns:getTransactionsResponse" name="getTransactionsResponse">
</wsdl:output></wsdl:operation>

pom文件是;

   <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-core</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.ws.xmlschema</groupId>
        <artifactId>xmlschema-core</artifactId>
        <version>2.0.2</version>
    </dependency>

我不确定问题是否因为有3个xsd文件而且这些文件之间出现了问题或者这是JIBX的配置问题,因为当我尝试使用JAXB而不是JIBX时,它有效!

I am not sure if the problem is because there are 3 xsd files and something goes wrong between those or it is a configuration problem with JIBX because When I try to use JAXB instead of JIBX, it worked!

推荐答案

我也有过类似的问题(花了好几天)但是在我的案例中,Spring WS和Spring版本是不兼容的,请检查你的Spring WS和Spring版本是否匹配。

I also had similar issue(spent several days) however in my case issue being Spring WS and Spring versions being incompatible, check whether your Spring WS and Spring versions match.

这篇关于Spring WS + JIBX“没有端点适配器”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆