隐藏自动生成的wsdl中的请求和响应xsd元素

时间:2015-07-31 10:15:31

标签: java xsd jaxb wsdl spring-ws

我使用spring + XSD + JAXB进行soap webservices,我使用了下面的spring配置并给出了内联属性为false,我目前能够使用<< i>获得自动生成的WSDL。 wsdl:types>但我的预期结果不应该< wsdl:types>。

我的bean.xml

<bean id="MyWSService" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition" lazy-init="true">
    <property name="schemaCollection">
        <bean class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
            <property name="inline" value="false" />
            <property name="xsds">
                <list>
                    <value>schemas/ServiceOperations.xsd</value>
                </list>
            </property>
        </bean>
    </property>
    <property name="portTypeName" value="MyEndpoint"/>
    <property name="serviceName" value="My" />
    <property name="locationUri" value="/endpoints"/>
</bean>

我当前的Wsdl文件

 <?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://myws.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://myws.com" targetNamespace="http://myws.com">
  <wsdl:types>
<xsd:schema xmlns:person="http://myws.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://myws.com">
<xsd:include schemaLocation="MyDetails.xsd"/>
<xsd:element name="myRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ID" type="xsd:string"/>
<xsd:element name="NAME" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="myResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="STATUS" type="xsd:string"/>
<xsd:element name="TEXT" type="xsd:string"/>
</xsd:sequence>
    </xsd:complexType>
</xsd:element>
</xsd:schema>
  </wsdl:types>
   <wsdl:message name="myResponse">
<wsdl:part element="tns:myResponse" name="myResponse">
</wsdl:part>
  </wsdl:message>
  <wsdl:message name="myRequest">
<wsdl:part element="tns:myRequest" name="myRequest">
</wsdl:part>
  </wsdl:message>
  <wsdl:portType name="MyEndpoint">
<wsdl:operation name="My">
  <wsdl:input message="tns:MyRequest" name="MyRequest">
</wsdl:input>
  <wsdl:output message="tns:MyResponse" name="MyResponse">
</wsdl:output>
</wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="MyEndpointSoap11" type="tns:MyEndpoint">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="My">
  <soap:operation soapAction=""/>
  <wsdl:input name="MyRequest">
    <soap:body use="literal"/>
  </wsdl:input>
  <wsdl:output name="MyResponse">
    <soap:body use="literal"/>
  </wsdl:output>
</wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="MyWS">
    <wsdl:port binding="tns:MyEndpointSoap11" name="MyEndpointSoap11">
  <soap:address location="http://127.0.0.1:8080/miWS/"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

我的预期wsdl

     <?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://myws.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://myws.com" targetNamespace="http://myws.com">

  <wsdl:message name="myResponse">
    <wsdl:part element="tns:myResponse" name="myResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="myRequest">
    <wsdl:part element="tns:myRequest" name="myRequest">
</wsdl:part>
  </wsdl:message>
  <wsdl:portType name="MyEndpoint">
    <wsdl:operation name="My">
  <wsdl:input message="tns:MyRequest" name="MyRequest">
    </wsdl:input>
  <wsdl:output message="tns:MyResponse" name="MyResponse">
    </wsdl:output>
    </wsdl:operation>
    </wsdl:portType>
  <wsdl:binding name="MyEndpointSoap11" type="tns:MyEndpoint">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="My">
  <soap:operation soapAction=""/>
  <wsdl:input name="MyRequest">
    <soap:body use="literal"/>
  </wsdl:input>
  <wsdl:output name="MyResponse">
    <soap:body use="literal"/>
  </wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyWS">
<wsdl:port binding="tns:MyEndpointSoap11" name="MyEndpointSoap11">
  <soap:address location="http://127.0.0.1:8080/miWS/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

请告知

由于

0 个答案:

没有答案