Axis error: "No deserialiser"

If you are using Apache Axis for SOAP, then occur an error, when you return a subobject from web service operation (function). Error may be like this:

"No deserialiser ..."

The "deserialiser" is a XML expression in XML/WSDL text. Like this:

<complexType name="OperationResultInfo">

<sequence>

<element name="Description" nillable="true" type="xsd:anyType"/>

<element name="ResultId" nillable="true" type="xsd:anyType"/>

<element name="ResultObject" nillable="true" type="xsd:anyType"/>

<element name="ResultXML" nillable="true" type="xsd:anyType"/>

<element name="Type" nillable="true" type="xsd:anyType"/>

</sequence>

</complexType>


ColdFusion uses Apache Axis software, to service for SOAP. Apache Axis need a WSDL/XML text to recognize the web service operations. ColdFusion automatically generates, the WSDL/XML text, for web service and objects. But, if your object is a subobject, ColdFusion dos not include the deserialiser text (like above) in to WSDL/XML text, for object. To resolve this problem, you may create an operation/function in to web service, that returns it object. Then, ColdFusion include the deserialiser text to WSDL/XML text. See to GetAccountInfo() function:


<cfcomponent>

<cffunction name="Authentication" access="remote" output="false" returntype="OperationResultInfo">

<cfset var OperationResultInfo = CreateObject("component", "OperationResultInfo") />

<cfset var AccountInfo = CreateObject("component", "AccountInfo")/>

<cfset AccountInfo.AccountGuid = "Başardın Eşref! Helal sana."/>

<cfset OperationResultInfo.ResultObject = AccountInfo/>

<cfreturn OperationResultInfo>

</cffunction>


<cffunction name="GetAccountInfo" access="remote" output="false" returntype="AccountInfo">

<cfreturn CreateObject("component", "AccountInfo")>

</cffunction>

</cfcomponent>

ColdFusion see the GetAccountInfo() function, then include this deserialiser to the WSDL/XML text, and problem resolved:

<complexType name="AccountInfo">
<sequence>
<element name="AccountGuid" nillable="true" type="xsd:string"/>
<element name="Address" nillable="true" type="xsd:string"/>
<element name="BirthDate" nillable="true" type="xsd:string"/>
<element name="CityId" nillable="true" type="xsd:string"/>
<element name="CityName" nillable="true" type="xsd:string"/>
<element name="CountryId" nillable="true" type="xsd:string"/>
<element name="Email" nillable="true" type="xsd:string"/>
<element name="EmailNewsletterMember" nillable="true" type="xsd:string"/>
<element name="EmailVerified" nillable="true" type="xsd:string"/>
<element name="FootballTeamId" nillable="true" type="xsd:string"/>
<element name="FullName" nillable="true" type="xsd:string"/>
<element name="MobilePhoneNumber" nillable="true" type="xsd:string"/>
<element name="PhoneNumber" nillable="true" type="xsd:string"/>
<element name="Sex" nillable="true" type="xsd:string"/>
<element name="SmsNewsletterMember" nillable="true" type="xsd:string"/>
<element name="UserName" nillable="true" type="xsd:string"/>
</sequence>
</complexType>


0 yorum:

Diğer Yazılar