Xml error: Namespace Manager or Xslt context needed.This query has

I am using VB.Net. My program is to connect to a remote IPAddress. Once, it 
verifies the login information it should display the SessionID and enable 
some button . I appreciate your help and thanku in advance 

When I run the pgm , I get the error:
Can't parse login information. Namespace Manager or XsltContext needed. This 
query has a prefix, variable or userdefined function.

I have added the Try-catch in all my functions. In ParseLoginResponse 
function, it catches the above exception.

I am inclding all the functions I am using below:

Private Function SendXmlRequest(ByRef xml As String)


            Dim xmpRequest As HttpWebRequest = WebRequest.Create(XmpUrl)

            ' Instantiate an XmlDocument object to avoid NullReference 

            Dim xmlDoc As XmlDocument

            xmlDoc = New System.Xml.XmlDocument

            'System.Xml.XmlDocument(xmldoc = New System.Xml.XmlDocument)

            'Dim xmlDoc As XmlDocument = Nothing

            'Dim xmlReader As XmlTextReader

            'xmlReader = Nothing

            xmpRequest.Method = "POST"

            xmpRequest.KeepAlive = True

            xmpRequest.ContentType = "text/xml"

            Dim writer As StreamWriter

            writer = New StreamWriter(xmpRequest.GetRequestStream())



            'Send the request and get the response

            Dim HttpWResponse As HttpWebResponse = 
CType(xmpRequest.GetResponse(), HttpWebResponse)

            'Console.WriteLine("before sending status")

            'Get the status and the headers

            Dim iStatCode As Integer = HttpWResponse.StatusCode

            Dim sStatus As String = iStatCode.ToString()

            Console.WriteLine("Status: {0} {1}", sStatus, 

            Console.WriteLine("Request Headers:")


            Console.WriteLine("Response Headers:")



            If Not HttpWResponse Is Nothing Then

                Dim XmlRead = New 

                'Dim xmlDoc As XmlDocument

                'xmlDoc = New XmlDocument

                'Dim xmlDoc = New XmlDocument


                Return xmlDoc


                Console.WriteLine("try again")


            End If

            'Get the response stream

            Dim strm As Stream = HttpWResponse.GetResponseStream()

            'Read the Response stream

            Dim encode As Encoding = 

            Dim sr As New StreamReader(strm, encode)

            Console.WriteLine("Response: {0}", sr.ReadToEnd())


            'new feb13

            'Dim doc As New XmlDocument






            'Read the response stream

            'Dim sr As StreamReader = New StreamReader(strm)

            'Dim sText As String = sr.ReadToEnd()

            'Console.WriteLine("Response: {0}", sText)


            '???Close the stream



            'Clean up

            'xmpRequest = Nothing

            'HttpWResponse = Nothing

            'MyCredentialCache = Nothing

            'myCred = Nothing

            'strm = Nothing

            'sr = Nothing



            'If sStatus = 200 Then

            'The Http Request/Response was successful, now we need to check 
the XML that was returned for errors

            'If Not RequestHasErrrors(xmpRequest.responseRext) Then

            'The overall request was successful so begin to parse the 
response XML 


            'SendXmlRequest = xmpRequest.responseXml

            'End If




            'End If

                       'End If


            'Call MsgBox("There was an error.  ReadyState = " & 

            'End If



        Catch ex As NullReferenceException


            MsgBox("Can't Request page" & vbCrLf & ex.Message)


        End Try


    End Function


    Private Function RequestHasErrors(ByRef xml As String) As Boolean

        ' Check for the high level error Xml in any response before

        ' trying to parse the results.

        If InStr(xml, "<Response><Error>") >= 1 Then

            RequestHasErrors = True

        End If

    End Function


    Private Function ParseLoginResponse(ByRef loginDom As XmlDocument) As 

        ' See if the login was successful.  If so, get the SessionID.

        ' Otherwise, log the error.



            ParseLoginResponse = False


            ' Setup the Dom to use XPath queries and also setup

            ' an Xml namespace prefix for use in the XPath queries.

            'Call loginDom.setProperty("SelectionLanguage", "XPath")


            Dim filterDoc As New XmlDocument



            'Instantiate an XmlNamespaceManager object

            'Dim nsmgr As XmlNamespaceManager

            'nsmgr = New XmlNamespaceManager(filterDoc.NameTable)


            'Add the namespaces used in books.xml to the XmlNamespaceManager.

            'nsmgr.AddNamespace("SelectionLanguage", "XPath")


"xmlns:ns='urn:schemas -tms:LoginResponse'")


            Dim node As XmlNode

            node = loginDom.SelectSingleNode("ns:LoginResponse/ns:Status")

            'node = New XmlDocument


            If node.Value = "Success" Then

                ' The login was 100% successful so get the SessionID.


                'new Feb 14

                'If node Is Nothing Then


                'for testing

                Console.WriteLine("Login successful: " & node.Value)

                node = 



                'Dim resultImport As XmlNode

                'resultImport = filterDoc.ImportNode(node, True)


                'Return True

                'g_SessionID = node.Value

                ParseLoginResponse = True

                'Console.WriteLine("Login successful: " & node.Value)






                'The login was not 100% successful

                node = 

                Console.WriteLine("Login unsuccessful: " & node.InnerText)




            End If


        Catch ex As Exception

            MsgBox("Can't parse login information" & vbCrLf & ex.Message)



        End Try


        'Return True


        ' The login was not 100% successful.

        'node = loginDom.SelectSingleNode("ns:LoginResponse/ns:SystemMessage")

        'Console.WriteLine("Login unsuccessful: " & node.text)

        'End If


        'loginDom = Nothing

        'node = Nothing

    End Function





