473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

help with xml request

hi all,

i am trying to send request over tcp to cummunicate with a CCV POS Engine.

but i keep on getting this error
System.InvalidOperationException:In XML-document (2, 2)System.InvalidOperationException: <ServiceRequest xmlns='http://www.nrf-arts.org/IXRetail/namespace'> not expected.

if i dont send this attribute i get the same error:
system.invalid.opratorexception xmlns="" was not expected.

any ideas?


this is my code im working in VS 2010 using C# .net microframework

Expand|Select|Wrap|Line Numbers
  1.  public static byte[] LoginRequest()
  2.         {
  3.             MemoryStream ms = new MemoryStream();
  4.             XmlWriter xmlwrite = XmlWriter.Create(ms);
  5.  
  6.             xmlwrite.WriteString("\r");
  7.             xmlwrite.WriteProcessingInstruction("xml", "version=\"1.0\" encoding=\"utf-8\"");
  8.  
  9.             xmlwrite.WriteStartElement("ServiceRequest");
  10.             xmlwrite.WriteAttributeString("WorkstationID", WorkstationId); 
  11.             xmlwrite.WriteAttributeString("RequestID", "1");
  12.             xmlwrite.WriteAttributeString("RequestType", "Login");
  13.             xmlwrite.WriteAttributeString("xmlns","http://www.nrf-arts.org/IXRetail/namespace");
  14.  
  15.             xmlwrite.WriteString("\r\t");
  16.             xmlwrite.WriteStartElement("POSdata");
  17.             xmlwrite.WriteAttributeString("LanguageCode", "nl");
  18.  
  19.             xmlwrite.WriteString("\r\t\t");
  20.             xmlwrite.WriteStartElement("POSTimeStamp");
  21.             xmlwrite.WriteString(time);
  22.             xmlwrite.WriteEndElement();
  23.  
  24.             xmlwrite.WriteString("\r\t\t");
  25.             xmlwrite.WriteStartElement("ShiftNumber");
  26.             xmlwrite.WriteString("0");
  27.             xmlwrite.WriteEndElement();
  28.  
  29.             xmlwrite.WriteString("\r\t\t");
  30.             xmlwrite.WriteStartElement("PrinterStatus");
  31.             xmlwrite.WriteString("Unavailable");
  32.             xmlwrite.WriteEndElement();
  33.  
  34.             xmlwrite.WriteString("\r\t");
  35.             xmlwrite.WriteEndElement();     // End POSdata
  36.             xmlwrite.WriteString("\r");
  37.             xmlwrite.WriteEndElement();    // End root ServiceRequest
  38.  
  39.             xmlwrite.Flush();
  40.             byte[] byteArray = ms.ToArray();
  41.             xmlwrite.Close();
  42.  
  43.             //////// display the XML data ///////////
  44.  
  45.             char[] cc = System.Text.UTF8Encoding.UTF8.GetChars(byteArray);
  46.             string str = new string(cc);
  47.             Debug.Print(str);
  48.  
  49.             return byteArray;
  50.         }
  51.  
and this i how the xml output should look like

<?xml version="1.0" encoding="utf-8"?>
<ServiceRequest WorkstationID="POS" RequestID="57" RequestType="Login" xmlns="http://www.nrf-arts.org/IXRetail/namespace">
<POSdata LanguageCode="nl">
<POSTimeStamp>2007-03-21T14:11:14.375+01:00</POSTimeStamp>
<ShiftNumber>0</ShiftNumber>
<PrinterStatus>Available</PrinterStatus>
</POSdata>
</ServiceRequest>

thnx
May 23 '11 #1
1 1877
i found the problem, i was using the wrong endpoint.
May 25 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: louisianne | last post by:
This is robably old hat to you guys, but I am new to using Javascript, so please bear with me: I am trying to add a search box to a page and use my own button, rather than the one from the form...
2
by: Adam i Agnieszka Gasiorowski FNORD | last post by:
I'm looking for a ready made script for generating DHTML based dialogs with ability to position them, show, hide...If you happen to know keywords I should insert into Google search field or have...
14
by: Malcolm | last post by:
Hi, I have the following which fails with "disagreement in number of macro arguments" when compiling with Imagecraft ICCAVR. Has anyone got any ideas - its not vital but would make the code a...
1
by: davidw | last post by:
I encountered strange issues. I have code like this sqlReader = SqlHelper.ExecuteReader(connString, System.Data.CommandType.Text,sql); It calls Microsoft.ApplicationBlocks.Data to execute a...
1
by: Kaye | last post by:
I'd like to be able to use this message (RBN_AUTOBREAK) with my rebar control in Windows XP, and I just can't seem to get there. The application I'm working on is a .dll that is loaded by another...
2
by: AnalogKid17 | last post by:
Keywords: ASP.NET app with VS2005 running on Win2003 with IIS6, and SQL2000 on a WinXP Box I've betting the following for days... it's driving me insane: Server Error in '/' Application. ...
18
by: cov | last post by:
I have a query where I'm attempting to pull data from 3 different tables using php and mysql. I had hoped to have a unique identifier to help ensure referential integrity but it appears that...
7
by: google | last post by:
I am trying to automate the way reports are printed in an Access 2003 database - I have ~200 records (people) who require between 5 and 10 customized reports (depending on values within certain...
1
by: nuffnough | last post by:
I have defined two classes with one common field (called code) and several different fields. In class A there is only one instance of any given code as all items are individual. In class B, there...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.