473,387 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Error in XML document

mjf
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

Nov 23 '05 #1
13 3199
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.

Nov 23 '05 #2
mjf
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.

Nov 23 '05 #3
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:
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.


Nov 23 '05 #4
I don't beleive System.Datetime allows for null values in .Net

Nov 23 '05 #5
Keenan Newton wrote:
I don't beleive System.Datetime allows for null values in .Net


Keenan, Is there any way I can confirm that? I had the service provider
send a response with all DateTime fields non-nil, and still got the same
error. Any ideas?

Also, do you know how I can get hold of the SOAP/XML document that
constitutes the response?

Thanks. Michael

Nov 23 '05 #6
On Tue, 15 Feb 2005 20:12:12 -0700, Michael Flanagan
<mf*******@NoSpam.MJFlanagan.com> wrote:
Keenan Newton wrote:
I don't beleive System.Datetime allows for null values in .Net


Keenan, Is there any way I can confirm that? I had the service provider
send a response with all DateTime fields non-nil, and still got the same
error. Any ideas?

Also, do you know how I can get hold of the SOAP/XML document that
constitutes the response?

Thanks. Michael


Now that I'm re-reading it, my question doesn't make a lot of sense.
I confirmed what you said as far as the System.DateTime object.
That's not necessarily the same as saying that the XML parser won't
check the 'nil' attribute and set the DateTime proxy variable to some
initial value. So what I meant to ask is how I can confirm that a
DateTime variable in a web service response cannot have the nil="true"
attribute?

Nov 23 '05 #7
Well i am sure the SOAP Response can have nil=true, but if I am correct
when .Net trys to read it, and find it null. It may not know how to
handle it. Now I am just going to recommend some debuggin techniques.
I am assuming you have control over the Java web service. or you can
create your own. I would create a simple service that would return
dummy data for all the parametes you need. Then i would remove all of
the parameters but one, and slowly add each one in until it breaks.
Again the Date time looks ok.

Nov 23 '05 #8
mjf
Keenan Newton wrote:
Well i am sure the SOAP Response can have nil=true, but if I am correct when .Net trys to read it, and find it null. It may not know how to
handle it. Now I am just going to recommend some debuggin techniques. I am assuming you have control over the Java web service. or you can
create your own. I would create a simple service that would return
dummy data for all the parametes you need. Then i would remove all of the parameters but one, and slowly add each one in until it breaks.
Again the Date time looks ok.


Keenan, thanks again. Here is a link that others have pointed me to.
It seems that .NET won't deserialize nil DateTimes (as you suspected!).
I don't really have control of the web service, so I'm scrambling.

Thanks again.

Michael

Look here: http://blogs.msdn.com/smguest/archiv...07/128113.aspx

Nov 23 '05 #9
mjf
mjf wrote:
Keenan Newton wrote:
Well i am sure the SOAP Response can have nil=true, but if I am correct
when .Net trys to read it, and find it null. It may not know how to handle it. Now I am just going to recommend some debuggin

techniques.
I am assuming you have control over the Java web service. or you can create your own. I would create a simple service that would return
dummy data for all the parametes you need. Then i would remove all

of
the parameters but one, and slowly add each one in until it breaks.
Again the Date time looks ok.


Keenan, thanks again. Here is a link that others have pointed me to.
It seems that .NET won't deserialize nil DateTimes (as you

suspected!). I don't really have control of the web service, so I'm scrambling.

Thanks again.

Michael

Look here:

http://blogs.msdn.com/smguest/archiv...07/128113.aspx

One additional comment: I found a way to get at the XML that .NET is
trying to parse. One only (!) need write a Soap Extension (in
System.Web.Services.Protocols), and you can see the outgoing and
incoming messages. I'm surprised nobody suggested this. (Okay, not
very surprised.)

Nov 23 '05 #10
ags
Hello,
Can you put the example you wrote for the SoapExtension ?
Thanks !

"mjf" wrote:
mjf wrote:
Keenan Newton wrote:
Well i am sure the SOAP Response can have nil=true, but if I am

correct
when .Net trys to read it, and find it null. It may not know how to handle it. Now I am just going to recommend some debuggin

techniques.
I am assuming you have control over the Java web service. or you can create your own. I would create a simple service that would return
dummy data for all the parametes you need. Then i would remove all

of
the parameters but one, and slowly add each one in until it breaks.
Again the Date time looks ok.


Keenan, thanks again. Here is a link that others have pointed me to.
It seems that .NET won't deserialize nil DateTimes (as you

suspected!).
I don't really have control of the web service, so I'm scrambling.

Thanks again.

Michael

Look here:

http://blogs.msdn.com/smguest/archiv...07/128113.aspx

One additional comment: I found a way to get at the XML that .NET is
trying to parse. One only (!) need write a Soap Extension (in
System.Web.Services.Protocols), and you can see the outgoing and
incoming messages. I'm surprised nobody suggested this. (Okay, not
very surprised.)

