相关疑难解决方法(0)

如何配置Spring-WS以使用JAXB Marshaller?

到目前为止,谢谢你的帮助,我正在更新问题,因为我没有显示我需要的所有内容,显示的更改显示.肥皂输出仍然不是我想要的.

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)

java spring spring-ws jaxb endpoint

7
推荐指数
1
解决办法
3万
查看次数

在Java中从XML中删除命名空间

我想从Java中删除XML中的命名空间.你能指导一下需要做什么吗?可以使用DOM解析器,但这将是逐个节点解析的节点.我想知道是否有一些代码,其中所有的namespace(mig:)都可以从整个XML中删除.

我的XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mig:menu-compare xmlns:mig="http://www..com/migration/" xmlns:xsi="http://www..org/2001/XMLSchema-instance" xsi:schemaLocation="http://www..com/migration">
    <mig:menu-info>
        <mig:menu type="ons" name="HRDM"/>
        <mig:menu type="ux" name="ARD"/>
    </mig:menu-info>
    <mig:field-details>
        <mig:fields existence="nonMap">
            <mig:field>
                <mig:field-type type="ons">
                    <mig:ui-field>funcCode</mig:ui-field>
                    <mig:label>FLT000204</mig:label>
                    <mig:label-desc>Function</mig:label-desc>
                    <mig:mandatory>Y</mig:mandatory>
                </mig:field-type>
            </mig:field>
            <mig:field>
                <mig:field-type type="ux">
                    <mig:ui-field>submit</mig:ui-field>
                    <mig:label>FBT000000</mig:label>
                    <mig:section-structure></mig:section-structure>
                    <mig:form></mig:form>
                </mig:field-type>
            </mig:field>
            <mig:field>
                <mig:field-type type="ux">
                    <mig:ui-field>cancel</mig:ui-field>
                    <mig:label>FBT000001</mig:label>
                    <mig:section-structure></mig:section-structure>
                    <mig:form></mig:form>
                </mig:field-type>
            </mig:field>
        </mig:fields>
        <mig:fields existence="both">
            <mig:field name="rptDfnMsg.rptDfnInfo.gprRptNum">
                <mig:field-type type="ons">
                    <mig:control-type>Text Field</mig:control-type>
                    <mig:ui-field>rptNum</mig:ui-field>
                    <mig:label>FLT006718</mig:label>
                    <mig:label-desc>Report No.</mig:label-desc>
                    <mig:mandatory>Y</mig:mandatory>
                </mig:field-type>
                <mig:field-type type="ux">
                    <mig:control-type>FinTextInputWithSearcher</mig:control-type>
                    <mig:ui-field>reportNo</mig:ui-field>
                    <mig:label>FLT005821</mig:label>
                    <mig:label-desc>Report No.</mig:label-desc>
                    <mig:mandatory>Y</mig:mandatory>
                </mig:field-type>
            </mig:field>
            <mig:field name="rptDfnMsg.rptDfnInfo.gprRptDesc">
                <mig:field-type type="ons">
                    <mig:control-type>Desc. …
Run Code Online (Sandbox Code Playgroud)

java xml

7
推荐指数
2
解决办法
2万
查看次数

标签 统计

java ×2

endpoint ×1

jaxb ×1

spring ×1

spring-ws ×1

xml ×1