473,396 Members | 1,756 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.

Web service parameters

Hi all,

I am creating a web service which takes in a bulk of training text for
each of two authors, along with a third bulk of anonymous text, and
predicts which author is most likely to have written the anonymous
text.

I have no experience with web services and I am confused about the
best way to design this - particularly with regards to the parameters
that the service is passed.

Before the service is invoked, the text is loaded through the client.
The anonymous text is simple - just a single text file. However, for
each author, there will be between 2 and 10 text documents, which
constitute the author's training work. It is important that these
documents remain as individual documents. Each document could be up to
half a MB in size.

What is the best way of getting all of this information to the web
service? Should each document be transmitted as an array of strings
perhaps? Or is there a way of sending the document as a standard text
file, unaltered?

The functionality for this is already written in a Windows forms
application I created. This existing application treats each document
as a special trainingDocument class. However, I don't think the web
service could use this, could it? Because each user wanting to consume
the service would then have to create a set of trainingDocument
objects first.

Am I correct in thinking that the best parameters for a web service
are your basic int, string etc primitive types, to ensure wide
compatability?

Any advice would be very much appreciated.

Matt
Apr 10 '06 #1
5 1447
Hello Matt,

The solution depends wether you want to keep the original files of the
authors as they were delivered. I you want to keep them this might not be
compatible with other enviroments and might raise some dificulties. If you
will not keep them you will lose the formating properties of the text.
If you can allow to lose the formating of the text, I will recomend you to
use the trainingDocument class in the webservice, and build it to a different
assembly that can be distributed to your client.
If you prefare there is an even simpler way. You can use the include
attribute to include the trainingDocument type in the webservice. This way
users can use the wsdl tool of microsoft (either manually or by using web
reference) to create the trainingDocument class and use it in the web service.
--
GuyBar
"Matt B" wrote:
Hi all,

I am creating a web service which takes in a bulk of training text for
each of two authors, along with a third bulk of anonymous text, and
predicts which author is most likely to have written the anonymous
text.

I have no experience with web services and I am confused about the
best way to design this - particularly with regards to the parameters
that the service is passed.

Before the service is invoked, the text is loaded through the client.
The anonymous text is simple - just a single text file. However, for
each author, there will be between 2 and 10 text documents, which
constitute the author's training work. It is important that these
documents remain as individual documents. Each document could be up to
half a MB in size.

What is the best way of getting all of this information to the web
service? Should each document be transmitted as an array of strings
perhaps? Or is there a way of sending the document as a standard text
file, unaltered?

The functionality for this is already written in a Windows forms
application I created. This existing application treats each document
as a special trainingDocument class. However, I don't think the web
service could use this, could it? Because each user wanting to consume
the service would then have to create a set of trainingDocument
objects first.

Am I correct in thinking that the best parameters for a web service
are your basic int, string etc primitive types, to ensure wide
compatability?

Any advice would be very much appreciated.

Matt

Apr 11 '06 #2
On Tue, 11 Apr 2006 02:01:01 -0700, guybar
<gu****@discussions.microsoft.com> wrote:
Hello Matt,

The solution depends wether you want to keep the original files of the
authors as they were delivered. I you want to keep them this might not be
compatible with other enviroments and might raise some dificulties. If you
will not keep them you will lose the formating properties of the text.
If you can allow to lose the formating of the text, I will recomend you to
use the trainingDocument class in the webservice, and build it to a different
assembly that can be distributed to your client.
If you prefare there is an even simpler way. You can use the include
attribute to include the trainingDocument type in the webservice. This way
users can use the wsdl tool of microsoft (either manually or by using web
reference) to create the trainingDocument class and use it in the web service.


Guy, thanks, that's really helpful.

Let me check I've understood this correctly - if I add the
trainingDocument class to the web service, users of the service can
use it to create trainingDocument objects that they can then pass to
the [Webmethod] doing the work. They will be able to do this by adding
a web reference within the client.

Could you give me some more information on this, please?
Say, I have the following:

[WebMethod]
public int AttributeAuthorship ( TrainingDocument [] authorA,
TrainingDocument [] authorB, TrainingDocument anonDoc )
{
// Code to attribute authorship

return authorID;
}
And I have a separate class as a TrainingDocument.cs file:
public class TrainingDocument
{
Attributes...

public TrainingDocument()
{
// Constructor code
}

further methods...
}
How do I add the TrainingDocument class to the web service so that
users can create objects from the class when creating the client?

Matt
Apr 11 '06 #3
Hi Matt,

All you need to do is add the include attribute to the webservice
decleration, as follows:

[WebMethod]
[XmlInclude(typeof(TrainingDocument))]
public int AttributeAuthorship ( TrainingDocument [] authorA,
TrainingDocument [] authorB, TrainingDocument anonDoc )
{
// Code to attribute authorship

return authorID;
}
--
GuyBar
"Matt B" wrote:
On Tue, 11 Apr 2006 02:01:01 -0700, guybar
<gu****@discussions.microsoft.com> wrote:
Hello Matt,