End Class

2/16/2006 3:34:28 PM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 35


Similar Artilces:

XML Header
Hi, I have some XML doc loaded in a C# Web Service. XmlDocument doc = new XmlDocument(); doc.LoadXml(myDoc); Code Missing to manipulate header (I would like to replace or manupulate all these XXXXX): <mso-XXXXXX productversion="XXXXXX"> <mso-application progid="XXXXX"?> doc.Save(myNewDoc); Any idea on how to access and manipulate data within the doc header? Thanks vbdev vb6dev2003 wrote: > I have some XML doc loaded in a C# Web Service. > XmlDocument doc = new XmlDocument(); > doc.LoadXml(myDoc); > > Code Missing to manipulate header ...

Mailbox Manager
I tried posting this to a different group and got nothing back... I've got a single server, single storage group Exchange 2003. I have 4 Recipient Policies: Pri 1: main domain Pri 2: other domains Pri 3: Mailbox Cleanup Lowest: Default Policy The priority 3 policy (Mailbox Cleanup) is the only one that has Mailbox Manager Settings. I have constructed a query as follows: Find: "Exchange Recipients" General Tab: Show these recipients: "Users with Exchange mailbox" Storage Tab: "Mailboxes on any server" Advanced Tab: Condition List: "Member Of Is no ...

aliases generate error -10660
I just installed Office 2004 on a new iMac running OS 10.3.6 If the office application is not running and I double-click on an office document, I get the error message The operation could not be completed. An unexpected error occurered (error code -10660). If I have the application running and double click on a document it opens fine. Double clicking documents from other applications properly opens the application. I've uninstalled & reintstalled and problem still exists. Suggestions? Thanks, David In article <a5608d5.0412021043.5032a4d4@posting.google.com>, david@teton1....

Read XHTML into XML
Hi all, I need to read/parse XHTML aspx pages and look for certain tokens and content. How can I use a XmlTextReader for this? If not, any other ideas? Thanks in advance, JA Reyes. Jose Antonio Reyes wrote: > I need to read/parse XHTML aspx pages and look for certain tokens and > content. How can I use a XmlTextReader for this? If not, any other ideas? If the pages are well-formed XHTML then it is possible to use XmlReader (in .NET 2.0/3.0) or XmlTextReader (in .NET 1.x) to parse the XHTML documents. You can also use the other XML APIs .NET provides so using XPathNavigator and/o...

Need to display blank fields
It would be really good to have 26 records display per page (or at least on 1 page) even if there are only 2 records. In other words, today I have 2 checks but I need 24 blank records after to make up the entire deposit slip. Someone mentioned a line method but I do not believe that would get me the numbers 3. - 26. along side the blank records. Any ideas? "Michael" <michael@kisielrudnik.com> wrote > It would be really good to have 26 records > display per page (or at least on 1 page) even > if there are only 2 records. In other words, > today I hav...

Security Service Error
This is a multi-part message in MIME format. ------=_NextPart_000_0012_01C3F55C.A5DEBC20 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Ok, I have a problem... my CRM Security Service fails to start and this = is the error I get: Source: MSCRMSecurityService Event ID: 5920 Error: An error occurred while attempting to update the SCP (Active = Directory update). -2147016656 (0x80072030) Description: There is no = such object on the server. I used to work then i rebooted and now this... Any Ideas, everything = else seems to be running ...

error
Money 2002 has been working fine until recently. When signing on with my .Net Passport keep getting 2 error messages... "Money is unable to verify your online sign-in. Money will now try to log you in using Work Offline sign-in. Some online features, such as background banking, will be unavailable possibly because of network problems. To use online features, please close Money and try to sign again later." After clicking okay on that message, I get another error message... "The sign-in attempt for < > was unsuccessful. Please try your sign in name and passwor...

How to invoke the xml editor?
I installed vs2005 on a new xp pro machine, and installed everything except C++. When I click on a file with a ".xml" extension it is opened with IE. When I click file/Edit with XML Editor, it opens it with Notepad. If I click File/Open With and select XML Editor, it opens it with IE. So, where is the xml editor? Can it be invoked from withing VS? Where? Bill * billsahiker@yahoo.com wrote in microsoft.public.dotnet.xml: >I installed vs2005 on a new xp pro machine, and installed everything >except C++. When I click on a file with a ".xml" extension it is >opened ...

run-time error when I re-print an Invoice
Hello I am new to RMS and I am trying to figure out the reason of the run-time error every time I try to re-print an invoice or press the journal button. the error will result in terminating my existing application (POS) and the error also says that t"disconnecting from client...) and give me an error numbers. Any help? HI Alex, can you please specific the exact error no so we can help you in better way. actually wanted to know what create error, also do you know how to check the event log in windows OS check the application event log and find what error or what is the reason your...

show XML schema and values
I have an XML document that looks like the following: <record> <Field1>value1</Field1> <Field2>value2</Field2> <Field3>value3</Field3> </record> What I'm aiming to do is to show the data in a report as in the following example: record: Field1 value1 Field2 value2 Field3 value3 The "Field1-3"-elements can have any name, so I'm trying to get a table that has in one result column the element name, and in the second colum...

activesheet error
Hi I've done something wrong here and I can't work out what it is... Error msg: "Compile Error: With object must be user-defined type, object, or Variant" Sub copylplan() Dim mySheet As String mySheet = ActiveSheet With mySheet .Copy After:=Sheets(Sheets.Count) End With With mySheet .Name = "Extract Plan" End With End Sub -- Thank for your help BeSmart Hi, Set the variable as a Worksheet then use Set in the line to assign the ActiveSheet to the variable. You should realize that the variable rem...

Distribution List Error...
I have a couple of users that have created a distribution list in their contacts and when they go to send to it they get the following error... Microsoft Office Word An internal support function returned an error Now the funny thing is if I change their settings to not use word as their email editor it will send but only until they log off. When they log back on I have to set it to use Word as their email editor or change it to Rich Text. Has anybody else had this happen? If so, what is the resolution? ...

Outlook error message #45
Hello, I have had Outlook 2007 installed on my laptop for months with no issues. 2 weeks ago the program would occasionally give me an error message "your email server rejected your login. Verify your user name and password in account properties...". Now 2 days ago this message pops up all the time and I no longer can send/receive emails. I have tried to repair Outlook, un-installing, and re-installing, nothing seems to work! Which Anti Virus are you using to scan incoming and outgoing email -- Peter Please Reply to Newsgroup for the benefit of others Requests for assistan...

Need "Out of Office Assistant " Access
I use Microsoft Office 2003 with the XP Service Pack 2 Download. Please let me know if there is any way I can set up an Out of Office Assistant. I need to know how to get and Exchange Server e-mail account for my business: Journeys far & Near, LLC for which I use this computer. I am a self-employed person operating as an independent contractor under that company name - without a complicated set-up, but with a professional grade Dell Latitude D600 computer and Windows XP Professional. I've been working with Windows since 3.0, and with PC's since the XT, although my bus...

Birthday entry error
I have Win 7 Home Premium x64 and WLMail. When editing my contact, I tried to use a pop down calendar in the Birthday entry area. I opened calendar and clicked Feb 3, 2010, however the date on the line appeared as March 2... July 11 transferred into Nov 7, etc. Entering manually 03/02/xxxx produces correct entry 03 Feb xx, manual entry of 11/07/xxxx results in the correct 11 Jul xx, etc. Entering birthdate on Contacts.com do not change rntry on my desktop. May someone please tell me what's the correct way to enter the birthday info? Also, what is the easy way to get to a drop ...

outlook 2000 mailbox.pst error. inbox repair tool
hi all I am getting a error message from outlook 2000 that says errors have been detected in the file c:\windows\application data\microsoft\outlook\mailbox.pst It says to use the inbox repair tool. I have searced microsoft online help and found the site "ol2000 how to find and run the inbox repair tool" I am using ME. I have been looking for "Scanpst.exe" file. Microsoft help says to follow c:\program files\common\system\Mapi\1033\nt I cannnot find a file by this name. I can find a file c:\program files\common\system\Mapi\1033\95 when I run "Scanpst.exe&qu...

