我正在开发简单的 dss 服务,在该服务中,我根据一些输入参数检索客户详细信息。
在输出中,我显示 customer_id、first_name、last_name、mobile_number、电子邮件和客户状态。
现在,如果上述 6 个输出字段中的任何一个在数据库条目中为空白(即,如果客户的手机号码未在 DB 中输入)并且如果我尝试通过 dss 检索该客户详细信息,我不会在输出中获得客户详细信息。
只有当数据库的上述 6 个输出字段中有值时,才会检索该客户的详细信息。
我尝试将输出字段设置为可选,但这没有帮助。还尝试为输出字段提供默认值,但这也无济于事
以下是我的数据服务。
<data name="CustomerStatusManagementDssdirectconsole">
<config id="ildb">
<property name="carbon_datasource_name">il_database</property>
</config>
<query id="select_customer_details_by_any_parameter" useConfig="ildb">
<sql>select * from ildb_schema.customer_detail where identifier like :cust_id and first_name like :firstname and last_name like :lastname and mobile_number like :mobilenumber and email like :email</sql>
<result element="Customers" rowName="customer">
<element column="identifier" name="cid" xsdType="xs:string"/>
<element column="first_name" name="first_name" xsdType="xs:string"/>
<element column="last_name" name="last_name" xsdType="xs:string"/>
<element column="mobile_number" name="mobile_number" xsdType="xs:string"/>
<element column="user_status" name="user_status" xsdType="xs:string"/>
<element column="email" name="email" xsdType="xs:string"/>
</result>
<param name="cust_id" sqlType="STRING"/>
<param name="firstname" sqlType="STRING"/>
<param name="lastname" sqlType="STRING"/>
<param name="mobilenumber" sqlType="STRING"/>
<param name="email" sqlType="STRING"/>
</query>
<operation name="select_customer_details_by_any_parameter_operation">
<call-query href="select_customer_details_by_any_parameter">
<with-param name="cust_id" query-param="identifier"/>
<with-param name="firstname" query-param="first_name"/>
<with-param name="lastname" query-param="last_name"/>
<with-param name="mobilenumber" query-param="mobile_number"/>
<with-param name="email" query-param="email"/>
</call-query>
</operation>
</data>
Eg. If there is a customer with customer_id=110,first_name=abc,last_name=xyz,email=abc@some.com,mobile=<<blank>>,status=active
如果我在尝试服务选项时通过 dss 检索上述客户,我会得到以下输出,但没有客户的详细信息
<Customers xmlns="http://ws.wso2.org/dataservice"/>