我正在使用SSIS 2012创建一个包,该包将从Web服务检索数据并加载数据库。我已经在此包中成功创建了许多Web服务任务,这些任务调用此Web服务上的许多其他方法,但其中一个任务出现了问题。GetDeviceInfo
方法接受以下参数:
1.证书-调用WS登录方法后接收
- accountId -设备所在的帐户
- cmuId -特定设备的序列号
当使用任意cmuId调用该方法时,我知道该cmuId不存在(在本例中为1234567),XML响应(表示未找到记录)正确返回如下:
<?xml version="1.0" encoding="utf-16"?>
<ResponseModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<message xsi:nil="true" xmlns="http://schemas.datacontract.org/2004/07/CellocatorPlusModels" />
<state xmlns="http://schemas.datacontract.org/2004/07/CellocatorPlusModels">valueNotFound</state>
<timestamp xmlns="http://schemas.datacontract.org/2004/07/CellocatorPlusModels">6.36186059963802E+17</timestamp>
</ResponseModel>
但是,只要输入cmuId的有效值,SSIS就会抛出错误:
SSIS package "<redacted>\getData.dtsx" starting.
Error: 0xC002F304 at Web Service Task, Web Service Task: An error occurred with the following error message: "Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebserviceTaskException: Could not execute the Web method. The error is: There was an error generating the XML document..
at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebMethodInvokerProxy.InvokeMethod(DTSWebMethodInfo methodInfo, String serviceName, Object connection)
at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTaskUtil.Invoke(DTSWebMethodInfo methodInfo, String serviceName, Object connection, VariableDispenser taskVariableDispenser)
at Microsoft.SqlServer.Dts.Tasks.WebServiceTask.WebServiceTask.executeThread()".
Task failed: Web Service Task
SSIS package "<redacted>\getData.dtsx" finished: Success.
Web服务任务失败,响应不写入输出文件。
使用相同的参数从浏览器调用Web服务,返回以下内容,这正是我所期望的:
<ResponseModel xmlns="http://schemas.datacontract.org/2004/07/CellocatorPlusModels" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<message i:type="ExtendedUnitInfoModel">
<Account><..></Account>
<AccountId i:nil="true"/>
<AssemblyDate>05/13/2015</AssemblyDate>
<CMUID>1169817</CMUID>
<CurrentFWVersion>331</CurrentFWVersion>
<FWStatus>On Wait</FWStatus>
<FirstFWVersion i:nil="true"/>
<FirstPLVersion i:nil="true"/>
<FirstStatusDate>05/13/2015</FirstStatusDate>
<GroupID>22493</GroupID>
<GroupName>CR300B</GroupName>
<Modem>CR300B GE864</Modem>
<PLName i:nil="true"/>
<ProgStatus>Normal Operation</ProgStatus>
<Prov></Prov>
<ProviderId>5186</ProviderId>
<PurchaseOrder>SO28906.4</PurchaseOrder>
<SIMNumber/>
<SerialId/>
<ShipmentDate>06/07/2015</ShipmentDate>
<ShipmentTrackingNumber>8577</ShipmentTrackingNumber>
<TesterName>Arcam3</TesterName>
<TestingDate>05/14/2015</TestingDate>
<WarrantyExpDate>06/08/2016</WarrantyExpDate>
</message>
<state>success</state>
<timestamp>6.3618603925336154E+17</timestamp>
</ResponseModel>
我尝试过创建一个只包含此Web服务任务的独立包来进行故障排除,但结果相同。
由于我可以在这个WS上调用其他方法,当我指定一个不存在的设备时,任务可以正常运行,并且我可以在这些情况下正确地写入输出文件,所以我只能得出结论,这个响应中的某些内容格式错误,或者我错过了一些非常愚蠢的东西。
有什么主意吗?先谢了。
1条答案
按热度按时间unguejic1#
几年后再回到这个问题,我得出结论,这个问题是由于SSIS使用Web服务任务组件处理复杂XML时的一些特性造成的。
最终对我有效的解决方案是使用C#在
execute code
组件中实现该操作。下面是基本模板(仅解析单个字段以供演示)。也许这会帮助其他正在与类似问题作斗争的人。