WCF-Oracle适配器错误 - 空值 [英] WCF-Oracle Adapter Error - Null Value

查看:122
本文介绍了WCF-Oracle适配器错误 - 空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





使用WCF_Oracle适配器时出错。

发送到适配器的消息"WCF-OracleDB"在发送端口"Send_InsertOracleDB"上使用URI"oracledb://abc.MyUri.com/"暂停。 

 错误详细信息:Microsoft.ServiceModel.Channels.Common.XmlReaderParsingException:字段"USERID"的值是无效的。
---> System.ArgumentNullException:值不能为null。


参数名称:numStr



这里,'USERID'的值为null / empty。虽然'USERID'元素有  Nillable  as  True    Min
发生 
as   0. 
Oracle数据库中,它的数据类型是"NUMBER"。


此模式由"添加生成的项目"生成。我没有使用任何SP。它是一个生成的简单插入模式。

Hi,

I get an error while using WCF_Oracle adapter.
A message sent to adapter "WCF-OracleDB" on send port "Send_InsertOracleDB" with URI "oracledb://abc.MyUri.com/" is suspended. 
 Error details: Microsoft.ServiceModel.Channels.Common.XmlReaderParsingException: The value for field "USERID" is invalid. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: numStr

Here, the value that goes to 'USERID' is null/empty. Although 'USERID' element has Nillable as True and Min Occurs as 0. In Oracle database it's datatype is "NUMBER".
This schema is generated by the "Add Generated Items". I'm not using any SP. It's a simple insertion schema that is generated.

我还发布了
线程中的
< span style ="color:#333333;主持人已标记为答案的字体大小:小"> 。所以,我从那里继续:

I have also posted this in a thread which a moderator has marked as answer. So, I'm continuing from there:

1.在那里建议的方法(Nil Value)在我的情况下是不可行的。我们有很多有很多元素的模式。如果我是
没有错,那么我们需要将这个逻辑应用于任何元素的每个元素都可以有null值。还有其他方法吗?

2.如果Nil Value functoid是唯一的选项,那么在这种情况下如何将逻辑函数组合作为我的场景
将是如果传入元素为空/ Null然后将Nil值分配给Out元素,否则分配Inbound Element的值。(这可能很简单,但我没有使用functoid。)

2. If Nil Value functoid is the only option then how to put that with the combination of logical functiod as my scenario in that case will be that if the incoming element is empty/Null then assign Nil Value to the Out Element else the value of the Inbound Element. ( This could be simple but I haven't worked much with functoids. )

Kunal G

推荐答案

您好Kunal,

Hi Kunal ,

有两种方法可以修复这个问题我也在WCF中面临同样的问题 - Oracle适配器。

There are  2 ways to fix this issue and i also faced same issue in WCF - Oracle adapter .

1.自定义XSLT:

以下实施自定义XSLT或脚本Functoid中的逻辑(XSLT模板)

Implement below logic in Custom XSLT or Script Functoid (XSLT template )

< ns0:UNIT_WEIGHT >

           < xsl:选择 >

             < xsl:when
测试 = " s1:PackageWeight " >

              <xsl:when test="s1:PackageWeight">

               < xsl:value-of
选择 = " s1:PackageWeight / text()"
/>

                <xsl:value-of select="s1:PackageWeight/text()" />

             < / xsl:when >

             < xsl:否则 >

               < xsl:属性
名称 = " xsi:nil " > true < / xsl:attribute >

                <xsl:attribute name="xsi:nil">true</xsl:attribute>

             < / xsl:否则 >

           < / xsl:选择 >

         < / ns0:UNIT_WEIGHT >

2.Nil Functoid:

下图显示了在测试传入元素的现有时如何使用nil functoid。

 

检查输入字段是否存在
,如果是这样,值映射
 写入传入的值,反向
 写入零值
  ...

 

测试它是确定的,它的工作方式与编写自定义XSLT,如果提供则推送值,否则将其设为零。

 

希望这个帮助

问候,

Kapil。


这篇关于WCF-Oracle适配器错误 - 空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