Spring-WS无需操作即可生成WSDL [英] Spring-WS generates WSDL without operations

查看:37
本文介绍了Spring-WS无需操作即可生成WSDL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Spring-WS 生成 WSDL 无需绑定标签的操作...你知道为什么吗?

Spring-WS generates WSDL without operations in binding tag... Do you know why?

有我的 spring-ws-service.xml:

There is my spring-ws-service.xml:

    <import resource="classpath*:application-context.xml" />

    <!-- Register PayloadRootAnnotationMethodEndpointMapping -->
    <bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping" />

    <!-- Register Endpoint -->
    <bean id="tasktablerServiceEndpoint" class="tasktabler.mpk.service.TasktablerServiceEndpoint" />

    <!-- Configure XML Marshaller -->
    <bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
        <constructor-arg ref="marshaller" />
    </bean>

    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        <property name="classesToBeBound">
            <list>
                <value>tasktabler.mpk.databinding.OptimizeRequest</value>
            </list>
        </property>
    </bean>

    <!-- Add automatic WSDL generation support -->
    <bean id="tasktabler" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
        <property name="schema" ref="schema" />
        <property name="portTypeName" value="tasktabler" />
        <property name="locationUri" value="http://localhost:8080/tasktabler" />
        <property name="targetNamespace" value="http://tasktabler" />
    </bean>

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

WSDL 有 wsdl 绑定部分:

And there is wsdl binding part of WSDL:

   <wsdl:binding name="tasktablerSoap11" type="tns:tasktabler">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
   </wsdl:binding>

提前致谢,埃塔姆.

推荐答案

DefaultWsdl11Definition 尝试通过检查架构中的类型来自动生成 WSDL.如果您的架构不符合其预期的模式,它就不会做得很好.

DefaultWsdl11Definition attempts to auto-generate the WSDL by examining the types in your schema. If your schema doesn't fit its expected patterns, it won't do a good job of it.

来自 文档:

DefaultWsdl11Definition 其中从 XSD 模式构建 WSDL.这个定义迭代所有元素在架构中找到的元素,以及为所有元素创建一条消息.接下来,它创建 WSDL 操作所有以定义结束的消息请求或响应后缀.这默认请求后缀为Request;这默认响应后缀是响应,虽然这些可以通过设置来改变requestSuffix 和 responseSuffix属性,分别.它也是构建 portType、绑定和基于操作的服务.

The DefaultWsdl11Definition which builds a WSDL from a XSD schema. This definition iterates over all element elements found in the schema, and creates a message for all elements. Next, it creates WSDL operation for all messages that end with the defined request or response suffix. The default request suffix is Request; the default response suffix is Response, though these can be changed by setting the requestSuffix and responseSuffix properties, respectively. It also builds a portType, binding, and service based on the operations.

例如,如果我们的 Orders.xsd 架构定义 GetOrdersRequest 和GetOrdersResponse 元素,XsdBasedSoap11Wsdl4jDefinitionBuilder将创建一个 GetOrdersRequest 和GetOrdersResponse 消息,以及GetOrders 操作,它被放入一个订单端口类型.

For instance, if our Orders.xsd schema defines the GetOrdersRequest and GetOrdersResponse elements, the XsdBasedSoap11Wsdl4jDefinitionBuilder will create a GetOrdersRequest and GetOrdersResponse message, and a GetOrders operation, which is put in a Orders port type.

这篇关于Spring-WS无需操作即可生成WSDL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