473,403 Members | 2,284 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,403 software developers and data experts.

XML Deserialization

Hi

I am facing this strange problem, we are receiving xml documents from
Siebel which I am trying to deserialize into class objects for further
processing. The encoding of the document is utf-16 and siebel will post it to
an asp.net page, where I retrieve it as binary and convert it into unicode
formatting. To make sure, I have even commented the utf-8 default setting
defined in app.config and set the response encoding to,
Page.Response.ContentEncoding = Page.Request.ContentEncoding.

When I try to load the given xml into xmldoc.LoadXml(xmlString), thats where
it fails, with the following exception: Bottom.

The real goofy is if write the xml into a file and read it back into string,
I am able to load into document xmldoc.LoadXml(xmlString) and also
deserialize the string into class object.

This is running me crazy, though I have a temporary solution for now. Any
thoughs??
--------------------------------------------------
<?xml version="1.0" encoding="UTF-16"?>
<?Siebel-Property-Set EscapeNames="false"?>
<SiebelMessage MessageId="AO-ZHV" IntObjectName="HWAF2 Create Project
nounderscore" MessageType="Integration Object" IntObjectFormat="Siebel
Hierarchical">
<CREATEPROJECT>
<SERVICEAGREEMENT>
<PMPROJECTREFERENCE>1-13ZK2F</PMPROJECTREFERENCE>
<STARTDATE>09/02/2004 00:00:00</STARTDATE>
<DESCRIPTION>Service Level Agreement</DESCRIPTION>
<BILLTOSITENUMBER>1+2SB+3461</BILLTOSITENUMBER>
<EMPLOYEENUMBERCA>E707995</EMPLOYEENUMBERCA>
<CreatedByName>CCMARTIN</CreatedByName>
<EMPLOYEENUMBERFSL>E707995</EMPLOYEENUMBERFSL>
<ORGANIZATIONNAME/>
<SentToOracle/>
<CREATEDFROMTEMPLATENAME>Local</CREATEDFROMTEMPLATENAME>
<OUTPUTTAXCODE/>
<PROJECTTYPEATTRIBUTE3/>
<PROJECTNAME>1-13ZK2F</PROJECTNAME>
<PROJECTNUMBER/>
<SHIPTOSITENUMBER>1+2SB+3461</SHIPTOSITENUMBER>
<AGREEMENTENTITLEMENTLIST>
<AGREEMENTENTITLEMENT>
<TASKREFERENCE>1-13ZK2G</TASKREFERENCE>
<TASKSTARTDATE>07/12/2005 00:00:00</TASKSTARTDATE>
<TASKNAMEEntName>SR Ticket Information - PM</TASKNAMEEntName>
<SERVICETYPECODEPlatform/>
<TASKNAMEPlatform/>
<SERVICETYPECODESrvPgm/>
<TASKNAMESrvcPgm/>
<SERVICETYPECODEName>SR Ticket Information - PM</SERVICETYPECODEName>
<TASKNUMBER>111-1111</TASKNUMBER>
</AGREEMENTENTITLEMENT>
</AGREEMENTENTITLEMENTLIST>
</SERVICEAGREEMENT>
</CREATEPROJECT>
</SiebelMessage>
----------------------------------------------------
System.Xml.XmlException: The data at the root level is invalid. Line 1,
position 1.
at System.Xml.XmlTextReader.ParseRoot()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlValidatingReader.ReadWithCollectText Token()
at System.Xml.XmlValidatingReader.Read()
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean
preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.LoadXml(String xml)
at Honeywell.EMEA.Integration.Main.MapAndExecute(Stri ng xml, String path)
in
c:\sujith\honeywell\dotnet\honeywell.emea1\honeywe ll.emea.integration\main.cs:line 50
at SiebelRequests.WebForm2.Page_Load(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\SiebelRequests\WebForm2.aspx.vb :line 205

----------------------------------------------------------------------------
Note: I tried with utf-8, where Siebel sends utf-8, modifed the asp.net'
web.config to utf-8, and binary stream into utf-8 , it fails again.
-----------------------------------------------------------------------------

Thanks
Nov 12 '05 #1
2 4163
"Sujith Jagini" <Su**********@discussions.microsoft.com> wrote in message news:31**********************************@microsof t.com...
processing. The encoding of the document is utf-16 and siebel will post it to
an asp.net page, where I retrieve it as binary and convert it into unicode : : System.Xml.XmlException: The data at the root level is invalid. Line 1,
position 1.
at System.Xml.XmlTextReader.ParseRoot()
This happens when the bits you're feeding XmlDocument are not UTF-16 (or
are otherwise mismatched to what the XmlDecl encoding in the document is
saying.)
This is running me crazy, though I have a temporary solution for now. Any
thoughs?? : : <?xml version="1.0" encoding="UTF-16"?>
Try removing the segment, "encoding="UTF-16", and see if XmlTextReader
finds this more appetizing.
<SiebelMessage MessageId="AO-ZHV" IntObjectName="HWAF2 Create Project
nounderscore" MessageType="Integration Object" IntObjectFormat="Siebel
Hierarchical">


