xsl-list
[Top] [All Lists]

Re: [xsl] The data at the root level is invalid+xslt

2012-02-21 16:49:28
Guys,
    Without compilation and running the program, how can i say that there is 
problem with my xsl, Rather than arguing the syntax errors you can look at the 
real problem too(I know its not job of yours and your experts and helping hands 
for new guys.)
    I have corrected the request and code multiple times and round and round 
coming to the same point syntax problem blah blah.


Here is my xslt
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
exclude-result-prefixes="soapenv " version="1.0">
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="soapenv:Header">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:variable name="username">
                <xsl:value-of 
select="/*[local-name()='Envelope']/*[local-name()='Header']/*[local-name()='Context']/*[local-name()='Security']/*[local-name()='UsernameToken']/*[local-name()='username']"/>
            </xsl:variable>
            <xsl:variable name="password">
                <xsl:value-of 
select="/*[local-name()='Envelope']/*[local-name()='Header']/*[local-name()='Context']/*[local-name()='Security']/*[local-name()='UsernameToken']/*[local-name()='password']"/>
            </xsl:variable>
            <xsl:variable name="transactionId">
                <xsl:value-of 
select="/*[local-name()='Envelope']/*[local-name()='Header']/*[local-name()='Context']/*[local-name()='transId']"/>
            </xsl:variable>
            <ActivityId CorrelationId="" 
xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics";>
                <xsl:value-of select="$transactionId"/>
            </ActivityId>
            <wsse:Security 
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";>
                <wsse:UsernameToken>
                    <wsse:Username>
                        <xsl:value-of select="$username"/>
                    </wsse:Username>
                    <wsse:Password>
                        <xsl:value-of select="$password"/>
                    </wsse:Password>
                </wsse:UsernameToken>
            </wsse:Security>
        </xsl:copy>
    </xsl:template>
    <xsl:template 
match="*[local-name()='Envelope']/*[local-name()='Header']/*[local-name()='ESBHeader']
 "/>
    <xsl:template 
match="*[local-name()='Envelope']/*[local-name()='Header']/*[local-name()='Context']
 "/>


</xsl:stylesheet>
Here is sampel request.


<soapenv:Envelope xmlns:tri="http://abc.com/WebServices.Common"; 
xmlns:ns="http://abc.com/Case/471"; xmlns:con="http://xyz.com/eb/context"; 
xmlns:head="http://xyz.com/eb/header"; 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
    <soapenv:Header>
        <head:ESBHeader>
            <head:ESBProps>
                <head:Property>
                    <head:name>?</head:name>
                    <head:value>?</head:value>
                </head:Property>
            </head:ESBProps>
            
        </head:ESBHeader>
        <con:Context>
            <con:clientReqId>?</con:clientReqId>
            <con:transId>?</con:transId>
            <con:msgTyp>?</con:msgTyp>
            <con:Security>
                <con:UsernameToken>
                    <con:username></con:username>
                    <con:password>1</con:password>
                    
                </con:UsernameToken>
            </con:Security>
            
        </con:Context>
    </soapenv:Header>
    <soapenv:Body>
        <ns:Search>
            <ns:request>
                <tri:SessionId>?</tri:SessionId>
                <ns:Member>
                    <ns:MemberId>?</ns:MemberId>
                    <ns:SystemId>?</ns:SystemId>
                </ns:Member>
                <ns:Pagination>
                    <ns:CurrentPageNumber>?</ns:CurrentPageNumber>
                  </ns:Pagination>
      
            </ns:request>
        </ns:Search>
    </soapenv:Body>
</soapenv:Envelope>
     The error that i am getting when i hit the backend service provider is 

<s:Body><s:Fault><faultcode 
xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher";>a:DeserializationFailed</faultcode><faultstring
 xml:lang="en-US">The formatter threw an exception while trying to deserialize 
the message: Error in deserializing body of request message for operation 
'Search'. The data at the root level is invalid. Line 69, position 
4.</faultstring>
    When i do the validation  for the generated xml in xmlspy i got the 
following error.

Unable to locate a reference to a supported schema type (DTD, W3C Schema) 
within this document instance.


   So am i missing anything over here. 


--- On Wed, 22/2/12, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:

From: Michael Kay <mike(_at_)saxonica(_dot_)com>
Subject: Re: [xsl] The data at the root level is invalid+xslt
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Date: Wednesday, 22 February, 2012, 3:57 AM
On 21/02/2012 21:33, ram wrote:
its typo error i agree, i can remove that in my
stylesheet.


It's actually very useful for us when posted code contains
such errors, because it tells us that the code you are
posting is not the code that you actually ran, and that we
therefore shouldn't attempt to run it or do any serious
debugging on it.

On the other hand, this is bad news for you, because it
means you get fewer responses, and the responses focus on
trivial errors that are unrelated to your real problem.

Michael Kay
Saxonica

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--