Folks:
I need to use an dynamically generated xpath-query Template with inLine
Schemas (like the one
[URL=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqlxml3/htm/ssxsdannotations_1u7n.asp]HERE[/URL])
I tried to use the function below, but am getting this error:
ERROR: 500 Internal Server ErrorHResult: 0x80040e14Source: Microsoft XML
Extensions to SQL ServerDescription: XML Parse Error: Unspecified error
, Line: 2, Position: 155
I've been looking for the reason for last 7 hours but without much progress.
Can this be done? is there any other way? Any pointers would be greatly
appreciated.
Thanks in advance!!
Public Function GetEmployeeData()
Dim EmpTmplXML As New MSXML2.DOMDocument40
Dim PostData
EmpTmplXML.async = False
'Load Template from a File for test
EmpTmplXML.Load aspObjServer.MapPath("\xxx\Template\EmpTemplate.xm l")
'In reality it will be something like this
'EmpTmplXML.loadXML <dynamicallyGeneratedTemplateAsString>
Dim objSvrHTTP As New MSXML2.ServerXMLHTTP40
objSvrHTTP.open "POST", "http://localhost/virtualDir", False
objSvrHTTP.setRequestHeader "Content-Type", "application/xml"
objSvrHTTP.send EmpTmplXML
objSvrHTTP.waitForResponse
PostData = objSvrHTTP.responseText
Debug.Print PostData
'Do Something with PostData
Set EmpTmplXML = Nothing
Set objSvrHTTP = Nothing
GetEmployeeData = PostData
End Function
The VB code looks OK, and the error specifically mentions an XML parser
error, which makes me think the error might be in your template rather than
your client code. Can you execute the same template directly from a Template
virtual name? Could you post the template you're trying to execute?
--
Graeme Malcolm
Principal Technologist
Content Master Ltd.
www.contentmaster.com
"AeriesUser" <AeriesUser@.discussions.microsoft.com> wrote in message
news:D2297502-8D5D-42FC-8FEE-8B0C8D9F1088@.microsoft.com...
Folks:
I need to use an dynamically generated xpath-query Template with inLine
Schemas (like the one
[URL=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqlxml3/htm/ssxsdannotations_1u7n.asp]HERE[/URL])
I tried to use the function below, but am getting this error:
ERROR: 500 Internal Server ErrorHResult: 0x80040e14Source: Microsoft XML
Extensions to SQL ServerDescription: XML Parse Error: Unspecified error
, Line: 2, Position: 155
I've been looking for the reason for last 7 hours but without much progress.
Can this be done? is there any other way? Any pointers would be greatly
appreciated.
Thanks in advance!!
Public Function GetEmployeeData()
Dim EmpTmplXML As New MSXML2.DOMDocument40
Dim PostData
EmpTmplXML.async = False
'Load Template from a File for test
EmpTmplXML.Load aspObjServer.MapPath("\xxx\Template\EmpTemplate.xm l")
'In reality it will be something like this
'EmpTmplXML.loadXML <dynamicallyGeneratedTemplateAsString>
Dim objSvrHTTP As New MSXML2.ServerXMLHTTP40
objSvrHTTP.open "POST", "http://localhost/virtualDir", False
objSvrHTTP.setRequestHeader "Content-Type", "application/xml"
objSvrHTTP.send EmpTmplXML
objSvrHTTP.waitForResponse
PostData = objSvrHTTP.responseText
Debug.Print PostData
'Do Something with PostData
Set EmpTmplXML = Nothing
Set objSvrHTTP = Nothing
GetEmployeeData = PostData
End Function
|||Hi Graeme,
Thank you very much for your respone.
Yes, I can call the template from the template virtualDir and get the XML
data that way, no problem.
Another thing I noticed, even though I change the elements/attributes I want
in the output (by changing the inline schema), the error is still showing the
same line number/position. Perhaps, the xml returned by the sqlxml object is
not a valid one? But I don't know how to debug that.
Here's the template: Thanks again!
--Template Begin--
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<xsd:schemaxmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ms="urn:schemas-microsoft-com:mapping-schema"
sql:is-mapping-schema="1"
id="InLineSchema1">
<xsd:annotation>
<xsd:appinfo>
<ms:relationship name="EmployeeDepartment" parent="Employees"
parent-key="EmployeeID" child="EmployeeDepartment"
child-key="EmployeeID" />
<ms:relationship name="EmployeeBU" parent="Employees"
parent-key="BargainingUnit" child="BargainingUnit"
child-key="UnitCode" />
<ms:relationship name="AbsenceRecords" parent="Employees"
parent-key="EmployeeNumber" child="ClassifiedAbsenceRecords"
child-key="EmpNumber" />
<ms:relationship name="DepartmentDesc" parent="EmployeeDepartment"
parent-key="DepartmentCode" child="Departments"
child-key="Code" />
<ms:relationship name="LeaveBalance" parent="Employees"
parent-key="EmployeeID" child="LeaveAmount"
child-key="EmployeeID" />
</xsd:appinfo>
</xsd:annotation>
<xsd:element name="Employees" ms:relation="Employees"
type="Employees_type" />
<xsd:complexType name="Employees_type">
<xsd:sequence>
<xsd:element name="EmployeeDepartment" ms:relation="EmployeeDepartment"
ms:relationship="EmployeeDepartment"
type="EmployeeDepartment_type" />
<xsd:element name="BargainingUnit" ms:relation="BargainingUnit"
ms:relationship="EmployeeBU"
type="BargainingUnit_type" />
<xsd:element name="ClassifiedAbsenceRecords"
ms:relation="ClassifiedAbsenceRecords" ms:relationship="AbsenceRecords"
type="ClassifiedAbsenceRecords_type"></xsd:element>
</xsd:sequence>
<xsd:attribute name="EmployeeID" type="xsd:string" />
<xsd:attribute name="SocialSecurityNumber" type="xsd:string" />
<xsd:attribute name="EmployeeNumber" type="xsd:string" />
<xsd:attribute name="FirstName" type="xsd:string" />
<xsd:attribute name="MiddleName" type="xsd:string" />
<xsd:attribute name="LastName" type="xsd:string" />
<xsd:attribute name="Title" type="xsd:string" />
<xsd:attribute name="EmailName" type="xsd:string" />
<xsd:attribute name="AltEmail" type="xsd:string" />
<xsd:attribute name="Extension" type="xsd:string" />
<xsd:attribute name="Address" type="xsd:string" />
<xsd:attribute name="City" type="xsd:string" />
<xsd:attribute name="StateOrProvince" type="xsd:string" />
<xsd:attribute name="Region" type="xsd:string" />
<xsd:attribute name="PostalCode" type="xsd:string" />
<xsd:attribute name="Country" type="xsd:string" />
<xsd:attribute name="HomePhone" type="xsd:string" />
<xsd:attribute name="WorkPhone" type="xsd:string" />
<xsd:attribute name="Birthdate" type="xsd:dateTime" />
<xsd:attribute name="Salary" type="xsd:decimal" />
<xsd:attribute name="Deductions" type="xsd:short" />
<xsd:attribute name="SpouseName" type="xsd:string" />
<xsd:attribute name="EmrgcyContactName" type="xsd:string" />
<xsd:attribute name="EmrgcyContactPhone" type="xsd:string" />
<xsd:attribute name="PhotoPath" type="xsd:string" />
<xsd:attribute name="BargainingUnit" type="xsd:short" />
<xsd:attribute name="HireDate" type="xsd:dateTime" />
<xsd:attribute name="CreateDate" type="xsd:dateTime" />
<xsd:attribute name="LastUpdateTime" type="xsd:dateTime" />
<xsd:attribute name="LastUpdatedBy" type="xsd:string" />
<xsd:attribute name="Active" type="xsd:boolean" />
</xsd:complexType>
<xsd:complexType name="EmployeeDepartment_type">
<xsd:attribute name="EmployeeID" type="xsd:string" />
<xsd:attribute name="DepartmentCode" type="xsd:short" />
<xsd:attribute name="DeptSequence" type="xsd:unsignedByte" />
<xsd:attribute name="DateStarted" type="xsd:dateTime" />
<xsd:attribute name="WorkdayHours" type="xsd:float" />
<xsd:attribute name="BillingRate" type="xsd:decimal" />
<xsd:attribute name="SupervisorID" type="xsd:string" />
<xsd:attribute name="WorkPhone" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="BargainingUnit_type">
<xsd:attribute name="UnitCode" type="xsd:short" />
<xsd:attribute name="UnitTitle" type="xsd:string" />
<xsd:attribute name="JobType" type="xsd:string" />
<xsd:attribute name="WorkdayHours" type="xsd:float" />
<xsd:attribute name="SickDays" type="xsd:unsignedByte" />
<xsd:attribute name="VacationDays" type="xsd:unsignedByte" />
<xsd:attribute name="FloatingDays" type="xsd:unsignedByte" />
<xsd:attribute name="VacationCarryoverYears" type="xsd:unsignedByte" />
</xsd:complexType>
<xsd:complexType name="ClassifiedAbsenceRecords_type">
<xsd:attribute name="absentRecordID" type="xsd:long" />
<xsd:attribute name="EmpNumber" type="xsd:string" />
<xsd:attribute name="EmpName" type="xsd:string" />
<xsd:attribute name="Department" type="xsd:string" />
<xsd:attribute name="AbsentFromDt" type="xsd:dateTime" />
<xsd:attribute name="AbsentToDt" type="xsd:dateTime" />
<xsd:attribute name="WorkingHours" type="xsd:float" />
<xsd:attribute name="NameOfSubstitute" type="xsd:string" />
<xsd:attribute name="ReasonID" type="xsd:unsignedByte" />
<xsd:attribute name="ReasonText" type="xsd:string" />
<xsd:attribute name="DeductionMonth" type="xsd:unsignedByte" />
<xsd:attribute name="DeductionYear" type="xsd:short" />
<xsd:attribute name="ESignDate" type="xsd:dateTime" />
<xsd:attribute name="SSignDate" type="xsd:dateTime" />
<xsd:attribute name="SupRecommendation" type="xsd:string" />
<xsd:attribute name="PayrollDeductionHours" type="xsd:float" />
<xsd:attribute name="PayrollDeductionRate" type="xsd:float" />
<xsd:attribute name="SchoolYear" type="xsd:short" />
<xsd:attribute name="TimeRecordCreated" type="xsd:dateTime" />
<xsd:attribute name="RecordCreatedBy" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="Departments_type">
<xsd:attribute name="Code" type="xsd:short" />
<xsd:attribute name="DPTCode" type="xsd:string" />
<xsd:attribute name="Title" type="xsd:string" />
</xsd:complexType>
<xsd:element name="FamilyRelationships" ms:relation="FamilyRelationships"
type="FamilyRelationships_type" />
<xsd:complexType name="FamilyRelationships_type">
<xsd:attribute name="Code" type="xsd:unsignedByte" />
<xsd:attribute name="Relationship" type="xsd:string" />
</xsd:complexType>
</xsd:schema>
<sql:xpath-query xmlns:sql="urn:schemas-microsoft-com:xml-sql"
mapping-schema="#InLineSchema1">
/Employees[@.EmployeeID='DBC72CCC-370F-4A98-8CDB-6F9F056EE04F']
</sql:xpath-query>
</ROOT>
--Template End--
"Graeme Malcolm" wrote:
> The VB code looks OK, and the error specifically mentions an XML parser
> error, which makes me think the error might be in your template rather than
> your client code. Can you execute the same template directly from a Template
> virtual name? Could you post the template you're trying to execute?
> --
> --
> Graeme Malcolm
> Principal Technologist
> Content Master Ltd.
> www.contentmaster.com
>
> "AeriesUser" <AeriesUser@.discussions.microsoft.com> wrote in message
> news:D2297502-8D5D-42FC-8FEE-8B0C8D9F1088@.microsoft.com...
> Folks:
> I need to use an dynamically generated xpath-query Template with inLine
> Schemas (like the one
> [URL=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqlxml3/htm/ssxsdannotations_1u7n.asp]HERE[/URL])
> I tried to use the function below, but am getting this error:
> ERROR: 500 Internal Server ErrorHResult: 0x80040e14Source: Microsoft XML
> Extensions to SQL ServerDescription: XML Parse Error: Unspecified error
> , Line: 2, Position: 155
> I've been looking for the reason for last 7 hours but without much progress.
> Can this be done? is there any other way? Any pointers would be greatly
> appreciated.
> Thanks in advance!!
> ----
> Public Function GetEmployeeData()
> Dim EmpTmplXML As New MSXML2.DOMDocument40
> Dim PostData
> EmpTmplXML.async = False
> 'Load Template from a File for test
> EmpTmplXML.Load aspObjServer.MapPath("\xxx\Template\EmpTemplate.xm l")
> 'In reality it will be something like this
> 'EmpTmplXML.loadXML <dynamicallyGeneratedTemplateAsString>
> Dim objSvrHTTP As New MSXML2.ServerXMLHTTP40
> objSvrHTTP.open "POST", "http://localhost/virtualDir", False
> objSvrHTTP.setRequestHeader "Content-Type", "application/xml"
> objSvrHTTP.send EmpTmplXML
> objSvrHTTP.waitForResponse
> PostData = objSvrHTTP.responseText
> Debug.Print PostData
> 'Do Something with PostData
> Set EmpTmplXML = Nothing
> Set objSvrHTTP = Nothing
> GetEmployeeData = PostData
> End Function
> ----
>
>
|||Hmm - that's weird. I can replicate the problem with this simplified
example:
Template (Template.xml):
<?xml version="1.0" ?>
<Catalog>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ms="urn:schemas-microsoft-com:mapping-schema"
xmlns:sql="urn:schemas-microsoft-com:xml-sql"
id="ProductSchema" sql:is-mapping-schema="1">
<xsd:element name="Product" ms:relation="Products">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ProductName" type="xsd:string"
ms:field="ProductName"/>
<xsd:element name="Price" type="xsd:decimal" ms:field="UnitPrice"
/>
</xsd:sequence>
<xsd:attribute name="ProductCode" type="xsd:integer"
ms:field="ProductID"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<sql:xpath-query xmlns:sql="urn:schemas-microsoft-com:xml-sql"
mapping-schema="#ProductSchema">
Product
</sql:xpath-query>
</Catalog>
VB Script:
set doc = CreateObject("MSXML2.DOMDocument.4.0")
doc.Load "GetProductsInline.xml"
Dim objSvrHTTP
Set objSvrHTTP= CreateObject("MSXML2.XMLHTTP.4.0")
objSvrHTTP.open "POST", "http://localhost/nwind", False
objSvrHTTP.setRequestHeader "Content-Type", "application/xml"
objSvrHTTP.send doc
PostData = objSvrHTTP.responseText
MsgBox PostData
My error is the same except that for the line and position (line 3, position
201).
The VDir is configured to allow everything - sql=, templates, post, XPath,
etc.
It works if I use a template containing a regular SELECT query, like this
one:
<?xml version='1.0' ?>
<Categorylist>
<sql:query xmlns:sql='urn:schemas-microsoft-com:xml-sql'>
SELECT CategoryID, CategoryName
FROM Categories
FOR XML AUTO, ELEMENTS
</sql:query>
</Categorylist>
So to summarize, I haven't a clue what the problem is, but I can confirm
that it's not your XML specifically - I get the same issue with completely
different data and template (I'm also using XMLHTTP instead of
ServerXMLHTTP - just to see if there was any difference, but no such luck!).
If I get time, my next step is to try a template that includes an XPath
expression against an external scheme to find out if it's just the inline
aspect it doesn't like or if there's an issue posting templates that use
XPath.
In the meantime, anyone else got any insights into this?
Cheers,
G
--
Graeme Malcolm
Principal Technologist
Content Master Ltd.
www.contentmaster.com
"AeriesUser" <AeriesUser@.discussions.microsoft.com> wrote in message
news:F087C703-2D85-4985-A5BB-EC5165848E10@.microsoft.com...
Hi Graeme,
Thank you very much for your respone.
Yes, I can call the template from the template virtualDir and get the XML
data that way, no problem.
Another thing I noticed, even though I change the elements/attributes I want
in the output (by changing the inline schema), the error is still showing
the
same line number/position. Perhaps, the xml returned by the sqlxml object is
not a valid one? But I don't know how to debug that.
Here's the template: Thanks again!
--Template Begin--
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ms="urn:schemas-microsoft-com:mapping-schema"
sql:is-mapping-schema="1"
id="InLineSchema1">
<xsd:annotation>
<xsd:appinfo>
<ms:relationship name="EmployeeDepartment" parent="Employees"
parent-key="EmployeeID" child="EmployeeDepartment"
child-key="EmployeeID" />
<ms:relationship name="EmployeeBU" parent="Employees"
parent-key="BargainingUnit" child="BargainingUnit"
child-key="UnitCode" />
<ms:relationship name="AbsenceRecords" parent="Employees"
parent-key="EmployeeNumber" child="ClassifiedAbsenceRecords"
child-key="EmpNumber" />
<ms:relationship name="DepartmentDesc" parent="EmployeeDepartment"
parent-key="DepartmentCode" child="Departments"
child-key="Code" />
<ms:relationship name="LeaveBalance" parent="Employees"
parent-key="EmployeeID" child="LeaveAmount"
child-key="EmployeeID" />
</xsd:appinfo>
</xsd:annotation>
<xsd:element name="Employees" ms:relation="Employees"
type="Employees_type" />
<xsd:complexType name="Employees_type">
<xsd:sequence>
<xsd:element name="EmployeeDepartment" ms:relation="EmployeeDepartment"
ms:relationship="EmployeeDepartment"
type="EmployeeDepartment_type" />
<xsd:element name="BargainingUnit" ms:relation="BargainingUnit"
ms:relationship="EmployeeBU"
type="BargainingUnit_type" />
<xsd:element name="ClassifiedAbsenceRecords"
ms:relation="ClassifiedAbsenceRecords" ms:relationship="AbsenceRecords"
type="ClassifiedAbsenceRecords_type"></xsd:element>
</xsd:sequence>
<xsd:attribute name="EmployeeID" type="xsd:string" />
<xsd:attribute name="SocialSecurityNumber" type="xsd:string" />
<xsd:attribute name="EmployeeNumber" type="xsd:string" />
<xsd:attribute name="FirstName" type="xsd:string" />
<xsd:attribute name="MiddleName" type="xsd:string" />
<xsd:attribute name="LastName" type="xsd:string" />
<xsd:attribute name="Title" type="xsd:string" />
<xsd:attribute name="EmailName" type="xsd:string" />
<xsd:attribute name="AltEmail" type="xsd:string" />
<xsd:attribute name="Extension" type="xsd:string" />
<xsd:attribute name="Address" type="xsd:string" />
<xsd:attribute name="City" type="xsd:string" />
<xsd:attribute name="StateOrProvince" type="xsd:string" />
<xsd:attribute name="Region" type="xsd:string" />
<xsd:attribute name="PostalCode" type="xsd:string" />
<xsd:attribute name="Country" type="xsd:string" />
<xsd:attribute name="HomePhone" type="xsd:string" />
<xsd:attribute name="WorkPhone" type="xsd:string" />
<xsd:attribute name="Birthdate" type="xsd:dateTime" />
<xsd:attribute name="Salary" type="xsd:decimal" />
<xsd:attribute name="Deductions" type="xsd:short" />
<xsd:attribute name="SpouseName" type="xsd:string" />
<xsd:attribute name="EmrgcyContactName" type="xsd:string" />
<xsd:attribute name="EmrgcyContactPhone" type="xsd:string" />
<xsd:attribute name="PhotoPath" type="xsd:string" />
<xsd:attribute name="BargainingUnit" type="xsd:short" />
<xsd:attribute name="HireDate" type="xsd:dateTime" />
<xsd:attribute name="CreateDate" type="xsd:dateTime" />
<xsd:attribute name="LastUpdateTime" type="xsd:dateTime" />
<xsd:attribute name="LastUpdatedBy" type="xsd:string" />
<xsd:attribute name="Active" type="xsd:boolean" />
</xsd:complexType>
<xsd:complexType name="EmployeeDepartment_type">
<xsd:attribute name="EmployeeID" type="xsd:string" />
<xsd:attribute name="DepartmentCode" type="xsd:short" />
<xsd:attribute name="DeptSequence" type="xsd:unsignedByte" />
<xsd:attribute name="DateStarted" type="xsd:dateTime" />
<xsd:attribute name="WorkdayHours" type="xsd:float" />
<xsd:attribute name="BillingRate" type="xsd:decimal" />
<xsd:attribute name="SupervisorID" type="xsd:string" />
<xsd:attribute name="WorkPhone" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="BargainingUnit_type">
<xsd:attribute name="UnitCode" type="xsd:short" />
<xsd:attribute name="UnitTitle" type="xsd:string" />
<xsd:attribute name="JobType" type="xsd:string" />
<xsd:attribute name="WorkdayHours" type="xsd:float" />
<xsd:attribute name="SickDays" type="xsd:unsignedByte" />
<xsd:attribute name="VacationDays" type="xsd:unsignedByte" />
<xsd:attribute name="FloatingDays" type="xsd:unsignedByte" />
<xsd:attribute name="VacationCarryoverYears" type="xsd:unsignedByte" />
</xsd:complexType>
<xsd:complexType name="ClassifiedAbsenceRecords_type">
<xsd:attribute name="absentRecordID" type="xsd:long" />
<xsd:attribute name="EmpNumber" type="xsd:string" />
<xsd:attribute name="EmpName" type="xsd:string" />
<xsd:attribute name="Department" type="xsd:string" />
<xsd:attribute name="AbsentFromDt" type="xsd:dateTime" />
<xsd:attribute name="AbsentToDt" type="xsd:dateTime" />
<xsd:attribute name="WorkingHours" type="xsd:float" />
<xsd:attribute name="NameOfSubstitute" type="xsd:string" />
<xsd:attribute name="ReasonID" type="xsd:unsignedByte" />
<xsd:attribute name="ReasonText" type="xsd:string" />
<xsd:attribute name="DeductionMonth" type="xsd:unsignedByte" />
<xsd:attribute name="DeductionYear" type="xsd:short" />
<xsd:attribute name="ESignDate" type="xsd:dateTime" />
<xsd:attribute name="SSignDate" type="xsd:dateTime" />
<xsd:attribute name="SupRecommendation" type="xsd:string" />
<xsd:attribute name="PayrollDeductionHours" type="xsd:float" />
<xsd:attribute name="PayrollDeductionRate" type="xsd:float" />
<xsd:attribute name="SchoolYear" type="xsd:short" />
<xsd:attribute name="TimeRecordCreated" type="xsd:dateTime" />
<xsd:attribute name="RecordCreatedBy" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="Departments_type">
<xsd:attribute name="Code" type="xsd:short" />
<xsd:attribute name="DPTCode" type="xsd:string" />
<xsd:attribute name="Title" type="xsd:string" />
</xsd:complexType>
<xsd:element name="FamilyRelationships" ms:relation="FamilyRelationships"
type="FamilyRelationships_type" />
<xsd:complexType name="FamilyRelationships_type">
<xsd:attribute name="Code" type="xsd:unsignedByte" />
<xsd:attribute name="Relationship" type="xsd:string" />
</xsd:complexType>
</xsd:schema>
<sql:xpath-query xmlns:sql="urn:schemas-microsoft-com:xml-sql"
mapping-schema="#InLineSchema1">
/Employees[@.EmployeeID='DBC72CCC-370F-4A98-8CDB-6F9F056EE04F']
</sql:xpath-query>
</ROOT>
--Template End--
"Graeme Malcolm" wrote:
> The VB code looks OK, and the error specifically mentions an XML parser
> error, which makes me think the error might be in your template rather
> than
> your client code. Can you execute the same template directly from a
> Template
> virtual name? Could you post the template you're trying to execute?
> --
> --
> Graeme Malcolm
> Principal Technologist
> Content Master Ltd.
> www.contentmaster.com
>
> "AeriesUser" <AeriesUser@.discussions.microsoft.com> wrote in message
> news:D2297502-8D5D-42FC-8FEE-8B0C8D9F1088@.microsoft.com...
> Folks:
> I need to use an dynamically generated xpath-query Template with inLine
> Schemas (like the one
> [URL=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqlxml3/htm/ssxsdannotations_1u7n.asp]HERE[/URL])
> I tried to use the function below, but am getting this error:
> ERROR: 500 Internal Server ErrorHResult: 0x80040e14Source: Microsoft XML
> Extensions to SQL ServerDescription: XML Parse Error: Unspecified error
> , Line: 2, Position: 155
> I've been looking for the reason for last 7 hours but without much
> progress.
> Can this be done? is there any other way? Any pointers would be greatly
> appreciated.
> Thanks in advance!!
> ----
> Public Function GetEmployeeData()
> Dim EmpTmplXML As New MSXML2.DOMDocument40
> Dim PostData
> EmpTmplXML.async = False
> 'Load Template from a File for test
> EmpTmplXML.Load aspObjServer.MapPath("\xxx\Template\EmpTemplate.xm l")
> 'In reality it will be something like this
> 'EmpTmplXML.loadXML <dynamicallyGeneratedTemplateAsString>
> Dim objSvrHTTP As New MSXML2.ServerXMLHTTP40
> objSvrHTTP.open "POST", "http://localhost/virtualDir", False
> objSvrHTTP.setRequestHeader "Content-Type", "application/xml"
> objSvrHTTP.send EmpTmplXML
> objSvrHTTP.waitForResponse
> PostData = objSvrHTTP.responseText
> Debug.Print PostData
> 'Do Something with PostData
> Set EmpTmplXML = Nothing
> Set objSvrHTTP = Nothing
> GetEmployeeData = PostData
> End Function
> ----
>
>
|||Hello, Graeme!
You wrote on Thu, 21 Oct 2004 17:16:53 +0100:
[Sorry, skipped]
GM> In the meantime, anyone else got any insights into this?
Sorry, but I cann't reproduce the error. All works fine for me.
I have 3.01.1915.00 version of sqlis3.dll, default version of msxml is 3.0
and soaptoolkit 3.0
[Sorry, skipped]
With best regards, Alex Shirshov.
|||I've got version 3.2.3523.0 of sqlis3.dll (SQLXML 3.0 SP2). Dunno if there
are any known issues with that version relating to posting inline schemas
though.
Cheers,
Graeme
--
Graeme Malcolm
Principal Technologist
Content Master Ltd.
www.contentmaster.com
"Alex Shirshov" <nomail@.mail.ru> wrote in message
news:OERifUEuEHA.2300@.TK2MSFTNGP09.phx.gbl...
Hello, Graeme!
You wrote on Thu, 21 Oct 2004 17:16:53 +0100:
[Sorry, skipped]
GM> In the meantime, anyone else got any insights into this?
Sorry, but I cann't reproduce the error. All works fine for me.
I have 3.01.1915.00 version of sqlis3.dll, default version of msxml is 3.0
and soaptoolkit 3.0
[Sorry, skipped]
With best regards, Alex Shirshov.
|||Here's a possible (not preferred but gets the job done) solution to this
situation.
This solution makes use of ADO object
(BTW Thanks Graeme and Alex for looking at this and giving me hope)
Private Function GetXMLDataThruADO(dynamicTemplateAsText)
Dim oTestStream As New ADODB.Stream
Dim oTestConnection As New ADODB.Connection
Dim oTestCommand As New ADODB.Command
Dim locXML
oTestConnection.open "provider=sqlxmloledb.3.0;data
provider=sqloledb;data source=(local);initial catalog=dbName;user
id=usr;password=pwd"
oTestCommand.ActiveConnection = oTestConnection
oTestCommand.Properties("ClientSideXML") = "False"
oTestCommand.CommandText = dynamicTemplateAsText
oTestStream.open
' You need the dialect if you are executing a template.
oTestCommand.Dialect = "{5d531cb2-e6ed-11d2-b252-00c04f681b71}"
oTestCommand.Properties("Output Stream").Value = oTestStream
oTestCommand.Properties("Output Encoding") = "utf-8"
oTestCommand.Execute , , adExecuteStream
oTestStream.Position = 0
oTestStream.Charset = "utf-8"
locXML = oTestStream.ReadText(adReadAll)
Set oTestStream = Nothing
Set oTestConnection = Nothing
Set oTestCommand = Nothing
GetXMLDataThruADO = locXML
End Function
"Graeme Malcolm" wrote:
> I've got version 3.2.3523.0 of sqlis3.dll (SQLXML 3.0 SP2). Dunno if there
> are any known issues with that version relating to posting inline schemas
> though.
> Cheers,
> Graeme
> --
> --
> Graeme Malcolm
> Principal Technologist
> Content Master Ltd.
> www.contentmaster.com
>
> "Alex Shirshov" <nomail@.mail.ru> wrote in message
> news:OERifUEuEHA.2300@.TK2MSFTNGP09.phx.gbl...
> Hello, Graeme!
> You wrote on Thu, 21 Oct 2004 17:16:53 +0100:
>
> [Sorry, skipped]
> GM> In the meantime, anyone else got any insights into this?
> Sorry, but I cann't reproduce the error. All works fine for me.
> I have 3.01.1915.00 version of sqlis3.dll, default version of msxml is 3.0
> and soaptoolkit 3.0
>
> [Sorry, skipped]
>
> With best regards, Alex Shirshov.
>
>
|||A few questions:
What version of SqlXml are you using?
You do have POSTed templates enabled, correct?
What is at Line 2, position 155?
Thanks,
Irwin
Irwin Dolobowsky
Program Manager, SqlXml
http://blogs.msdn.com/irwando
This posting is provided "AS IS" with no warranties, and confers no rights.
"AeriesUser" <AeriesUser@.discussions.microsoft.com> wrote in message
news:D2297502-8D5D-42FC-8FEE-8B0C8D9F1088@.microsoft.com...
> Folks:
> I need to use an dynamically generated xpath-query Template with inLine
> Schemas (like the one
> [URL=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqlxml3/htm/ssxsdannotations_1u7n.asp]HERE[/URL])
> I tried to use the function below, but am getting this error:
> ERROR: 500 Internal Server ErrorHResult: 0x80040e14Source: Microsoft XML
> Extensions to SQL ServerDescription: XML Parse Error: Unspecified error
> , Line: 2, Position: 155
> I've been looking for the reason for last 7 hours but without much
> progress.
> Can this be done? is there any other way? Any pointers would be greatly
> appreciated.
> Thanks in advance!!
> ----
> Public Function GetEmployeeData()
> Dim EmpTmplXML As New MSXML2.DOMDocument40
> Dim PostData
> EmpTmplXML.async = False
> 'Load Template from a File for test
> EmpTmplXML.Load aspObjServer.MapPath("\xxx\Template\EmpTemplate.xm l")
> 'In reality it will be something like this
> 'EmpTmplXML.loadXML <dynamicallyGeneratedTemplateAsString>
> Dim objSvrHTTP As New MSXML2.ServerXMLHTTP40
> objSvrHTTP.open "POST", "http://localhost/virtualDir", False
> objSvrHTTP.setRequestHeader "Content-Type", "application/xml"
> objSvrHTTP.send EmpTmplXML
> objSvrHTTP.waitForResponse
> PostData = objSvrHTTP.responseText
> Debug.Print PostData
> 'Do Something with PostData
> Set EmpTmplXML = Nothing
> Set objSvrHTTP = Nothing
> GetEmployeeData = PostData
> End Function
> ----
|||Hi Irwin, Thanks for responding.
1) I have tried this with SQLXML 3.0 sp2 and also with sp3 that you released
yesterday. Same errors with both versions.
2) Yes, I do have the POSTed templates enabled.
3) The error in Line 2, position 155 is not from my template, but is in the
"XML response from the server". The template itself validates fine and I am
also able to get the xml data if I bring up that template in the browser
http://localhost/sqlvirDir/template/myTemplate.xml
Graeme Malcom, in the post above was also able to replicate this problem.
Mine and his templates are also posted in the above responses.
Please let me know if you need any other information.
Thanks!
"Irwin Dolobowsky [MSFT]" wrote:
> A few questions:
> What version of SqlXml are you using?
> You do have POSTed templates enabled, correct?
> What is at Line 2, position 155?
> --
> Thanks,
> Irwin
> Irwin Dolobowsky
> Program Manager, SqlXml
> http://blogs.msdn.com/irwando
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "AeriesUser" <AeriesUser@.discussions.microsoft.com> wrote in message
> news:D2297502-8D5D-42FC-8FEE-8B0C8D9F1088@.microsoft.com...
>
>
|||Hello, AeriesUser!
You wrote on Wed, 27 Oct 2004 23:49:05 -0700:
[Sorry, skipped]
A> Graeme Malcom, in the post above was also able to replicate this
A> problem. Mine and his templates are also posted in the above responses.
A> Please let me know if you need any other information.
[Sorry, skipped]
I peer into your vb script and have seen, that you post template to the
server. It is not allowed. If it will, than anybody, who knows the address
will be able to execute any TSQL statement. SQLXML allows only to execute
predefined, wellknown templates that are stored in special template folder.
Just replace your script with the following
Dim objSvrHTTP As New MSXML2.ServerXMLHTTP40
objSvrHTTP.open "POST",
"http://localhost/virtualDir/templatepath/actualtemplate.xml", False
objSvrHTTP.setRequestHeader "Content-Type", "application/xml"
objSvrHTTP.send
objSvrHTTP.waitForResponse
PostData = objSvrHTTP.responseText
Debug.Print PostData
With best regards, Alex Shirshov.
Friday, March 23, 2012
How can I post a dynamically generated template
Labels:
database,
dynamically,
folksi,
generated,
inlineschemas,
microsoft,
mysql,
oracle,
server,
sql,
template,
xpath-query
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment