Java 从自动生成的wsdl中隐藏请求和响应xsd元素
我正在为soap Web服务使用spring+XSD+JAXB,我使用了下面的spring配置,并将内联属性设为false,我目前能够使用Java 从自动生成的wsdl中隐藏请求和响应xsd元素,java,xsd,jaxb,wsdl,spring-ws,Java,Xsd,Jaxb,Wsdl,Spring Ws,我正在为soap Web服务使用spring+XSD+JAXB,我使用了下面的spring配置,并将内联属性设为false,我目前能够使用获取自动生成的WSDL,但我的预期结果不应该具有 mybean.xml <bean id="MyWSService" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition" lazy-init="true"> <property name="schemaCo
<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>
schemas/servicecooperations.xsd
我当前的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>
请告知
谢谢我不太确定,但如果您更改DTO的名称空间,WSDL生成器可能会生成另一个xsd文件并将其导入到您的WSDL文件中。您预期的WSDL表示WSDL:part元素为“tns:myResponse”。您希望在哪里找到“myResponse”的XSD元素定义?我不太确定,但如果您更改DTO的命名空间,WSDL生成器可能会生成另一个XSD文件并将其导入WSDL文件。您期望的WSDL表示WSDL:part元素为“tns:myResponse”。您希望在哪里找到“myResponse”的XSD元素定义?