Hi all,

I've been researching Axis capabilities about last several weeks.
I'm exited your job, guys, but I need more "complexType" handling
for projects of company I'm working in.

Nuno Guerreiro mentioned about working with passing via SOAP structure like:

<account>
  <number>49584</number>
  <type>DDA</type>
  <money>
    <amount>494.34</amount>
    <currency>EUR</currency>
  </money>
</account>

[List:     axis-user
Subject:  default java beans serializer/deserializer
From:     Nuno Guerreiro <[EMAIL PROTECTED]>
Date:     2002-02-14 22:59:08
]

I've got a little bit similar task: to send via SOAP some complex structure named
Contract to my web service which, in turn, dispatches it to Contract handlers.
Schema structure looks like:

ContractTypesSimplified.xsd
-------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema mlns:xsd="http://www.w3.org/2001/XMLSchema";
   targetNamespace="http://model.ndd.com";
   xmlns="http://model.ndd.com";
   elementFormDefault="qualified"
   attributeFormDefault="unqualified">

 <xsd:complexType name = "ContractHeaderType">
  xsd:sequence>
  <xsd:element name = "Name" type = "xsd:string"/>
  <xsd:element name = "Resource" type = "xsd:string"/>
  <xsd:element name = "Operation" type = "xsd:string"/>
  <xsd:element name = "Version" type = "VersionType"/>
  /xsd:sequence>
 </xsd:complexType>

 <xsd:simpleType name = "VersionType">
  xsd:restriction base = "xsd:string">
  <xsd:pattern value = "(\d+\.?)+"/>
  /xsd:restriction>
 </xsd:simpleType>

 <xsd:complexType name = "ContractBodyType" abstract = "true">
  xsd:complexContent>
  <xsd:extension base = "ContractHeaderType">
   <xsd:sequence>
    xsd:element name = "Cookie" type = "xsd:string" minOccurs = "0"/>
   </xsd:sequence>
  </xsd:extension>
  /xsd:complexContent>
 </xsd:complexType>

 <xsd:complexType name = "NDDStandardBody">
  xsd:complexContent>
  <xsd:extension base = "ContractBodyType">
   <xsd:sequence>
    xsd:element name = "Identity" type = "IdentityType"/>
    xsd:element name = "SourceId" type = "SourceIdType"/>
    xsd:element name = "UserId" type = "UserIdType"/>
   </xsd:sequence>
  </xsd:extension>
  /xsd:complexContent>
 </xsd:complexType>

 <xsd:simpleType name = "UserIdType">
  xsd:restriction base = "xsd:string"/>
 </xsd:simpleType>

 <xsd:simpleType name = "SourceIdType">
  xsd:restriction base = "xsd:string"/>
 </xsd:simpleType>

 <xsd:simpleType name = "IdentityType">
  xsd:restriction base = "xsd:string">
  <xsd:enumeration value = "GUI"/>
  <xsd:enumeration value = "CAF"/>
  <xsd:enumeration value = "Scheduler"/>
  /xsd:restriction>
 </xsd:simpleType>

 <xsd:simpleType name = "DiscrepancyIdType">
  xsd:restriction base = "xsd:nonNegativeInteger"/>
 </xsd:simpleType>

 <xsd:element name = "NDDRCNCloseBody">
  xsd:complexType>
  <xsd:complexContent>
   <xsd:extension base = "NDDStandardBody">
    xsd:sequence>
    <xsd:element name = "RCNList">
     <xsd:complexType>
      xsd:sequence>
      <xsd:element name = "RCNClose" maxOccurs = "unbounded">
       <xsd:complexType>
        xsd:sequence>
        <xsd:element name = "DiscrepancyId" type = "DiscrepancyIdType"/>
        /xsd:sequence>
       </xsd:complexType>
      </xsd:element>
      /xsd:sequence>
     </xsd:complexType>
    </xsd:element>
    /xsd:sequence>
   </xsd:extension>
  </xsd:complexContent>
  /xsd:complexType>
 </xsd:element>

