gpt4 book ai didi

xml - JAXB 2 spring-ws 2.0.3.RELEASE SOAP 服务教程链接/建议请求

转载 作者:数据小太阳 更新时间:2023-10-29 02:37:03 27 4
gpt4 key购买 nike

我正在尝试使用 JAXB 2 和 spring-ws 2.0.3 在 glassfish 3 上创建 SOAP 服务。

我在 xml 文件配置方面遇到了一些问题,因为有大量关于让这些包的旧版本运行的信息(教程、示例),但关于新版本的信息不多。

我已经成功地让客户端/服务器程序通过 httpInvokerProxy 远程服务工作,但是这些文件中所需的配置量要多得多。

基本上,我使用 xjc maven 工具从我的 xml 模式和 spring-ws 注释 @PayloadRoot@EndPoint@ 创建 java 类ResponsePayload 标记我的端点 java 类中的方法。我只是想确保我的 wsdl 文件在正确的 URL 上可用,并且正在接受 soap 请求并提供响应。

如果有人可以推荐一个获取此信息的好地方或者有心浏览我的 3 个 xml 文件,我将非常感激。否则,这是我在上传 war 文件后转到根 servlet 目录时遇到的错误。

org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.context.support.XmlWebApplicationContext]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.core.convert.converter.ConverterRegistry.addConverter(Ljava/lang/Class;Ljava/lang/Class;Lorg/springframework/core/convert/converter/Converter

我的xml文件如下:

web.xml

    <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>Licensing SOAP Service</display-name>

<servlet>
<servlet-name>licensingSOAPService</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>licensingSOAPService</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

</web-app>

licensingSOAPService-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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

<import resource-"/applicationContext.xml"/>

<bean id = "licensingSOAPService" class="mypackage.soap.LicensingSOAPService">
</bean>

<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
<description>An endpoint mapping strategy that looks for @Endpoint and @PayloadRoot annotations.</description>
</bean>

<bean class="org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter">
<description>Enables the MessageDispatchServlet to invoke methods requiring OXM marshalling.</description>
<constructor-arg ref="marshaller"/>
</bean>

<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"
p:contextPath="mypackage.schemas" />


<bean id = "licensingWSDL" class ="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<property name = "schema" ref = "schema">
<property name = "portTypeName" value = "licenseResource"/>
<property name = "locationUri" value ="/licensing/schema/" />
<property name = "targetNamespace" value = "mypackage/schemas" />
</bean>

<bean id ="schema" class ="org.springframework.xml.xsd.SimpleXsdSchema">
<property name ="xsd" value = "/licenseSchema.xsd"/>
</bean>

</beans>

applicationContext.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: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">

<sws:annotation-driven />

<context:component-scan base-package="mypackagel.licensing"/>
</beans>

有人看到这些有什么明显的错误吗?

编辑:

想要包含我的 pom.xml 的依赖部分,因为它被指出(正确地如此)我的 war 文件中有 spring 3.1 和 spring 3.5 jar 。

<repositories>
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
<version>2.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
</dependencies>
<build>
<finalName>LicensingSOAPService</finalName>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

最佳答案

异常消息指的是方法

ConverterRegistry.addConverter(Class, Class, Converter)

此方法仅在 Spring 3.1 中引入(请参阅 javadoc ),因此您的设置中的某些内容假定存在 Spring 3.1,但您似乎运行的是 3.0。

你需要将Spring升级到3.1

关于xml - JAXB 2 spring-ws 2.0.3.RELEASE SOAP 服务教程链接/建议请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8934413/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com