The solution depends wether you want to keep the original files of the
authors as they were delivered. I you want to keep them this might not be
compatible with other enviroments and might raise some dificulties. If you
will not keep them you will lose the formating properties of the text.
If you can allow to lose the formating of the text, I will recomend you to
use the trainingDocument class in the webservice, and build it to a different
assembly that can be distributed to your client.
If you prefare there is an even simpler way. You can use the include
attribute to include the trainingDocument type in the webservice. This way
users can use the wsdl tool of microsoft (either manually or by using web
reference) to create the trainingDocument class and use it in the web service.


Guy, thanks, that's really helpful.

Let me check I've understood this correctly - if I add the
trainingDocument class to the web service, users of the service can
use it to create trainingDocument objects that they can then pass to
the [Webmethod] doing the work. They will be able to do this by adding
a web reference within the client.

Could you give me some more information on this, please?
Say, I have the following:

[WebMethod]
public int AttributeAuthorship ( TrainingDocument [] authorA,
TrainingDocument [] authorB, TrainingDocument anonDoc )
{
// Code to attribute authorship

return authorID;
}
And I have a separate class as a TrainingDocument.cs file:
public class TrainingDocument
{
Attributes...

public TrainingDocument()
{
// Constructor code
}

further methods...
}
How do I add the TrainingDocument class to the web service so that
users can create objects from the class when creating the client?

Matt

Apr 11 '06 #4
Thanks, Guy. I'll give that a go.

Matt

On Tue, 11 Apr 2006 06:30:02 -0700, guybar
<gu****@discussions.microsoft.com> wrote:
Hi Matt,

All you need to do is add the include attribute to the webservice
decleration, as follows:

[WebMethod]
[XmlInclude(typeof(TrainingDocument))]
public int AttributeAuthorship ( TrainingDocument [] authorA,
TrainingDocument [] authorB, TrainingDocument anonDoc )
{
// Code to attribute authorship

return authorID;
}


Apr 11 '06 #5
> >[WebMethod]
[XmlInclude(typeof(TrainingDocument))]
public int AttributeAuthorship ( TrainingDocument [] authorA,
TrainingDocument [] authorB, TrainingDocument anonDoc )
{
// Code to attribute authorship

return authorID;
}


Have u specified how to serialize the TrainingDocument class? Does your
TrainingDocument class look similar to this?

class TrainingDocument
{
string docname;

[XmlElement(ElementName = "docname")]
public string DocName
{
get { return docname; }
set { docname = value; }
}
}

I added the XmlInclude attribute to the webservice method to which im
passing my object as a parameter. But still i get the error that says, "There
was an error generating the XML document." Drilling deeper into the
exception, i get, "The type Space.YourStar was not expected. Use the
XmlInclude or SoapInclude attribute to specify types that are not known
statically."

I'm calling a method called "getIntFromStar(YourStar star)" from a windows
application, to which im passing YourStar object as a parameter. All proper
references are added, including web reference to call the web service method.
The YourStar class looks like this.

class YourStar
{
int starNum;

[XmlElement(ElementName = "starnumber")]
public int StarNumber
{
get { return starNum; }
set { starNumber = value; }
}
}

Plz help. Thanks!
Apr 20 '06 #6

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

Similar topics

2
by: Shazad | last post by:
I am creating a windows service that requires parameters to start. The service Startup Type is set to automatic therefore it starts when the computer is started or rebooted. However the service...
5
by: vinoth | last post by:
Hi, I have created WindowsService Project.In that Project OnStart Method i have written the following Code. In this code the Server is waiting for the connection from client. When the Client...
5
by: Brian Patrick | last post by:
I have an application model which will consist of a front-end configuration application, which needs to control the state of a back-end vb.net windows service (which is the component that does all...
0
by: leslie_tighe | last post by:
Hello, I have a set of web services running on Java server that are exposed through axis 1.2.1. I can invoke these services in browser and through a java test client. However, when I try to...
4
by: leslie_tighe | last post by:
Hello, I have a webservice running on a J2EE server created with Axis 1.2.. I have a client that I am building in .net that needs to consume this webserivce and am having a bit of trouble. I have...
2
by: Tim Reynolds | last post by:
Team, We need some guidance here. We are developing a web service to expose to external system. We are not sure which is the best path to take. We have multiple input fields required and a few...
2
by: BluNuit | last post by:
I have a simple c# app that calls a Java (AXIS) web service to perform some operations. The call works fine (the java code fires and the operations are executed), but the response is always null. ...
0
by: oolon | last post by:
Hy, I have to build a report. this report has to be call by a web service. My method to call this report is : public void Amende( string dossierId ) { ReportingService...
3
by: =?Utf-8?B?UGllcnJl?= | last post by:
Hello, I have a .NET 2.0 web service that is consumed by a Delphi application. The Delphi application calls a method from the .NET web service with parameters. Theses parameters are in the...
0
by: iprogrammer | last post by:
i have a problem when i try to run my windows service ..which is "Error 1053: The service did not respond to the start or control request in a timely fashion" >after this i cannot anything with...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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
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
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.