473,413 Members | 1,737 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,413 software developers and data experts.

Error: The type namespace.class was not expected. Use the XmlIncludeor SoapInclude attribute....

Hi,

I'm developing a webservice that will accept an Order and forward it to
a backend system, but I'm having a problem with transferring my "Order"
class over a webservice.

When I try and call the webservice and pass it an Order, I get the
following error message:

The type Wright.BusinessLogicLayer.OrderLine was not expected. Use the
XmlInclude or SoapInclude attribute to specify types that are not known
statically.

Source Error:

Line 55: public string EchoOrder(Order order) {
Line 56: object[] results = this.Invoke("EchoOrder", new
object[] {
Line 57: order});
Line 58: return ((string)(results[0]));

My Order class contains a single property, which is just an ArrayList of
OrderLines.

I've tried adding the SoapAttribute but it seems to have no effect:

[WebMethod]
[SoapInclude(typeof(OrderLine))]
public string EchoOrder(Order order) {
return order.ToString();
}

Any ideas what am I doing wrong?

Thanks!

Nick...
Nov 23 '05 #1
3 3808
The odd thing is, if I change my class so that it has a single OrderLine
object instead of an arraylist of them:

public OrderLine Item {
get { return item; }
set { item = value; }
}

as opposed to:

public ArrayList OrderItems {
get { return orderItems; }
set { orderItems = value; }
}

Then it works fine. So it's obviously having trouble serializing the
ArrayList of OrderItems.

I don't know how to fix this and I can't proceed with my project until
I've got this working! Needless to say - I'm getting very stressed and
worried!

Nick...
Nov 23 '05 #2
Change the property to:

public OrderLine[] OrderItems
{
...
}
Regards,
Sami

"Nick Gilbert" <ne**@nickgilbert.com> wrote in message
news:Of**************@TK2MSFTNGP15.phx.gbl...
The odd thing is, if I change my class so that it has a single OrderLine
object instead of an arraylist of them:

public OrderLine Item {
get { return item; }
set { item = value; }
}

as opposed to:

public ArrayList OrderItems {
get { return orderItems; }
set { orderItems = value; }
}

Then it works fine. So it's obviously having trouble serializing the
ArrayList of OrderItems.

I don't know how to fix this and I can't proceed with my project until
I've got this working! Needless to say - I'm getting very stressed and
worried!

Nick...

Nov 23 '05 #3
Change the property to:

public OrderLine[] OrderItems
{
...
}
Regards,
Sami

"Nick Gilbert" <ne**@nickgilbert.com> wrote in message
news:Of**************@TK2MSFTNGP15.phx.gbl...
The odd thing is, if I change my class so that it has a single OrderLine
object instead of an arraylist of them:

public OrderLine Item {
get { return item; }
set { item = value; }
}

as opposed to:

public ArrayList OrderItems {
get { return orderItems; }
set { orderItems = value; }
}

Then it works fine. So it's obviously having trouble serializing the
ArrayList of OrderItems.

I don't know how to fix this and I can't proceed with my project until
I've got this working! Needless to say - I'm getting very stressed and
worried!

Nick...

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Enos Meroka | last post by:
Hallo, I am a student doing my project in the university.. I have been trying to compile the program using HP -UX aCC compiler, however I keep on getting the following errors. ...
0
by: Benne Smith | last post by:
I get this error when i test my webservice; System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type RMAWS.Symptom was...
1
by: Bob Rock | last post by:
Hello, I have a web method that serializes a class that includes among its public fields a System.Object field to which, at runtime, I assign instances of various different classes. When...
1
by: Nick Gilbert | last post by:
Hi, I'm developing a webservice that will accept an Order and forward it to a backend system, but I'm having a problem with transferring my "Order" class over a webservice. When I try and...
0
by: Steven | last post by:
I'm having trouble using an arraylist of a custom object as an argument in a webservice, everything is in VB.Net. Visual Studio I can pass the custom object as an argument to other webmethods...
0
by: mchuc7719 | last post by:
Hello, I have a Vb.Net 2005 ClassLibrary, when I try to compile using MSBee, only get errors. Before I to run the command line, I open in notepad the .vbproj and I was add the next line: ...
5
by: igotyourdotnet | last post by:
I'm creating a web service this is going to return an arraylist of items. When I try and run it Im' getting the following error message: System.InvalidOperationException: There was an error...
0
by: RobertK | last post by:
I wrote a webservices that should accept an exception object and log info to a db. When I call the function in my webservices class I get an error: The type System.DivideByZeroException was not...
7
by: Paul Hadfield | last post by:
Hi, I'm running into one problem with trying to call "Type.GetCustomAttributes(...)" on my reflected code. Basically - I can't trap my own custom attribute - I can only catch / identify system...
3
by: Rotsey | last post by:
Hi, I am trying to send a object to a webservice and I get an serialisation error on the object saying "object not expected" add "XmlInclude or SoapInclude attribute" I have done this but...
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.