Nov 23 '05 #11
On Mon, 21 Feb 2005 15:07:03 -0800, ags
<ag*@discussions.microsoft.com> wrote:
Hello,
Can you put the example you wrote for the SoapExtension ?
Thanks !

"mjf" wrote:

One additional comment: I found a way to get at the XML that .NET is
trying to parse. One only (!) need write a Soap Extension (in
System.Web.Services.Protocols), and you can see the outgoing and
incoming messages. I'm surprised nobody suggested this. (Okay, not
very surprised.)


I pulled it out of ".NET Web Services" by O'Reilly, so I'm not sure I
can post it due to copyright issues. Perhaps it's on the O'Reilly
site for the book. Otherwise, I'd love to. Sorry.

Michael
Nov 23 '05 #12
To do what Keenan suggested here, you may want to take a look at this tool
to help you:
http://www.softwaremaker.net/blog/Pe...901007130.aspx

It lets you manually craft out the exact message you want faster to post and
it gives you exactly the SOAP Faults thrown. In this case, you dont have to
compile and run the client all the time. Once you can get the message you
want, then you can manipulate the XMLSerializer to do exactly what you want.

--
Thank you.

Regards,
William T (Softwaremaker)
http://www.softwaremaker.net/blog
=========================================

"mjf" <go********@MJFlanagan.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Keenan Newton wrote:
Well i am sure the SOAP Response can have nil=true, but if I am

correct
when .Net trys to read it, and find it null. It may not know how to
handle it. Now I am just going to recommend some debuggin

techniques.
I am assuming you have control over the Java web service. or you can
create your own. I would create a simple service that would return
dummy data for all the parametes you need. Then i would remove all

of
the parameters but one, and slowly add each one in until it breaks.
Again the Date time looks ok.


Keenan, thanks again. Here is a link that others have pointed me to.
It seems that .NET won't deserialize nil DateTimes (as you suspected!).
I don't really have control of the web service, so I'm scrambling.

Thanks again.

Michael

Look here: http://blogs.msdn.com/smguest/archiv...07/128113.aspx

Nov 23 '05 #13
Thanks, Softwaremaker!

I've downloaded your tool, and will use it. However, my problem isn't
with the XML I am sending, but rather the XML the service is sending,
and how the Serializer *Deserializes* this response. Or am I missing
something basic (which wouldn't be too surprising)?

Thanks again.

Michael

On Wed, 2 Mar 2005 06:19:26 +0800, "Softwaremaker"
<ms**@removethis.softwaremaker.net> wrote:
To do what Keenan suggested here, you may want to take a look at this tool
to help you:
http://www.softwaremaker.net/blog/Pe...901007130.aspx

It lets you manually craft out the exact message you want faster to post and
it gives you exactly the SOAP Faults thrown. In this case, you dont have to
compile and run the client all the time. Once you can get the message you
want, then you can manipulate the XMLSerializer to do exactly what you want.


Nov 23 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andrew V. Romero | last post by:
I have a script that I am working on for an intranet tool and in this script I have a form, which when submitted the onSubmit command calls calculate(). In this calculate function, I have it do...
7
by: debugger | last post by:
hello, Question, on page load, I populate an existing drop down with createElement and appendChild. It works fine so far. BUT I want to automatically select some option from this populated drop...
9
by: torbs | last post by:
Hi I am creating a page for stretchfilm. In this page you can chose between a short medium and long version of the film at any point in the film. It is in norwegian, but just press play. URL:...
5
by: HopfZ | last post by:
I made two shortcut functions for document.getElementById as: function EBI2(id){return document.getElementById(id)}; var EBI3 = document.getElementById; But EBI3 don't work. EBI2('myText');...
1
by: solomon_13000 | last post by:
connection.asp: <% Sub RunQueryString (pSQL,parms) on error resume next Set conn = Server.CreateObject("ADODB.Connection") conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &...
4
by: dr1ft3r | last post by:
Hey guys, I'm building a site for a landscaping business down the street and can't seem to get part of the code functioning correctly. The code fails on line 68 where I make a reference to an...
1
by: mudasserrafiq | last post by:
I am using following asp file default.asp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <META http-equiv=Content-Type content="text/html; charset=windows-1252"> <META content="0...
6
by: dragiton | last post by:
ASP Code Redirect Error Hello I recently relaunched a website containing asp code which used to work perfectly. However, after resetting up the SQL DB and trying to work out some site bugs I have...
9
by: ahilar12 | last post by:
1. <head> 2. <script type="text/javascript"> 3. </script> 4. </head> 5. <body> 6. <form> 7. <select name="team" id="mylist" > 8. <option></option> 9....
3
by: graphicssl | last post by:
Okay, so first of all, I'm a designer first and a light coder second (I'm only really trained with HTML and CSS). So I apologize for having to post about something that's probably super-trivial! ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.