XML appears mostly OK, assuming it's claim of being UTF-16 encoded is
still true.

If I cut this text out of your message and save it into a Unicode text file, and
then load it into a string, and test it ... it'll work.<g> What is actually needed
to repro your problem would be the binary rep of the encoded text.
Derek Harmon
Nov 12 '05 #2
Hello Sujith, I am fausto.

At the moment i'm trying developing a web service that execute
a siebel workflow.

i am received this one message "Cast is not valid"

This is the code:

Thanks a lot in advance

fausto
Public Function GenerarPedido(ByVal sCodCrm As String) As String
Dim SiebelApplication As SiebelDataServer.SiebelApplication
' Dim BusObj As SiebelBusObject
' Dim BusComp As SiebelBusComp
Dim errcode As Short
Dim ErrText As String
Dim objBS As SiebelDataServer.SiebelService
Dim Inputs As SiebelDataServer.SiebelPropertySet
Dim Outputs As SiebelDataServer.SiebelPropertySet
Dim sResp As String

Try
ChDrive("D")
ChDir("d:\sea\sceesn\bin")
SiebelApplication =
CreateObject("SiebelDataServer.ApplicationObject")

With SiebelApplication

.LoadObjects("d:\sea\sceesn\bin\PECDesarrollo.cfg" , errcode)

If errcode <> 0 Then
ErrText = .GetLastErrText
Return ErrText.ToString()
Exit Function
End If
.Login("gvergard", "cambiame", errcode)
If errcode <> 0 Then
ErrText = .GetLastErrText
Return ErrText.ToString()
Exit Function
End If
End With
'** Here failed ****
objBS = SiebelApplication.GetService("Workflow Process Manager",
errcode)
'***
Inputs = SiebelApplication.NewPropertySet(errcode)

'1-AL9RT
Outputs = SiebelApplication.NewPropertySet(errcode)
Inputs.SetProperty("Object Id", sCodCrm, errcode)
Inputs.SetProperty("ProcessName", "PECWFPIntegracionGetPedido",
errcode) 'este es el workflow que ejecuta
'Invocar el metodo, entregandole el nombre del metodo y los Pset
de entrada y salida
objBS.InvokeMethod("RunProcess", Inputs, Outputs, errcode)
sResp = Outputs.GetProperty("String XML", errcode)

If errcode <> 0 Then
ErrText = SiebelApplication.GetLastErrText()
Return ErrText.ToString()
Exit Function
End If
objBS = Nothing
SiebelApplication = Nothing
Inputs = Nothing
Outputs = Nothing
Catch ex As Exception
Return ex.Message.ToString
End Try

End Function
Nov 24 '05 #3

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

Similar topics

2
by: Serg | last post by:
Hi. I have a problem with deserialization decimal value. I have a simple class: public class A { public decimal d; } The serialization a value 0.00000001 is OK. The file is
3
by: TEK | last post by:
There seems to be a bug when deserialization some classes in the .NET framework. If you try to deserialize a class that has a base class that holds a struct with a member that is implementing...
2
by: Snowman | last post by:
Suppose I have a RootObject which holds a collection of other objects. The other objects have a property (Parent) which refers back to the "parent" collection (b.t.w. my collection is based on...
3
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I am having problems deserializing an object which seems to be serializing just fine. I save the byte array of the serialized object in the database...
3
by: AnkitAsDeveloper [Ankit] | last post by:
Hi i am serializing a 'ref struct' object as follows : private: void Seri( String ^path, Object^ obj ) { FileStream^ fileStrm ; try { //Serialize entire object into Binary stream
3
by: parrot toes | last post by:
Summary: I have been trying to make requests of a web service provided by Axis using a dotnet client with code generated by wsdl.exe and have been getting exceptions when trying to process the...
1
by: parrot toes | last post by:
I tried to post this question before, but there was an error when posting. I case it did get posted and in order to avoid duplication, I'll just repost a summary. I have written a dotnet client...
8
by: ashoksrini | last post by:
Hi All, I have the below requirement and would like to get some feeback from the group on the best way to implement: 1. I have WSDL defined exposing few web services. 2. We dont have a...
5
by: Greg Allen | last post by:
I am consuming a web service and using the generated Reference.cs to access the service and the objects associated with it. I have run into a problem where some inherited classes are not being...
7
by: Andrew | last post by:
Hi, I am using DataContractJsonSerializer to deserialize JSON string in C# objects but I am having a problem. Suppose I have a class: class Item { public ItemId Id { get; set; }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.