You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Jean ANDRE <ja...@cmtek.com> on 2004/12/08 23:26:31 UTC
Cannot retrieve field after complex type !
I think I got the same error as Franklin All or a related one, In my
case, I can retrieve the next field after the complex type even if the
field is sent by the server. It gets always a null ptr or bad_ptr under
C++ of IDE .dotNet.
Here is my comments about this error::
1) First, when there is an attribute minOccurs inside an element, the
generated code doesn't check if the data is available.
In case of array, m_Size should be checked to make the program robust ?
2) The field after the complex type is sent by the server but Axis is
not able to retrieve it. In my case, the field is txnResponseID and it
gets a null ptr !
3 ) Is there something wrong when complex type are unbounded and
minOccurs = 0 ?
4) As the field "detail" is misssing inside the result xml, Axis is
lost ! The web service doesn't return this element at all neither the
elt with xsi:nil = true.
5) The program (a simple exe file under win32 console) has a bad
termination, on assertion Failed _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
6) So Samisa, if you can resolve as soon as possible our problem, it
would be very cool ! :).
7) You have already the WSDL to verify by your self.. If you need
something else, just write me!
8) Good luck and Take care !
The fragment of WSDL schema:
---------------------------------
<xs:complexType name="TxnRequestOrderDetail">
+ <xs:annotation>
<xs:sequence>
<xs:element name="type">
<xs:element name="carrier" minOccurs="0">
<xs:element name="shipTo" type="Contact" minOccurs="0" />
<xs:element name="shipMethod" minOccurs="0">
<xs:element name="trackingNumber" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="TxnResponse">
<xs:sequence>
<xs:element name="decision">
<xs:element name="code" type="xs:int">
<xs:element name="description" minOccurs="0">
<xs:element name="detail" minOccurs="0" maxOccurs="unbounded"
type="TxnResponseDetail" />
<xs:element name="txnResponseID" type="xs:string" />
<xs:element name="txnTime" type="xs:dateTime" />
</xs:sequence>
</xs:complexType>
The returned xml from the webservice
==========================
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns:creditResponse xmlns:ns='op'>
<ns:creditResult>
<ns:decision>ERROR</ns:decision>
<ns:code>28</ns:code>
<ns:description>XML Parsing Error</ns:description>
<ns:txnResponseID>-1</ns:txnResponseID>
<ns:txnTime>2004-12-08T16:23:41.965-05:00</ns:txnTime>
</ns:creditResult></ns:creditResponse> </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The involved C++ generated code
===========================
/*
* This static method deserialize a TxnResponse type of object
*/
int Axis_DeSerialize_TxnResponse(TxnResponse* param,
IWrapperSoapDeSerializer* pIWSDZ)
{
Axis_Array array;
param->decision = pIWSDZ->getElementAsString("decision",0);
param->code = pIWSDZ->getElementAsInt("code",0);
param->description = pIWSDZ->getElementAsString("description",0);
array = pIWSDZ->getCmplxArray((void*)Axis_DeSerialize_TxnResponseDetail
, (void*)Axis_Create_TxnResponseDetail,
(void*)Axis_Delete_TxnResponseDetail
, (void*)Axis_GetSize_TxnResponseDetail, "detail",
Axis_URI_TxnResponseDetail);
/* As the response detail is empty, array is null, a test should be
made on Array.m_Size ? */
/* if ( array.m_Size > 0 ) param->detail =
(TxnResponseDetail_Array&)array; */
param->detail = (TxnResponseDetail_Array&)array;
/* this field should be set and is not !!!!!, the getElementAsString
make an Error !!!! */
param->txnResponseID = pIWSDZ->getElementAsString("txnResponseID",0);
param->txnTime = pIWSDZ->getElementAsDateTime("txnTime",0);
return pIWSDZ->getStatus();
}
Jean A.
CANADA
- <#>
- <#>
+ <#>
- <#> <xs:annotation>
<xs:documentation>ACCEPTED, DECLINED, ERROR</xs:documentation>
</xs:annotation>
- <#> <xs:simpleType>
- <#> <xs:restriction base="*xs:string*">
<xs:enumeration value="*ACCEPTED*" />
<xs:enumeration value="*DECLINED*" />
<xs:enumeration value="*ERROR*" />
</xs:restriction>
</xs:simpleType>
</xs:element>
+ <#>
- <#> <xs:annotation>
<xs:documentation>A unique numeric code classifying this detail (e.g.
"32" might mean "missing parameter"). This is included to simplify
"switch" construct processing by the client</xs:documentation>
</xs:annotation>
</xs:element>
+ <#>
- <#> <xs:annotation>
<xs:documentation>a human readable description of the
tag</xs:documentation>
</xs:annotation>
- <#> <xs:simpleType>
- <#> <xs:restriction base="*xs:string*">
<xs:maxLength value="*100*" />
</xs:restriction>
</xs:simpleType>
</xs:element>
- <#>
Re: Cannot retrieve field after complex type !
Posted by Samisa Abeysinghe <sa...@gmail.com>.
Hopefully, minOccures = 0 and nil = true would be handled in 1.5.
There are some Jira issues (bug reports) recorded on them.
Thanks,
Samisa...
On Wed, 08 Dec 2004 17:26:31 -0500, Jean ANDRE <ja...@cmtek.com> wrote:
> I think I got the same error as Franklin All or a related one, In my
> case, I can retrieve the next field after the complex type even if the
> field is sent by the server. It gets always a null ptr or bad_ptr under
> C++ of IDE .dotNet.
>
> Here is my comments about this error::
> 1) First, when there is an attribute minOccurs inside an element, the
> generated code doesn't check if the data is available.
> In case of array, m_Size should be checked to make the program robust ?
>
> 2) The field after the complex type is sent by the server but Axis is
> not able to retrieve it. In my case, the field is txnResponseID and it
> gets a null ptr !
>
> 3 ) Is there something wrong when complex type are unbounded and
> minOccurs = 0 ?
>
> 4) As the field "detail" is misssing inside the result xml, Axis is
> lost ! The web service doesn't return this element at all neither the
> elt with xsi:nil = true.
>
> 5) The program (a simple exe file under win32 console) has a bad
> termination, on assertion Failed _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
>
> 6) So Samisa, if you can resolve as soon as possible our problem, it
> would be very cool ! :).
>
> 7) You have already the WSDL to verify by your self.. If you need
> something else, just write me!
>
> 8) Good luck and Take care !
>
> The fragment of WSDL schema:
> ---------------------------------
> <xs:complexType name="TxnRequestOrderDetail">
> + <xs:annotation>
> <xs:sequence>
> <xs:element name="type">
> <xs:element name="carrier" minOccurs="0">
> <xs:element name="shipTo" type="Contact" minOccurs="0" />
> <xs:element name="shipMethod" minOccurs="0">
> <xs:element name="trackingNumber" type="xs:string" minOccurs="0" />
> </xs:sequence>
> </xs:complexType>
>
> <xs:complexType name="TxnResponse">
> <xs:sequence>
> <xs:element name="decision">
> <xs:element name="code" type="xs:int">
> <xs:element name="description" minOccurs="0">
> <xs:element name="detail" minOccurs="0" maxOccurs="unbounded"
> type="TxnResponseDetail" />
> <xs:element name="txnResponseID" type="xs:string" />
> <xs:element name="txnTime" type="xs:dateTime" />
> </xs:sequence>
> </xs:complexType>
>
> The returned xml from the webservice
> ==========================
> <?xml version="1.0" encoding="utf-8"?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <SOAP-ENV:Body>
> <ns:creditResponse xmlns:ns='op'>
> <ns:creditResult>
> <ns:decision>ERROR</ns:decision>
> <ns:code>28</ns:code>
> <ns:description>XML Parsing Error</ns:description>
> <ns:txnResponseID>-1</ns:txnResponseID>
> <ns:txnTime>2004-12-08T16:23:41.965-05:00</ns:txnTime>
> </ns:creditResult></ns:creditResponse> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> The involved C++ generated code
> ===========================
>
> /*
> * This static method deserialize a TxnResponse type of object
> */
> int Axis_DeSerialize_TxnResponse(TxnResponse* param,
> IWrapperSoapDeSerializer* pIWSDZ)
> {
> Axis_Array array;
> param->decision = pIWSDZ->getElementAsString("decision",0);
> param->code = pIWSDZ->getElementAsInt("code",0);
> param->description = pIWSDZ->getElementAsString("description",0);
> array = pIWSDZ->getCmplxArray((void*)Axis_DeSerialize_TxnResponseDetail
> , (void*)Axis_Create_TxnResponseDetail,
> (void*)Axis_Delete_TxnResponseDetail
> , (void*)Axis_GetSize_TxnResponseDetail, "detail",
> Axis_URI_TxnResponseDetail);
>
> /* As the response detail is empty, array is null, a test should be
> made on Array.m_Size ? */
> /* if ( array.m_Size > 0 ) param->detail =
> (TxnResponseDetail_Array&)array; */
> param->detail = (TxnResponseDetail_Array&)array;
>
> /* this field should be set and is not !!!!!, the getElementAsString
> make an Error !!!! */
> param->txnResponseID = pIWSDZ->getElementAsString("txnResponseID",0);
>
> param->txnTime = pIWSDZ->getElementAsDateTime("txnTime",0);
> return pIWSDZ->getStatus();
> }
>
> Jean A.
> CANADA
>
> - <#>
> - <#>
> + <#>
> - <#> <xs:annotation>
> <xs:documentation>ACCEPTED, DECLINED, ERROR</xs:documentation>
> </xs:annotation>
> - <#> <xs:simpleType>
> - <#> <xs:restriction base="*xs:string*">
> <xs:enumeration value="*ACCEPTED*" />
> <xs:enumeration value="*DECLINED*" />
> <xs:enumeration value="*ERROR*" />
> </xs:restriction>
> </xs:simpleType>
> </xs:element>
> + <#>
> - <#> <xs:annotation>
> <xs:documentation>A unique numeric code classifying this detail (e.g.
> "32" might mean "missing parameter"). This is included to simplify
> "switch" construct processing by the client</xs:documentation>
> </xs:annotation>
> </xs:element>
> + <#>
> - <#> <xs:annotation>
> <xs:documentation>a human readable description of the
> tag</xs:documentation>
> </xs:annotation>
> - <#> <xs:simpleType>
> - <#> <xs:restriction base="*xs:string*">
> <xs:maxLength value="*100*" />
> </xs:restriction>
> </xs:simpleType>
> </xs:element>
>
> - <#>
>
>