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.ReadWithCollectTextToken()
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(String xml, String path)
in
c:\sujith\honeywell\dotnet\honeywell.emea1\honeywell.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
Derek Harmon - 23 Sep 2005 00:33 GMT
> 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
fausto - 24 Nov 2005 16:58 GMT
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