为什么我的wsdl不显示元素

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了为什么我的wsdl不显示元素相关的知识,希望对你有一定的参考价值。

我有一个名为“test”的netbeans用Java编写的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>

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

以上是关于为什么我的wsdl不显示元素的主要内容,如果未能解决你的问题,请参考以下文章

为什么我的WSDL仍然显示基本的http绑定与http的位置值?

谷歌地图不显示在片段中

WSDL 中的错误:文档不是定义文档元素

为啥选项卡和片段不显示?

Android 全屏片段不显示导航和状态栏后面的元素

axis2 wsdl生成java文件 参数类型与wsdl定义的不一样