java - 为什么我的 wsdl 不显示元素

标签 java web-services netbeans wsdl

我有一个名为“test”的 netbeans 用 Ja​​va 编写的 Web 服务。 其中一种方法获取名为“BodyCollection”的类,其中包含多个元素。 netbeans 中创建的 xsd 文件显示了所有元素,但 WSDL 文件根本不显示元素。 可能是什么原因?

这是 xsd 文件:

<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.3 (tags/2.3-7528; 2013-04-29T19:34:10+0000) JAXWS-RI/2.2.8 JAXWS/2.2 svn-revision#unknown. --><xs:schema xmlns:tns="http://test.TelZar.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://test.TelZar.com/">

<xs:element name="Check_Response" type="tns:Check_Response"/>

<xs:element name="Check_ResponseResponse" type="tns:Check_ResponseResponse"/>

<xs:element name="InterruptedException" type="tns:InterruptedException"/>

<xs:element name="execute" type="tns:execute"/>

<xs:element name="executeResponse" type="tns:executeResponse"/>

<xs:element name="getting_started" type="tns:getting_started"/>

<xs:element name="getting_startedResponse" type="tns:getting_startedResponse"/>

<xs:complexType name="Check_Response">
<xs:sequence>
<xs:element name="bd" type="tns:bodyCollection" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="bodyCollection">
<xs:sequence>
<xs:element name="ACK_CODE" type="xs:string" minOccurs="0"/>
<xs:element name="ACK_DATE" type="xs:string" minOccurs="0"/>
<xs:element name="approvalInd" type="xs:string" minOccurs="0"/>
<xs:element name="essentialInfo1" type="xs:string" minOccurs="0"/>
<xs:element name="fromNumber" type="xs:string" minOccurs="0"/>
<xs:element name="identification_value" type="xs:string" minOccurs="0"/>
<xs:element name="networkType" type="xs:string" minOccurs="0"/>
<xs:element name="number" type="xs:string" minOccurs="0"/>
<xs:element name="numberType" type="xs:string" minOccurs="0"/>
<xs:element name="rejectReasonCode" type="xs:string" minOccurs="0"/>
<xs:element name="requestRetryDate" type="xs:string" minOccurs="0"/>
<xs:element name="requestTrxNo" type="xs:string" minOccurs="0"/>
<xs:element name="toNumber" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="Check_ResponseResponse">
<xs:sequence>
<xs:element name="return" type="tns:response" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="response">
<xs:sequence>
<xs:element name="ack" type="xs:string" minOccurs="0"/>
<xs:element name="date" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="InterruptedException">
<xs:sequence>
<xs:element name="message" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="getting_started">
<xs:sequence>
<xs:element name="Process_type" type="xs:string" minOccurs="0"/>
<xs:element name="To" type="xs:string" minOccurs="0"/>
<xs:element name="Network_type" type="xs:string" minOccurs="0"/>
<xs:element name="Number_type" type="xs:string" minOccurs="0"/>
<xs:element name="Number" type="xs:string" minOccurs="0"/>
<xs:element name="From_number" type="xs:string" minOccurs="0"/>
<xs:element name="To_number" type="xs:string" minOccurs="0"/>
<xs:element name="Identification_value" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="getting_startedResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="execute">
<xs:sequence>
<xs:element name="Anser" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="executeResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

这是 WSDL 文件:

