如何为基于SOAP的Web服务生成WSDL文件?

时间:2017-07-11 01:44:24

标签: soap wsdl

我最近一直在使用spring创建一个java项目来创建一些额外的API。原始Web服务已存在,因此其wsdl文件。现在我想添加更多功能。

对于这个项目,首先创建.xsd请求和响应文件,然后从X2J xml文件自动生成到java文件。使用这些文件作为字段我也创建了新的API。现在我需要在现有的wsdl中添加这些新的API。现有的wsdl太长了,所以我可以为新老API生成wsdl。

  web.xml file 

     <!-- Servlet to expose webservices -->
        <servlet>
            <servlet-name>messageDispatcher</servlet-name>
            <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
            <init-param>
                <param-name>transformWsdlLocations</param-name>
                <param-value>true</param-value>
            </init-param>
        </servlet>

        <servlet-mapping>
            <servlet-name>messageDispatcher</servlet-name>
            <url-pattern>/services/*</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>messageDispatcher</servlet-name>
            <url-pattern>*.wsdl</url-pattern>
        </servlet-mapping>


    messageDispatcher-servlet.xml file


     <!-- Add supported requests here to define them in the WSDL -->
        <bean id="schemaCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
            <property name="xsds">
                <list>
     <value>classpath:xmlbind/zzzzRQ.xsd</value>
                    <value>classpath:xmlbind/zzzzRS.xsd</value>
                    <value>classpath:xmlbind/yyyyRQ.xsd</value>
                    <value>classpath:xmlbind/yyyyRS.xsd</value>


    <!-- CONFIGURE WSDL -->
    <bean id="XXXX" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
            <property name="schemaCollection" ref="schemaCollection"/>
            <property name="portTypeName" value="ACVWS_"/>
            <property name="locationUri" value="/services"/>
            <property name="requestSuffix" value="RQ"/>
            <property name="responseSuffix" value="RS"/>
        </bean>

    </bean>
        <bean id="xxxx_v1_0" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
            <property name="wsdl" value="classpath:/wsdl/xxxx_v1_0.wsdl"></property>
        </bean>
        <bean id="xxxx_v2_0" class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
            <property name="wsdl" value="classpath:/wsdl/xxxx_v2_0.wsdl"></property>
        </bean> 

0 个答案:

没有答案