when try to validate the generated xml, i am getting validation error saying.
"Unable to locate a refernce to a supported schematype(DTD,W3C Schema) with in
document instance."
how to fix this issue.
--- On Wed, 22/2/12, ram <ram_kurra(_at_)yahoo(_dot_)co(_dot_)in> wrote:
From: ram <ram_kurra(_at_)yahoo(_dot_)co(_dot_)in>
Subject: [xsl] The data at the root level is invalid+xslt
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Date: Wednesday, 22 February, 2012, 1:31 AM
Hi,
I have soap request in which i am
stripping off some of the elements in the soap header
elements and adding wssecurity elements and activityId.
I am not touching the soap body. i was
just copying it.
Here is my sample xml
<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:SearchCases>
<ns:request>
<tri:SessionId>?</tri:SessionId>
<ns:Member>
<ns:MemberId>?</ns:MemberId>
<ns:SystemId>?</ns:SystemId>
</ns:ExternalMember>
<ns:Pagination>
<ns:CurrentPageNumber>?</ns:CurrentPageNumber>
</ns:request>
</ns:SearchCases>
</soapenv:Body>
</soapenv:Envelope>
Hers is my code
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:xalan="http://xml.apache.org/xslt"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
exclude-result-prefixes="soapenv dp">
<xsl:output method="xml" omit-xml-declaration="no"/>
<xsl:template match="/">
<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:template match="*">
<xsl:element
name="{name(.)}" namespace="{namespace-uri(.)}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
When try to hit the backend service i am gettign the
following error msgs
I am getting the following error msg
<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 'SearchCases'. The
data at the root level is invalid. Line 69, position
4.</faultstring>
So what exactly is the problem, am doing any
mistake
The data at the root level is invalid. Line 69, position 4
--~------------------------------------------------------------------
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>
--~--