当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Hide Request and response xsd elements from the autogenerated wsdl

问题描述:

I'm using spring + XSD+ JAXB for soap webservices, i used the below spring configuration and given inline property as false, i'm currently able to get the autogenerated WSDL with < wsdl:types > but my expected result should not have < wsdl:types >.

my 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>

My Current Wsdl file

 <?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>

my expected 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>

Please advise

Thanks

分享给朋友:
您可能感兴趣的文章:
随机阅读: