Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 28th, 2007, 05:43 PM
Authorized User
 
Join Date: Sep 2004
Posts: 62
Thanks: 0
Thanked 1 Time in 1 Post
Default XML Parse Error - OBJECT REQUIRED?!?

Ok - I am completely missing something here - I hope someone can help. Below is a well formed XML response I am getting to an HTTPPOST. It loads correctly however I keep getting an "Object required: '[object]'" error when attempting to grab the value from one of the nodes that is obviously present. Can anyone look at this and tell me what I am doing wrong here - I would appreciate it.

Here is the Response:

<?xml version="1.0" encoding="UTF-8"?><RETURNBX_RESPONSE xmlns="www.detroittradingexchange.com/BuyerMessages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="www.detroittradingexchange.com/BuyerMessages http://www.detroittradingexchange.com/BuyerMessages/RETURNBX_REQUEST.XSD"><Success>True</Success><Return_Disposition> <Lead_Credit_Amount>50000</Lead_Credit_Amount> <Commission_Credit_Amount>5000</Commission_Credit_Amount> <Seller_DTX_ID>0000-1434</Seller_DTX_ID> <Lead_Date_Of_Record>11/18/2007 11:10:32 PM</Lead_Date_Of_Record> <Credit_Date_Of_Record>11/29/2007 12:20:45 PM</Credit_Date_Of_Record> </Return_Disposition></RETURNBX_RESPONSE>

Here is my code to attempt to parse the response:

set xmlObj = Server.CreateObject("Microsoft.XMLDOM")
xmlObj.setProperty "ServerHTTPRequest", True
xmlObj.async = False
xmlObj.setProperty "SelectionLanguage","XPath"
ns = "www.detroittradingexchange.com/BuyerMessages"
xmlObj.setProperty "SelectionNamespaces","xmlns:ns='" & ns & "'"
bLoaded = xmlObj.loadxml(xmlPing.ResponseText)

If bLoaded Then


ERROR --> credit_approved = xmlObj.documentElement.selectSingleNode("/*/ns:Success").text
 
Old November 29th, 2007, 02:33 PM
Authorized User
 
Join Date: Sep 2004
Posts: 62
Thanks: 0
Thanked 1 Time in 1 Post
Default

I am missing something - the elements are clearly there! I am getting the same errors when attempting to parse these lines as well:

credit_amount = xmlObj.selectSingleNode("/*/ns:Return_Disposition/ns:Lead_Credit_Amount").text
commish_amount = xmlObj.selectSingleNode("/*/ns:Return_Disposition/ns:Commission_Credit_Amount").text

 
Old November 29th, 2007, 02:43 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Are you binding the "ns" namespace prefix correctly in your application?

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old November 29th, 2007, 02:53 PM
Authorized User
 
Join Date: Sep 2004
Posts: 62
Thanks: 0
Thanked 1 Time in 1 Post
Default

I believe so, yeah... The original HTTPPost looks like this followed by exactly what is above.

credit_packet = "<?xml version=""1.0"" encoding=""UTF-8""?>" & _
                "<RETURNBX_REQUEST xmlns=""www.detroittradingexchange.com/BuyerMessages"" " & _
                "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" " & _
                "xsi:schemaLocation=""www.detroittradingexchange.c om/BuyerMessages " & _
                "http://www.detroittradingexchange.com/BuyerMessages/RETURNBX_REQUEST.XSD"">" & _
                "<RESERVATION_ID>6fedb5ce-b5e9-434e-9b23-a9cb0ca7642d</RESERVATION_ID>" & _
                "<RETURN_REASON>DUPLICATE_LEAD</RETURN_REASON>" & _
                "</RETURNBX_REQUEST>"

final_credit_packet = "User=000011&Password=123User&Message=" & credit_packet & "&DebugMode=false"

set xmlPing = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
xmlPing.Open "POST", ping_url, False
xmlPing.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlPing.Send(final_credit_packet)








Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Required Error JeffGirard Access 5 October 2nd, 2009 08:09 AM
Object Required error voyeur Javascript 9 January 25th, 2008 11:50 AM
Object required error ?? hman SQL Server ASP 11 June 21st, 2004 10:59 AM
ASP+XML OBJECT REQUIRED PROBLEM! S O S! mihalisp XML 0 April 28th, 2004 12:13 PM
error....Object required: '' sassenach Classic ASP Databases 2 August 4th, 2003 03:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.