到目前为止,谢谢你的帮助,我正在更新问题,因为我没有显示我需要的所有内容,显示的更改显示.肥皂输出仍然不是我想要的.
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:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
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"
>
<!--Enables @Endpoint and related Spring-WS annotations.-->
<sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller"/>
<bean id="weatherService"
class="au.test.weather.ws.WeatherServiceImpl" />
<bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema"
p:xsd = "classpath:au/test/weather/ws/schemas/Temperature.xsd"/>
<oxm:jaxb2-marshaller id="marshaller" >
<oxm:class-to-be-bound name="au.test.weather.ws.GetTemperaturesResponse"/>
<oxm:class-to-be-bound name="au.test.weather.ws.GetTemperaturesRequest"/>
<oxm:class-to-be-bound name="au.test.weather.ws.schemas.Jaxb2Marshaller"/>
</oxm:jaxb2-marshaller>
<bean id="temperatureEndpoint"
class="au.test.weather.ws.TemperatureMarshallingEndpoint">
<property name="weatherService" ref="weatherService" />
</bean>
Run Code Online (Sandbox Code Playgroud)
我的注释类看起来像什么
@XmlRootElement(name = "GetTemperaturesRequest")
public class GetTemperaturesRequest {
@XmlElement(required = true)
protected String city;
@XmlElement(required = true)
@XmlSchemaType(name = "date")
protected List<XMLGregorianCalendar> …
Run Code Online (Sandbox Code Playgroud) 让我们说我上课了
@XmlType(propOrder = {
"one",
"two"
})
@XmlRootElement(name = "search")
public class Search {
protected One one;
protected Two two;
//getters & setters
}
Run Code Online (Sandbox Code Playgroud)
我想要一个扩展这个类的类
例如
@XmlType(propOrder = {
"three"
})
@XmlRootElement(name = "searchExtended")
public class SearchExtended extends Search {
protected Three three;
//getters & setters
}
Run Code Online (Sandbox Code Playgroud)
你如何正确地声明propOrder,我之前尝试了这个,它没有使用我认为它会的顺序.这是如何通过注释处理的?/你应该如何在扩展类中声明这一点?
我有这个错误,它说我有两个相同的XML类型名称类
所以问题出在InfoSource - > NameSearchFilters - > SearchRequest之间
错误
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://test.au/schema/namesearch}InfoSource". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at au.test.identitySearch.model.InfoSource
at protected au.test.identitySearch.model.InfoSource au.test.identitySearch.model.nameSearch.NameSearchFilters.infoSourceList
at au.test.identitySearch.model.nameSearch.NameSearchFilters
this problem is related to the following location:
at au.test.identitySearch.model.InfoSource
at protected au.test.identitySearch.model.InfoSource au.test.identitySearch.model.nameSearch.NameSearchFilters.infoSourceList
at au.test.identitySearch.model.nameSearch.NameSearchFilters
at protected au.test.identitySearch.model.nameSearch.NameSearchFilters au.test.identitySearch.ws.model.SearchRequest.searchFilters
at au.test.identitySearch.ws.model.SearchRequest
Run Code Online (Sandbox Code Playgroud)
InfoSource
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InfoSource", propOrder = …
Run Code Online (Sandbox Code Playgroud) 我尝试在Java中使用Math.reverseBytes但是给出错误:方法reverseBytes()未定义为Math类型
如你所知它是静态类型.为什么我不能使用它?
import java.lang.Integer;
public class Test {
public static void main(String[] args) {
int x = Math.reverseBytes();//Eclipse cannot reach this function
}
}
Run Code Online (Sandbox Code Playgroud)
来自Java Doc - 一些信息
reverseBytes
public static int reverseBytes(int i);
Run Code Online (Sandbox Code Playgroud)
返回通过反转指定int值的二进制补码表示中的字节顺序获得的值.
返回:通过反转指定int值中的字节获得的值.
自:1.5