<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.3 (tags/2.3-7528; 2013-04-29T19:34:10+0000) JAXWS-RI/2.2.8 JAXWS/2.2 svn-revision#unknown. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.3 (tags/2.3-7528; 2013-04-29T19:34:10+0000) JAXWS-RI/2.2.8 JAXWS/2.2 svn-revision#unknown. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://test.TelZar.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://test.TelZar.com/" name="test">
<types>
<xsd:schema>
<xsd:import namespace="http://test.TelZar.com/" schemaLocation="http://localhost:8080/WebApplication1/test?xsd=1"/>
</xsd:schema>
</types>
<message name="execute">
<part name="parameters" element="tns:execute"/>
</message>
<message name="executeResponse">
<part name="parameters" element="tns:executeResponse"/>
</message>
<message name="InterruptedException">
<part name="fault" element="tns:InterruptedException"/>
</message>
<message name="Check_Response">
<part name="parameters" element="tns:Check_Response"/>
</message>
<message name="Check_ResponseResponse">
<part name="parameters" element="tns:Check_ResponseResponse"/>
</message>
<message name="getting_started">
<part name="parameters" element="tns:getting_started"/>
</message>
<message name="getting_startedResponse">
<part name="parameters" element="tns:getting_startedResponse"/>
</message>
<portType name="test">
<operation name="execute">
<input wsam:Action="http://test.TelZar.com/test/executeRequest" message="tns:execute"/>
<output wsam:Action="http://test.TelZar.com/test/executeResponse" message="tns:executeResponse"/>
<fault message="tns:InterruptedException" name="InterruptedException" wsam:Action="http://test.TelZar.com/test/execute/Fault/InterruptedException"/>
</operation>
<operation name="Check_Response">
<input wsam:Action="http://test.TelZar.com/test/Check_ResponseRequest" message="tns:Check_Response"/>
<output wsam:Action="http://test.TelZar.com/test/Check_ResponseResponse" message="tns:Check_ResponseResponse"/>
<fault message="tns:InterruptedException" name="InterruptedException" wsam:Action="http://test.TelZar.com/test/Check_Response/Fault/InterruptedException"/>
</operation>
<operation name="getting_started">
<input wsam:Action="http://test.TelZar.com/test/getting_startedRequest" message="tns:getting_started"/>
<output wsam:Action="http://test.TelZar.com/test/getting_startedResponse" message="tns:getting_startedResponse"/>
<fault message="tns:InterruptedException" name="InterruptedException" wsam:Action="http://test.TelZar.com/test/getting_started/Fault/InterruptedException"/>
</operation>
</portType>
<binding name="testPortBinding" type="tns:test">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="execute">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="InterruptedException">
<soap:fault name="InterruptedException" use="literal"/>
</fault>
</operation>
<operation name="Check_Response">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="InterruptedException">
<soap:fault name="InterruptedException" use="literal"/>
</fault>
</operation>
<operation name="getting_started">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="InterruptedException">
<soap:fault name="InterruptedException" use="literal"/>
</fault>
</operation>
</binding>
<service name="test">
<port name="testPort" binding="tns:testPortBinding">
<soap:address location="http://localhost:8080/WebApplication1/test"/>
</port>
</service>
</definitions>

我看到的所有 WSDL 文件示例都带有元素,但出于某种原因它们没有出现在我的文件中。 我必须强调 Web 服务工作正常,但我想了解我的文件中的问题所在。 有人可以帮我解决这个问题吗?

最佳答案

在您的 wsdl 中,您正在将 xsd 文件(包含所有元素)导入到您的 wsdl 中,您可以找到这段代码

 <types>
    <xsd:schema>
    <xsd:import namespace="http://test.TelZar.com/" 
         schemaLocation="http://localhost:8080/WebApplication1/test?xsd=1"/>
    </xsd:schema>
    </types>

这就是为什么您无法看到所有元素的原因。

关于java - 为什么我的 wsdl 不显示元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20349285/

相关文章:

web-services - 可以使用浏览器发送 PUT 或 DELETE HTTP 请求吗?

.net - Web 服务更改方法响应而不通知客户端

java - 如何在 NetBeans servlet/jsp 元素中使用 html 和/或 css 样式?

java - Leiningen 2.2 -> 2.5 的重大变化

java - 使用 setOnScrollListener 时出现 ClassCastException 错误

java - 递归算法中的无限循环

java - 文本输出不保存到文件

web-services - 这是WSS3.0 Web服务查询中的错误吗?

java - 向现有类/构造函数添加新变量

javascript - 未声明 JS 命名空间 Netbeans 变量