The project I'm working on is a billing interface for a Video on Demand system. When I send in my purchase object, I get back a TResult object which consisists of a return code (int) and errorText (String). Deserialization of this object works flawlessly.
But when making a query to find out how much available credit a customer has I get back both a TResult and a complex type of a TCustomerFinancial (see SOAP response below). It contains an array object called TMetadataList. So I thought I needed to add the following to my client-config.wsdd:
<typeMapping qname="ns:TMetadataList" xmlns:ns="urn:GlobalSOAPTyes" type="java:com.ncube.vod.bps.billing.obi.TMetadata[]"
serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
This hasn't had any effect. I still receive the dreaded "Bad types" exception:
Nov 11, 2004 2:31:56 PM org.apache.axis.client.Call invoke
SEVERE: Exception:
org.xml.sax.SAXException: Bad types (class com.ncube.vod.bps.billing.obi.TCustomerFinancial -> class com.ncube.vod.bps.billing.obi.TResult)
at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:282)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1025)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:159)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1138)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:308)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:342)
at org.apache.axis.client.Call.invoke(Call.java:2420)
at org.apache.axis.client.Call.invoke(Call.java:2319)
at org.apache.axis.client.Call.invoke(Call.java:1776)
at com.ncube.vod.bps.billing.obi.IOBISMSClientbindingStub.customerFinancialGet(IOBISMSClientbindingStub.java:524)
at com.ncube.vod.bps.billing.OBIClient.parseBalanceRequest(OBIClient.java:153)
at com.ncube.vod.bps.billing.BillService.parseXML(BillService.java:124)
at com.ncube.vod.bps.ops.BillingOp.initialHandleNote(BillingOp.java:407)
at com.ncube.vod.bps.ops.BillingOp.processNotification(BillingOp.java:214)
at com.ncube.vod.operation.OpsCenter.processNotification(OpsCenter.java:258)
at com.ncube.vod.istruct.Filter.processNetworkMessage(Filter.java:148)
at com.ncube.vod.istruct.QManager$FilterThread.run(QManager.java:250)
The WSDL defines TCustomerFinancial as:
<xs:complexType name="TCustomerFinancial"> <xs:sequence> <xs:element name="RemainingCreditLimit" type="xs:double"/> <xs:element name="CurrentBalance" type="xs:double"/> <xs:element name="MonthlyCreditLimit" type="xs:double"/> <xs:element name="LastBillAmt" type="xs:double"/> <xs:element name="LastBillDate" type="xs:dateTime"/> <xs:element name="LastCycleCloseDate" type="xs:dateTime"/> <xs:element name="LastPaymentAmt" type="xs:double"/> <xs:element name="LastPaymentDate" type="xs:dateTime"/> <xs:element name="TotalBalanceDue" type="xs:double"/> <xs:element name="Due30" type="xs:double"/> <xs:element name="Due60" type="xs:double"/> <xs:element name="Due90" type="xs:double"/> <xs:element name="Due120" type="xs:double"/> <xs:element name="MetadataList" type="ns2:TMetadataList"/> </xs:sequence>
And TMetadataList is defined:
<xs:schema targetNamespace="urn:uGlobalSOAPTypes" xmlns="urn:uGlobalSOAPTypes">
<xs:complexType name="TMetadataList">
<xs:complexContent>
<xs:restriction base="soapenc:Array">
<xs:sequence/>
<xs:attribute ref="soapenc:arrayType" n1:arrayType="ns2:TMetadata[]" xmlns:n1="http://schemas.xmlsoap.org/wsdl/"/>
</xs:restriction>
</xs:complexContent>
TMetatdata itself is:
<xs:complexType name="TMetadata"> <xs:sequence> <xs:element name="Tag" type="xs:string"/> <xs:element name="Value" type="xs:anyType"/> </xs:sequence> </xs:complexType>
The response from the SOAP server is:
HTTP/1.1 200 OK Connection: keep-alive Content-Type: text/xml Content-Length: 1543 Server: Indy/9.0.11
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body SOAP-ENC:encodingStyle="http://schemas.xmlsoap.org/soap/envelope/">
<NS1:CustomerFinancialGetResponse xmlns:NS1="urn:uOBI_Intf-IOBISMSClient" xmlns:NS2="urn:uGlobalSOAPTypes" xmlns:NS3="urn:uOBI_Intf">
<NS2:TResult id="1" xsi:type="NS2:TResult">
<ResultCode xsi:type="xsd:int">0</ResultCode>
<ResultText xsi:type="xsd:string">OK</ResultText>
</NS2:TResult>
<return href="#1"/>
<NS3:TCustomerFinancial id="2" xsi:type="NS3:TCustomerFinancial">
<RemainingCreditLimit xsi:type="xsd:double">199.99</RemainingCreditLimit>
<CurrentBalance xsi:type="xsd:double">0</CurrentBalance>
<MonthlyCreditLimit xsi:type="xsd:double">0</MonthlyCreditLimit>
<LastBillAmt xsi:type="xsd:double">0</LastBillAmt>
<LastBillDate xsi:nil="true"/>
<LastCycleCloseDate xsi:nil="true"/>
<LastPaymentAmt xsi:type="xsd:double">0</LastPaymentAmt>
<LastPaymentDate xsi:nil="true"/>
<TotalBalanceDue xsi:type="xsd:double">0</TotalBalanceDue>
<Due30 xsi:type="xsd:double">0</Due30>
<Due60 xsi:type="xsd:double">0</Due60>
<Due90 xsi:type="xsd:double">0</Due90>
<Due120 xsi:type="xsd:double">0</Due120>
<MetadataList xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="NS2:TMetadata[0]"/>
</NS3:TCustomerFinancial>
<CustomerFinancial href="#2"/>
</NS1:CustomerFinancialGetResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>