</xsd:schema>
-------------------------------------------

WSDL file:

DiscoveryContractServiceSimple.wsdl
-------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<definitions  mlns="http://schemas.xmlsoap.org/wsdl/";
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
  xmlns:tns="http://service.ndd.com";
  xmlns:types="http://model.ndd.com";
  xmlns:xsd="http://www.w3.org/2001/XMLSchema";
  name="DiscoveryContractService"
  targetNamespace="http://service.ndd.com";>

    <import location="ContractTypesSimplified.xsd" namespace="http://model.ndd.com"/>

 <!--  handle NDDRCNCloseBody  -->
 <message name="DiscoveryContractMsg">
  part name="contract" type="types:NDDRCNCloseBody"/>
 </message>

 <message name="DiscoveryContractResultMsg">
  part name="result" type="xsd:string"/>
 </message>

 <portType name="DiscoveryContractServicePortType">
  operation name="handleContract">
  <input message="tns:DiscoveryContractMsg"/>
  <output message="tns:DiscoveryContractResultMsg"/>
  /operation>
 </portType>


 <binding name="DiscoveryContractServiceBinding" 
type="tns:DiscoveryContractServicePortType">

  soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

  operation name="handleContract">
  <soap:operation soapAction="http://service.ndd.com#handleContract"/>
  <input>
   <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
namespace="http://service.ndd.com"; use="encoded"/>
  </input>
  <output>
   <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
namespace="http://service.ndd.com"; use="encoded"/>
  </output>
  /operation>

 </binding>

</definitions>
-------------------------------------------

I  launched

java -cp "MyClasspath" apache.axis.wsdl.WSDL2Java -s 
DiscoveryContractServiceSimple.wsdl

and obtained:

Parsing XML file:  
C:\Projects\MyWebServices\DiscoveryContractHierService\xml\DiscoveryContractServiceSimple.wsdl
java.io.IOException: Type http://www.w3.org/2001/XMLSchema:nonNegativeInteger is 
referenced but not defined.
        at org.apache.axis.wsdl.toJava.SymbolTable.checkForUndefined(Unknown Source)
        at org.apache.axis.wsdl.toJava.SymbolTable.add(Unknown Source)
        at org.apache.axis.wsdl.toJava.Emitter.emit(Unknown Source)
        at org.apache.axis.wsdl.toJava.Emitter.emit(Unknown Source)
        at org.apache.axis.wsdl.WSDL2Java.emit(Unknown Source)
        at org.apache.axis.wsdl.WSDL2Java.main(Unknown Source)

It was strange for me, that Emmiter didn't understand 'nonNegativeInteger'
though it seems to be standart schema type. After changing

<xsd:simpleType name = "DiscrepancyIdType">
  xsd:restriction base = "xsd:nonNegativeInteger"/>
</xsd:simpleType>

to

<xsd:simpleType name = "DiscrepancyIdType">
  xsd:restriction base = "xsd:int"/>
</xsd:simpleType>

everything was generated OK. To be honest, I was wondered and gladdened
when my derived types has been generated as an hierarhy of bean classes
because when I did it earlier, NullPointerException was
throwed (and it was my intial question how to overcome it). I even goes to
develop my own derived complex types handling but now I see needless of that :).

Thank you, guys, for you job!
If I'd have sufficient quialification and time, I'd participate in your project
(with your permission of course), but I still need to learn many things around web 
services.


Best regards,
 Alex Krotov
