0

We have custom java code that deployed in the JBoss. We are firing the webservice call and the WSDL file is generating by using the Apache Axis framework.

My question is for some of the tag, minOccurs and maxOccurs attribute is present, but for some other tag, those attributes are not present.

If I want minOccurs and maxOccurs attribute inside the element tag, then where I have to configure? How this Apache Axis framework will generate these attribute.

Sample WSDL :

<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" 
xmlns:impl="urn:sif.siperian.com" xmlns:intf="urn:sif.siperian.com" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
targetNamespace="urn:sif.siperian.com">
<!--
WSDL created by Apache Axis version: 1.3
Built on Oct 05, 2005 (05:23:37 EDT)
-->
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" targetNamespace="urn:sif.siperian.com">
<complexType name="Account">
<sequence>
<element name="accountNumber" nillable="true" type="xsd:string"/>
<element name="accountType" nillable="true" type="xsd:string"/>
<element name="cardholderName" nillable="true" type="xsd:string"/>
<element name="city" nillable="true" type="xsd:string"/>
<element name="expirationMonth" nillable="true" type="xsd:string"/>
<element name="expirationYear" nillable="true" type="xsd:string"/>
<element name="hubStateInd" nillable="true" type="xsd:string"/>
<element name="issuingCompany" nillable="true" type="xsd:string"/>
<element name="pkeySrcObject" nillable="true" type="xsd:string"/>
<element name="postalCode" nillable="true" type="xsd:string"/>
<element name="rowidObject" nillable="true" type="xsd:string"/>
<element name="securityCode" nillable="true" type="xsd:string"/>
<element name="source" nillable="true" type="xsd:string"/>
<element name="stateProvince" nillable="true" type="xsd:string"/>
<element name="streetName" nillable="true" type="xsd:string"/>
</sequence>
</complexType>

<complexType name="ArrayOfAccount">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" 
type="impl:Account"/>
</sequence>
</complexType>

</schema>
</wsdl:types>
</wsdl:definitions>

In the above WSDL, the <complexType name="Account"> is not having property minOccurs and maxOccurs.

Where as, the <complexType name="ArrayOfAccount"> is having both the properties.

Machavity
  • 30,841
  • 27
  • 92
  • 100
Arvind Katte
  • 995
  • 2
  • 10
  • 20

1 Answers1

0

The following is a Java Code sample on how to build the following element:

<element maxOccurs="1" minOccurs="0" name="Test" nillable="true" type="xsd:string"/> 

Java Code:

elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("test");
elemField.setXmlName(new javax.xml.namespace.QName("http://www.test.com", "Test"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(true);

Hope this helps.

Neo
  • 779
  • 5
  • 13