Hi,

I have a webservice based on a POJO. The webservice method returns an
array of custom object, like

BankResult[] checkAccount(Bank)

Axis2 generates a wsdl containg an error: the resulting element doesn't
contain any name, like:

<xs:element name="checkAccountResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element maxOccurs="unbounded" minOccurs="0"
nillable="true" type="ax28:BankResult"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

Ok, I modified the wsdl and define the name of the resulting element
like:

<xs:element name="checkAccountResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element maxOccurs="unbounded" minOccurs="0"
name="return" nillable="true" type="ax28:BankResult"/>
                    </xs:sequence>
                </xs:complexType>
</xs:element>

The next problem is, the SOAP response message contains an attribute,
where the wsdl doesn't define this attribute, like

<?xml version="1.0" encoding="http://www.w3.org/2003/05/soap-envelope";
standalone="no"?>
<soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope";>
<soapenv:Body>
<checkAccountResponse xmlns="http://bank.ws.uniserv";>
<return type="uniserv.ws.bank.BankResult">
<<<<=============================== the attribute 'type' is not defined
by the wsdl!
<bankCodeNumber/>
<bankName/>
<bankNetwork/>
<bankSector/>
<bic/>
<cdMethod/>
<city/>
<clearingArea/>
<country/>
<errorMsg/>
<iban/>
<mvals/>
<officeType/>
<quality>0</quality>
<replaceBcn/>
<resultAccount>0</resultAccount>
<resultClass>0</resultClass>
<resultText/>
<retInfo>0</retInfo>
<retType>-1</retType>
<street/>
<zip/>
</return>
</checkAccountResponse>
</soapenv:Body>
</soapenv:Envelope>


The type BankResult is defined as:

<xs:complexType name="BankResult">
                <xs:sequence>
                    <xs:element minOccurs="0" name="bankCodeNumber"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="bankIdCode"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="bankName"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="bankNetwork"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="cdMethod"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="city"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="clearingArea"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="country"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="errorMsg"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="iban"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="mvals"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="officeType"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="quality"
nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="resultAccount"
type="xs:int"/>
                    <xs:element minOccurs="0" name="resultClass"
type="xs:int"/>
                    <xs:element minOccurs="0" name="zip" nillable="true"
type="xs:string"/>
                </xs:sequence>
</xs:complexType>


I'm able to create the client stub using the WSDL2Java, but I get
following execption on executing the request:
Caused by: java.lang.Exception:
org.apache.axis2.databinding.ADBException: Unexpected subelement
bankCodeNumber

Does anyone have any idea how to handle this problem? Is it possible at
all to return an array of objects? Is there any other way do do that?

Thanks,
Fadila


Reply via email to