i have a list i need to copy onto another sheet one by one
I have created an invoice on an excel spreadsheet for a new business and my plan was to use a sales list on another sheet linked to the invoice , using the same fields it worked perfectly the first time using basic = sign, then i discovered that second and subsequent entries to the list would have to be set up again . can excel handle this so that I don,t need to retype after each entry. If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the subject line ...

Offline synch using XML web-services
This is a bit long-winded. Can somebody read thru these 2 use cases, and tell me if it is feasible ? :- Use Case : Replication before Offline Synch Scenario 1 : Oracle Server , MSDE client 1. User clicks on 'Go Offline'. System creates a MSDE SQL database in laptop (client), gets the schemas of the tables in Oracle, creates corresponding tables in client's MSDE SQL (mapping Oracle datatypes to SQL datatypes). 2. Offline replication program reads in the tables of the server into a typed datasets, converts the typed datasets into XML, and stores the XML in the client. (XML serial...

Error after Outlook reinstall
This would pop up. Error - Could not obtain Microsoft Outlook version Also, I can't install the microsoft updates to outlook because it says because it doesn't know it's version. -- Kate So what version of Outlook did you re-install -- Peter Please Reply to Newsgroup for the benefit of others Requests for assistance by email can not and will not be acknowledged. "SFKate" <SFKate@discussions.microsoft.com> wrote in message news:1F6F470A-D977-42CE-A342-909DAA07FE2A@microsoft.com... > This would pop up. Error - Could not obtain Microsoft Out...

Salespersion Managment
hi guys, I wanna know about the salesperson mangment, if any one as an idea about it or any one can point me to any documentation about that thanks for all ...

oe error 0x800c012f
I cannot receive and send emails in Outlook Express! There are no tasks in the progress window. But there is an error: 0x800c012f. What does it mean? Hi - This is a group to support Outlook from the Office group of programs. Outlook Express is a part of Internet Explorer and is a quite different program, despite its similar name.. You will probably get a faster and more expert answer if you post this to an Outlook Express news group. Try posting in one of these newsgroups: microsoft.public.windows.inetexplorer.ie5.outlookexpress for OE 5.x microsoft.public.windows.inetexplorer.ie55.outlook...

query comes up blank
Could somebody please look at my query. I've looked and looked and tried changing it all different ways, but I can't work out why I'm not getting any data. My query includes the following field Afternoon Shift: IIf([Sleepover]=True Or [ServiceDate]=[PhDate] Or Format([ServiceDate],"ddd")="Sat" Or Format([ServiceDate],"ddd")="Sun",0,IIf([EndTime]>Format(#8:00:00 PM#,"Short Time") And [EndTime]<=Format(#12:00:00 AM#,"Short Time"),Format([Hrs],"Fixed"),0)) On Tue, 12 Jan 2010 20:26:01 -0800, M...

XML Serialization ... how to truncate <?xml...
While xml serializing object how can I truncate <?xml ...?> this line alone? I need to send the serialized xml data to a web method ... since SOAP already have <?xml tag there was some confusion Any help would be greatly appreciated Thank you Regards Raj Raj wrote: > While xml serializing object how can I truncate <?xml ...?> this line alone? Serialize to an XmlWriter created with XmlWriterSettings where you set OmitXmlDeclaration to true. -- Martin Honnen --- MVP XML http://msmvps.com/blogs/martin_honnen/ ...

compile error #3
Every time I start excel (2002) I receive an error message: "compile error in hidden module: TBRun97". If I click "HELP" on the error message, I get an empty help window. If I click "OK", the error message goes away and I am able to work in excel. The same error occurs when I exit the program. Help please. Here's an MSKB article that describes Don's response: XL: Compile Error in Hidden Module Tbrun97.xls http://support.microsoft.com/default.aspx?scid=kb;en-us;272066 Leo wrote: > > Every time I start excel (2002) I receive an error >...

error adding new Schema Field 04-21-04
Hi, When I attempt to add a new schema field to the "Lead" object in the Deployment Manager, I get the following error: "An error occured during the addtion of the new field. The addition failed." In the event log, I there are two relevant entries: "dmLog: Failed to add new Picklist attribute (CFPsolution) to Lead entity" and "dmLog: sp_repladdcolumn failed. - Timeout expired" I've previously successfully added a pickup list called "Sector" with 9 values. Therefore I don't think I've exceeded the 8000 char row limit. Apart from...