XML文档中的错误 [英] Error in XML document

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

问题描述

我正在使用由Java,非Microsoft系统生成的Web服务。

响应将有两个复杂的元素。其中一个有一个数组

的物品。在我回到我的代码之前,系统会出现异常:

XML文档中的错误(2,1010)。


异常对象显示以下堆栈字符串:


_stackTraceString

at System.Number.ParseUInt32(String s,NumberStyles style,

NumberFormatInfo info)< System.UInt16.Parse(String s,NumberStyles样式,IFormatProvider

提供者)的

System.Xml.XmlConvert.ToUInt16的
(String s )

在System.Xml.Serialization.XmlCustomFormatter.ToChar(字符串值)

在System.Xml.Serialization.XmlSerializationReader.To Char(String

$)



Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read4_FindPurchaseOrderItemSet DTO(Boolean

isNullable,Boolean checkType)<


Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read3_FindPurchaseOrderItemSet sDTO(Boolean

isNullable,布尔检查类型)

at

Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read17_findPurchaseOrderItemSe tsResponse()


内部错误在异常对象中说了些什么(我是从内存中输入
),字符串中的格式无效。


1.无论如何我可以抓住它抱怨的XML文档

关于?


2.有什么想法导致错误吗? (我知道;我没有给你

很多东西;抱歉。)


谢谢。


Michael

I''m consuming a web service produced by a Java, non-Microsoft system.
The response will have two complex elements. One of those has an array
of items. Before I get back to my code, the system gets an exception:
Error in XML document at (2, 1010).

The exception object shows the following stack string:

_stackTraceString
at System.Number.ParseUInt32(String s, NumberStyles style,
NumberFormatInfo info)
at System.UInt16.Parse(String s, NumberStyles style, IFormatProvider
provider)
at System.Xml.XmlConvert.ToUInt16(String s)
at System.Xml.Serialization.XmlCustomFormatter.ToChar (String value)
at System.Xml.Serialization.XmlSerializationReader.To Char(String
value)
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read4_FindPurchaseOrderItemSet DTO(Boolean
isNullable, Boolean checkType)
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read3_FindPurchaseOrderItemSet sDTO(Boolean
isNullable, Boolean checkType)
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read17_findPurchaseOrderItemSe tsResponse()

The internal error in the exception object said something like (I''m
typing from memory), "Invalid format in string.)

1. Any way I can get hold of the XML document that it''s complaining
about?

2. Any ideas what''s causing the error? (I know; I''m not giving you
much to go on; sorry.)

Thanks.

Michael

推荐答案

Java bqased网络服务创建的WSDL可能不是

匹配实际输出。因此,当您的Web服务代理类调用

java Web服务时,返回的结果与预期的

不同。你可以将wsdl复制并粘贴到这个帖子,以及

SOAP消息本身。

It maybe the WSDL that the Java bqased web service creates does not
match the actual output. So when you web service proxy class calls the
java web service the returned result is different from what is
expected. Can you copy and paste the wsdl to this posting, as well as
the SOAP message itself.


Keenan;谢谢回复。我已经确定问题是在

转换为标准(即来自

xsd:xml.apache.org/xml-soap)dateTime变量。我可以捕获

异常,但它看起来不像是告诉我所谓的

违规字符串是什么,也不是dateTime格式字符串它是什么尝试

使用的是。


另外,我不知道如何获取被发回的XML字符串
$ b来自该服务的$ b。如何获取整个SOAP消息?我在

VSS调试器中,但在

异常时的堆栈中的例程(假设我没有抓到它)不是''它们的源代码与

相关联,所以我不清楚如何掌握SOAP消息。

想法?

WSDL的dateTime部分只是(!):

< xsd:element name =" badVar""的nillable = QUOT;真" type =" xsd:dateTime" />,

其中xsd如上所述。


谢谢。

Keenan; thanks for the reply. I''ve determined that the problem is in
the conversion to a standard (that is, from
xsd:xml.apache.org/xml-soap) dateTime variable. I can catch the
exception, but it doesn''t look like it tells me what the allegedly
offending string is, nor what the dateTime format strings it''s trying
to use are.

Also, I don''t know how to get hold of the XML string being sent back
from the service. How do I get the entire SOAP message? I''m within the
VSS debugger, but the routines on the stack at the time of the
exception (assuming I don''t catch it) don''t have source associated with
them, so it''s unclear to me how I can get hold of the SOAP message.
Ideas?

The dateTime portion of the WSDL is simply (!):
<xsd:element name="badVar"" nillable="true" type="xsd:dateTime"/>,
where xsd is as above.

Thanks.


这是导致问题的响应(我通过使用

单独的工具得到它)。所有名称中带有日期的元素都是

,声明为''标准''dateTime类型,并且允许为零。

C#.NET代理类将dateTime变量声明为System.DateTime。

我不知道为什么我从这个文档中得到dateTime格式错误。 />
有什么想法吗?谢谢。


<?xml version =" 1.0"编码= QUOT; UTF-8英寸?>

< soapenv:Envelope

xmlns:soapenv =" http://schemas.xmlsoap.org/soap/envelope/"


xmlns:soapenc =" http://schemas.xmlsoap.org/soap/encoding/"

xmlns:xsd =" http:// www。 w3.org/2001/XMLSchema"


xmlns:xsi =" http://www.w3.org/2001/XMLSchema-instance">

< soapenv:正文>

< findByReportNumberResponse

xmlns =" http://discrepancyreporting.service.yyy.zzz.xxx.com">

< findByReportNumberReturn>

< closedBy xsi:nil =" true"的xmlns = QUOT; HTTP://dto.zzz.xxx.com" />

< closedDate xsi:nil =" true"的xmlns = QUOT; HTTP://dto.zzz.xxx.com" />

< closedReference xsi:nil =" true"的xmlns = QUOT; HTTP://dto.zzz.xxx.com" />

< creditDate

xmlns =" http://dto.zzz.xxx.com"> 2005-02-07T14:00:00.000Z< ; / creditDate>

< creditedBy xmlns =" http://dto.zzz.xxx.com"> 0000000054< / creditedBy>

< creditReference

xmlns =" http://dto.zzz.xxx.com"> LARRYC< / creditReference>

< creditReplace xmlns =" http:// dto .zzz.xxx.com"> C< / creditReplace>

< creditValue xmlns =" http://dto.zzz.xxx.com"> 1.00< / creditValue>

< discrepancy xmlns =" http://dto.zzz.xxx.com"> 1 MISSING< / disppancy>

< discrepancyReference

xmlns =" http://dto.zzz.xxx.com"> 1MISS< / discrepancyReference>

< discrepancyReportItemNumber

xmlns =" http ://dto.zzz.xxx.com"> 1< / discrepancyReportItemNumber>

< discrepancyReportNumber

xmlns =" http://dto.zzz.xxx .COM"大于1& lt; / discrepancyReportNumber>

< discrepancyType1 xmlns =" http://dto.zzz.xxx.com" />

< holdPayment xmlns =" http://dto.zzz.xxx.com"> Y< / holdPayment>

< medium xmlns = " http://dto.zzz.xxx.com"> P< / medium>

< purchaseOrderItemNumber

xmlns =" http:// dto。 zzz.xxx.com"> 1< / purchaseOrderItemNumber>

< purchaseOrderNumber

xmlns =" http://dto.zzz.xxx.com"> P00015< / purchaseOrderNumber>

< purchaseRequisitionNumber xsi:nil =" true"

xmlns =" http://dto.zzz.xxx.com" />

< qualityInspectionCode xmlns =" http://dto.zzz.xxx.com" />

< quantityRequired

xmlns =" http://dto.zzz.xxx.com"> 18.00< / quantityRequired>

< raisedBy xmlns =" http://dto.zzz.xxx.com"> 0000000054< / raisedBy>

< raisedDate

xmlns =" http://dto.zzz.xxx.com"> 2005-02-07T14:00:00.000Z< / raisedDate>

< replacementBy xsi:nil =" true"的xmlns = QUOT; HTTP://dto.zzz.xxx.com" />

< replacementDate xsi:nil =" true"的xmlns = QUOT; HTTP://dto.zzz.xxx.com" />

< replacementQuantity xsi:nil =" true"的xmlns = QUOT; HTTP://dto.zzz.xxx.com" />


< replacementReference xsi:nil =" true" xmlns =" http://dto.zzz.xxx.com"

/>

< shipmentCarrier

xmlns =" http://dto.zzz.xxx.com"> FEDEX< / shipmentCarrier>

< shipmentDate

xmlns =" http://dto.zzz。 xxx.com"> 2005-02-07T14:00:00.000Z< / shipmentDate>

< shipmentInsurance

xmlns =" http://dto.zzz .xxx.com"> NONE< / shipmentInsurance>

< shipmentPaymentType

xmlns =" http://dto.zzz.xxx.com"> P< ; / shipmentPaymentType>

< shipmentReference

xmlns =" http://dto.zzz.xxx.com"> LARRYC< / shipmentReference>

< stockCode xmlns =" http://dto.zzz.xxx.com"> 000001446< / stockCode>

< supplierContact

xmlns =" http://dto.zzz.xxx.com"> CHARLIE< / supplierContact>

< supplierContacted

xmlns =" http:// dto .zzz.xxx.com"> Y< / supplierContacted>

< supplierNumber

xmlns =" http://dto.zzz.xxx.com"> 000006< / supplierNumber>

< unitOfMeasure xmlns =" http://dto.zzz.xxx.com"> EA< / unitOfMeasure>

< updateStatistics xmlns =" http://dto.zzz.xxx.com" />

< waybillItemNumber xsi:nil =" true"的xmlns = QUOT; HTTP://dto.zzz.xxx.com" />

< waybillNumber xsi:nil =" true"的xmlns = QUOT; HTTP://dto.zzz.xxx.com" />

< discrepancyReportStatus

xmlns =" http://dto.zzz.xxx.com"> OPEN< / discrepancyReportStatus>

< discrepancyQuantity

xmlns =" http://dto.zzz.xxx.com"> 1< / discrepancyQuantity>

< / findByReportNumberReturn>

< / findByReportNumberResponse>

< / soapenv:Body>

< / soapenv:Envelope>

>
mjf写道:
Here''s the response that causes the problem (I got it by using a
separate tool). All of the elements with ''date'' in their name are
declared as ''standard'' dateTime types, and are allowed to be nil. The
C# .NET proxy class declares the dateTime variables as System.DateTime.
I don''t know why I get a dateTime format error from this document.
Any ideas? Thanks.

<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<findByReportNumberResponse
xmlns="http://discrepancyreporting.service.yyy.zzz.xxx.com">
<findByReportNumberReturn>
<closedBy xsi:nil="true" xmlns="http://dto.zzz.xxx.com" />
<closedDate xsi:nil="true" xmlns="http://dto.zzz.xxx.com" />
<closedReference xsi:nil="true" xmlns="http://dto.zzz.xxx.com" />
<creditDate
xmlns="http://dto.zzz.xxx.com">2005-02-07T14:00:00.000Z</creditDate>
<creditedBy xmlns="http://dto.zzz.xxx.com">0000000054</creditedBy>
<creditReference
xmlns="http://dto.zzz.xxx.com">LARRYC</creditReference>
<creditReplace xmlns="http://dto.zzz.xxx.com">C</creditReplace>
<creditValue xmlns="http://dto.zzz.xxx.com">1.00</creditValue>
<discrepancy xmlns="http://dto.zzz.xxx.com">1 MISSING</discrepancy>
<discrepancyReference
xmlns="http://dto.zzz.xxx.com">1MISS</discrepancyReference>
<discrepancyReportItemNumber
xmlns="http://dto.zzz.xxx.com">1</discrepancyReportItemNumber>
<discrepancyReportNumber
xmlns="http://dto.zzz.xxx.com">1</discrepancyReportNumber>
<discrepancyType1 xmlns="http://dto.zzz.xxx.com" />
<holdPayment xmlns="http://dto.zzz.xxx.com">Y</holdPayment>
<medium xmlns="http://dto.zzz.xxx.com">P</medium>
<purchaseOrderItemNumber
xmlns="http://dto.zzz.xxx.com">1</purchaseOrderItemNumber>
<purchaseOrderNumber
xmlns="http://dto.zzz.xxx.com">P00015</purchaseOrderNumber>
<purchaseRequisitionNumber xsi:nil="true"
xmlns="http://dto.zzz.xxx.com" />
<qualityInspectionCode xmlns="http://dto.zzz.xxx.com" />
<quantityRequired
xmlns="http://dto.zzz.xxx.com">18.00</quantityRequired>
<raisedBy xmlns="http://dto.zzz.xxx.com">0000000054</raisedBy>
<raisedDate
xmlns="http://dto.zzz.xxx.com">2005-02-07T14:00:00.000Z</raisedDate>
<replacedBy xsi:nil="true" xmlns="http://dto.zzz.xxx.com" />
<replacementDate xsi:nil="true" xmlns="http://dto.zzz.xxx.com" />
<replacementQuantity xsi:nil="true" xmlns="http://dto.zzz.xxx.com" />

<replacementReference xsi:nil="true" xmlns="http://dto.zzz.xxx.com"
/>
<shipmentCarrier
xmlns="http://dto.zzz.xxx.com">FEDEX</shipmentCarrier>
<shipmentDate
xmlns="http://dto.zzz.xxx.com">2005-02-07T14:00:00.000Z</shipmentDate>
<shipmentInsurance
xmlns="http://dto.zzz.xxx.com">NONE</shipmentInsurance>
<shipmentPaymentType
xmlns="http://dto.zzz.xxx.com">P</shipmentPaymentType>
<shipmentReference
xmlns="http://dto.zzz.xxx.com">LARRYC</shipmentReference>
<stockCode xmlns="http://dto.zzz.xxx.com">000001446</stockCode>
<supplierContact
xmlns="http://dto.zzz.xxx.com">CHARLIE</supplierContact>
<supplierContacted
xmlns="http://dto.zzz.xxx.com">Y</supplierContacted>
<supplierNumber
xmlns="http://dto.zzz.xxx.com">000006</supplierNumber>
<unitOfMeasure xmlns="http://dto.zzz.xxx.com">EA</unitOfMeasure>
<updateStatistics xmlns="http://dto.zzz.xxx.com" />
<waybillItemNumber xsi:nil="true" xmlns="http://dto.zzz.xxx.com" />
<waybillNumber xsi:nil="true" xmlns="http://dto.zzz.xxx.com" />
<discrepancyReportStatus
xmlns="http://dto.zzz.xxx.com">OPEN</discrepancyReportStatus>
<discrepancyQuantity
xmlns="http://dto.zzz.xxx.com">1</discrepancyQuantity>
</findByReportNumberReturn>
</findByReportNumberResponse>
</soapenv:Body>
</soapenv:Envelope>

mjf wrote:
基南;谢谢回复。我已经确定问题在于转换为标准(即来自
xsd:xml.apache.org/xml-soap)的dateTime变量。我可以看到
异常,但它看起来不像是告诉我所谓的违规字符串是什么,也不是它正在尝试使用的dateTime格式字符串是什么。

此外,我不知道如何获取从服务发回的XML字符串。如何获取整个SOAP消息?我在VSS调试器的
范围内,但是在
异常时的堆栈上的例程(假设我没有抓到它)没有源关联
与他们一起,所以我不清楚如何掌握SOAP消息。
想法?

WSDL的dateTime部分只是(!):
< xsd:element name =" badVar""的nillable = QUOT;真" type =" xsd:dateTime" />,
其中xsd如上所述。

谢谢。
Keenan; thanks for the reply. I''ve determined that the problem is in
the conversion to a standard (that is, from
xsd:xml.apache.org/xml-soap) dateTime variable. I can catch the
exception, but it doesn''t look like it tells me what the allegedly
offending string is, nor what the dateTime format strings it''s trying
to use are.

Also, I don''t know how to get hold of the XML string being sent back
from the service. How do I get the entire SOAP message? I''m within the VSS debugger, but the routines on the stack at the time of the
exception (assuming I don''t catch it) don''t have source associated with them, so it''s unclear to me how I can get hold of the SOAP message.
Ideas?

The dateTime portion of the WSDL is simply (!):
<xsd:element name="badVar"" nillable="true" type="xsd:dateTime"/>,
where xsd is as above.

Thanks.






这篇关于XML文档中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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