SpringWS服务说有;“端点”没有适配器;就我所能看到的而言
我正在尝试编写一个相当简单的SpringWS服务,它接受一个字符串并返回一个字符串,我已经定义了endpoint类,据我所知,一切看起来都很好。但是,当我使用SOAP-UI访问服务时,会收到以下错误消息: 端点[public java.lang.String]没有适配器 uk.co.company.product.identification.service.IdentificationServiceEndpoint.getIdentificationData(java.lang.String)]: 您的端点是用@endpoint注释的,还是实现了 支持的接口,如MessageHandler或PayloadEndpoint 我不知所措,因为就我所知,一切都是应该的 弹簧配置SpringWS服务说有;“端点”没有适配器;就我所能看到的而言,spring,web-services,spring-ws,Spring,Web Services,Spring Ws,我正在尝试编写一个相当简单的SpringWS服务,它接受一个字符串并返回一个字符串,我已经定义了endpoint类,据我所知,一切看起来都很好。但是,当我使用SOAP-UI访问服务时,会收到以下错误消息: 端点[public java.lang.String]没有适配器 uk.co.company.product.identification.service.IdentificationServiceEndpoint.getIdentificationData(java.lang.String)
<?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"
xmlns:sws="http://www.springframework.org/schema/web-services"
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">
<context:component-scan base-package="uk.co.company.product.identification" />
<sws:annotation-driven />
<!-- Our test service bean -->
<bean id="IdentificationRequest"
class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition"
lazy-init="true">
<property name="schemaCollection">
<bean
class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
<property name="inline" value="true" />
<property name="xsds">
<list>
<value>/schemas/identificationOperations.xsd</value>
</list>
</property>
</bean>
</property>
<property name="portTypeName" value="IdentificationService" />
<property name="serviceName" value="IdentificationServices" />
<property name="locationUri" value="/endpoints/" />
</bean>
</beans>
生成的WSDL
这是我浏览到以下位置时生成的WSDL:
SOAP消息:
这些是我从SOAP-UI发送的SOAP消息和我收到的消息。
终点是:
请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.company.co.uk/product/identification/service">
<soapenv:Header/>
<soapenv:Body>
<ser:IdentificationRequest>
<address>test</address>
</ser:IdentificationRequest>
</soapenv:Body>
</soapenv:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring xml:lang="en">No adapter for endpoint [public java.lang.String uk.co.company.product.identification.service.IdentificationServiceEndpoint.getIdentificationData(java.lang.String)]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
测试
响应:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.company.co.uk/product/identification/service">
<soapenv:Header/>
<soapenv:Body>
<ser:IdentificationRequest>
<address>test</address>
</ser:IdentificationRequest>
</soapenv:Body>
</soapenv:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring xml:lang="en">No adapter for endpoint [public java.lang.String uk.co.company.product.identification.service.IdentificationServiceEndpoint.getIdentificationData(java.lang.String)]: Is your endpoint annotated with @Endpoint, or does it implement a supported interface like MessageHandler or PayloadEndpoint?</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
SOAP-ENV:服务器
端点[public java.lang.String uk.co.company.product.identification.service.IdentificationServiceEndpoint.getIdentificationData(java.lang.String)]没有适配器:您的端点是用@endpoint注释的,还是实现了MessageHandler或PayloadEndpoint等受支持的接口?
为了完整起见,这里是我的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>org.springframework.samples.service.service</groupId>
<artifactId>IdentificationService</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<!-- Generic properties -->
<java.version>1.7</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Web -->
<jsp.version>2.2</jsp.version>
<jstl.version>1.2</jstl.version>
<servlet.version>2.5</servlet.version>
<!-- Spring -->
<spring-framework.version>3.2.3.RELEASE</spring-framework.version>
<spring.ws.version>2.0.0.RELEASE</spring.ws.version>
<!-- Hibernate / JPA -->
<hibernate.version>4.2.1.Final</hibernate.version>
<!-- Logging -->
<logback.version>1.0.13</logback.version>
<slf4j.version>1.7.5</slf4j.version>
<!-- Test -->
<junit.version>4.11</junit.version>
<!-- Context Path -->
<context.path>IdentificationService</context.path>
</properties>
<dependencies>
<!-- Spring MVC -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<!-- Spring WS -->
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.ws.xmlschema</groupId>
<artifactId>xmlschema-core</artifactId>
<version>2.0.1</version>
</dependency>
<!-- Apache Commons -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<!-- Other Web dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>${jsp.version}</version>
<scope>provided</scope>
</dependency>
<!-- Spring and Transactions -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<!-- Logging with SLF4J & LogBack -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
<scope>runtime</scope>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- Test Artifacts -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring-framework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
<phase>generate-sources</phase>
</execution>
</executions>
<configuration>
<clearOutputDir>false</clearOutputDir>
<outputDirectory>src/main/java</outputDirectory>
<schemaDirectory>src/main/webapp/schemas</schemaDirectory>
<includeSchema>**/*.xsd</includeSchema>
<enableIntrospection>false</enableIntrospection>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>${context.path}</warName>
</configuration>
</plugin>
</plugins>
</build>
</project>
4.0.0
org.springframework.samples.service.service
识别服务
0.0.1-快照
战争
1.7
UTF-8
UTF-8
2.2
1.2
2.5
3.2.3.1发布
2.0.0.1版本
4.2.1.最终版本
1.0.13
1.7.5
4.11
识别服务
org.springframework
SpringWebMVC
${spring framework.version}
org.springframework.ws
SpringWS核心
2.2.0.1发布
wsdl4j
wsdl4j
1.6.3
org.apache.ws.xmlschema
xmlschema核心
2.0.1
通用编解码器
通用编解码器
1.10
org.apache.httpcomponents
httpclient
4.3.6
org.apache.commons
commons-lang3
3.3.2
javax.servlet
jstl
${jstl.version}
javax.servlet
servlet api
${servlet.version}
假如
javax.servlet.jsp
jsp api
${jsp.version}
假如
org.springframework
德克萨斯州春季
${spring framework.version}
org.slf4j
slf4j api
${slf4j.version}
编译
回写
回归经典
${logback.version}
运行时
org.hibernate
休眠实体管理器
${hibernate.version}
org.springframework
弹簧试验
${spring framework.version}
测试
朱尼特
朱尼特
${junit.version}
测试
org.apache.maven.plugins
maven编译器插件
2.1
${java.version}
${java.version}
org.codehaus.mojo
jaxb2 maven插件
1.4
xjc
生成源
假的
src/main/java
src/main/webapp/schemas
**/*.xsd
假的
org.apache.maven.plugins
maven战争插件
${context.path}
您的方法签名处于关闭状态,而不是字符串
,它期望标识请求
和标识响应
作为返回类型
@PayloadRoot(localPart="IdentificationRequest", namespace=TARGET_NAMESPACE)
@ResponsePayload
public IdentificationResponse getIdentificationData(@RequestPayload IdentificationRequest address){
String identification = identificationService.getIdentificationData(address.getAddress());
ObjectFactory factory = new ObjectFactory();
IdentificationResponse response = factory.createIdentificationResponse();
response.setIdentificationData(identification);
return response;
}
您的方法应该与上面的类似。您可能会看到此错误的原因有两个。 1.如果您正在查看SpringWeb服务示例,那么您的jdom版本可能不正确。这就是pom的外观
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>2.0.2</version>
</dependency>
org.jdom
Java文档对象模型
2.0.2
你的端点是错误的。。。您应该接受并返回XML
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>2.0.2</version>
</dependency>