Issue
I have a web service written in Java by netbeans named "test". One of the methods gets a class called "BodyCollection" That includes several elements. the xsd File created in netbeans shows all the elements, but the WSDL file does not show the elements at all. What could be the reason?
Here is the xsd File:
<?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>
And here is the WSDL file:
<?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>
All the WSDL files examples I saw are with elements, and for some reason they do not appear in my file. I must emphasize that the web service works properly, but I want to understand what is the problem in my file. Can someone help me with this?
Solution
In your wsdl
you are importing xsd file(which is having all the elements) in to your wsdl you can find this code
<types>
<xsd:schema>
<xsd:import namespace="http://test.TelZar.com/"
schemaLocation="http://localhost:8080/WebApplication1/test?xsd=1"/>
</xsd:schema>
</types>
So thats why the reason you are unable to see all the elements.
Answered By - Prabhakar Manthena