<?xml version="1.0" encoding="UTF-8"?>
<definitions 	xmlns="http://schemas.xmlsoap.org/wsdl/"; 
			xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
			xmlns:tns="http://service.ndd.com"; 
			xmlns:types="http://model.ndd.com"; 
			xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
			name="DiscoveryContractService" 
			targetNamespace="http://service.ndd.com";>
			
   	<import location="ContractTypesSimplified.xsd" namespace="http://model.ndd.com"/>

	<!--  handle NDDRCNCloseBody 	-->
	<message name="DiscoveryContractMsg">
		<part name="contract" type="types:NDDRCNCloseBodyType"/>
	</message>

	<message name="DiscoveryContractResultMsg">
		<part name="result" type="xsd:string"/>
	</message>
	
	<portType name="DiscoveryContractServicePortType">
		<operation name="handleContract">
			<input message="tns:DiscoveryContractMsg"/>			
			<output message="tns:DiscoveryContractResultMsg"/>
		</operation>
	</portType>

	
	<binding name="DiscoveryContractServiceBinding" type="tns:DiscoveryContractServicePortType">
		
		<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
		
		<operation name="handleContract">
			<soap:operation soapAction="http://service.ndd.com#handleContract"/>
			<input>
				<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://service.ndd.com"; use="encoded"/>
			</input>
			<output>
				<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; namespace="http://service.ndd.com"; use="encoded"/>
			</output>
		</operation>
		
	</binding>

</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema	xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
				targetNamespace="http://model.ndd.com"; 
				xmlns="http://model.ndd.com";
				elementFormDefault="qualified" 
				attributeFormDefault="unqualified">
	
	<xsd:complexType name = "ContractHeaderType">
		<xsd:sequence>
			<xsd:element name = "Name" type = "xsd:string"/>
			<xsd:element name = "Resource" type = "xsd:string"/>
			<xsd:element name = "Operation" type = "xsd:string"/>
			<xsd:element name = "Version" type = "VersionType"/>
		</xsd:sequence>
	</xsd:complexType>

	<xsd:simpleType name = "VersionType">
		<xsd:restriction base = "xsd:string">
			<xsd:pattern value = "(\d+\.?)+"/>
		</xsd:restriction>
	</xsd:simpleType>
	
	<xsd:complexType name = "ContractBodyType" abstract = "true">
		<xsd:complexContent>
			<xsd:extension base = "ContractHeaderType">
				<xsd:sequence>
					<xsd:element name = "Cookie" type = "xsd:string" minOccurs = "0"/>
				</xsd:sequence>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>
		
	<xsd:complexType name = "NDDStandardBody">
		<xsd:complexContent>
			<xsd:extension base = "ContractBodyType">
				<xsd:sequence>
					<xsd:element name = "Identity" type = "IdentityType"/>
					<xsd:element name = "SourceId" type = "SourceIdType"/>
					<xsd:element name = "UserId" type = "UserIdType"/>
				</xsd:sequence>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>

	<xsd:simpleType name = "UserIdType">
		<xsd:restriction base = "xsd:string"/>
	</xsd:simpleType>
	
	<xsd:simpleType name = "SourceIdType">
		<xsd:restriction base = "xsd:string"/>
	</xsd:simpleType>
	
	<xsd:simpleType name = "IdentityType">
		<xsd:restriction base = "xsd:string">
			<xsd:enumeration value = "GUI"/>
			<xsd:enumeration value = "CAF"/>
			<xsd:enumeration value = "Scheduler"/>
		</xsd:restriction>
	</xsd:simpleType>

	<xsd:simpleType name = "DiscrepancyIdType">
		<xsd:restriction base = "xsd:int"/>
	</xsd:simpleType>

	<xsd:complexType name = "NDDRCNCloseBodyType">
		<xsd:complexContent>
			<xsd:extension base = "NDDStandardBody">
				<xsd:sequence>
					<xsd:element name = "RCNList">
						<xsd:complexType>
							<xsd:sequence>
								<xsd:element name = "RCNClose" maxOccurs = "unbounded">
									<xsd:complexType>
										<xsd:sequence>
											<xsd:element name = "DiscrepancyId" type = "DiscrepancyIdType"/>
										</xsd:sequence>
									</xsd:complexType>
								</xsd:element>
							</xsd:sequence>
						</xsd:complexType>
					</xsd:element>
				</xsd:sequence>
			</xsd:extension>
		</xsd:complexContent>
	</xsd:complexType>

	<xsd:element name = "NDDRCNCloseBody" type="NDDRCNCloseBodyType"/>
	
</xsd:schema>

Reply via email to