【问题标题】:Spring WS Request endpoint with SOAP header and body带有 SOAP 标头和正文的 Spring WS 请求端点
【发布时间】:2015-11-30 13:32:22
【问题描述】:

在我正在开发的项目中,我需要指定一个包含请求和响应的架构,并且在请求中必须是标头和正文。

我的问题是生成在请求中使用标头指定的 wsdl。我的架构是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="example"
       xmlns:tns="example"
       xmlns:xs="http://www.w3.org/2001/XMLSchema"
       elementFormDefault="qualified">

<xs:element name="ExampleRequestHeader">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="parameter1" type="xs:string" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:element name="ExampleRequest">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="parameter2" type="xs:string" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:element name="ExampleResponse">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="parameter3" type="xs:string" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>
</xs:schema>

我的wsdl生成成功了,但是header总是被忽略。

<wsdl:message name="ExampleResponse">
    <wsdl:part element="tns:ExampleResponse" name="ExampleResponse">
    </wsdl:part>
</wsdl:message>
<wsdl:message name="ExampleRequest">
    <wsdl:part element="tns:ExampleRequest" name="ExampleRequest">
    </wsdl:part>
</wsdl:message>
<wsdl:portType name="example">
    <wsdl:operation name="Example">
        <wsdl:input message="tns:ExampleRequest" name="ExampleRequest">
        </wsdl:input>
        <wsdl:output message="tns:ExampleResponse" name="ExampleResponse">
        </wsdl:output>
    </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="exampleSoap11" type="tns:example">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="Example">
        <soap:operation soapAction=""/>
        <wsdl:input name="ExampleRequest">
            <soap:body use="literal"/>
        </wsdl:input>
        <wsdl:output name="ExampleResponse">
            <soap:body use="literal"/>
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>

我必须对 Spring WS 做些什么假设架构中的元素是请求的标头?有可能吧?

PS:这只是一个例子,不是真实的服务名称:)

【问题讨论】:

    标签: spring soap xsd wsdl spring-ws


    【解决方案1】:

    解决方案在 Spring WS 的这个 JIRA 问题中:https://jira.spring.io/browse/SWS-605

    具体来说,解决方案在这个由@ArjenPoutsma 创建的maven 项目https://jira.spring.io/secure/attachment/19345/soapheader.zip 中

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-02
      • 1970-01-01
      • 1970-01-01
      • 2020-12-23
      • 1970-01-01
      • 1970-01-01
      • 2016-04-13
      • 1970-01-01
      相关资源
      最近更新 更多