Hey. I have a function with a boolean return value, called IsInWarehouse,
which checks if a product is available in a warehouse, or not. But I need
security in the function too, so I have
[WebMethod][SoapHeader("soa pHeader")]
public bool IsInWarehouse(s tring productName) {
if (Login(username , password)) {
// query db about available product
} else {
// ???
}
}
If the product is in stock, it returns true, or else it returns false.
But the caller of the web service needs to know if the login succeeded or
failed. (Because it's custom authentication in a web service, authentication
has to be done inside every procedure that needs it) What do I do with the
type of the return value? bool gives you 2 return values, I need 3.
Thanks for any help
Justin Dutoit 2 5356
raise a SOAP Exception when the login fails.
--- Nick
"Justin Dutoit" <an**@anon.co m> wrote in message
news:eY******** *****@TK2MSFTNG P10.phx.gbl... Hey. I have a function with a boolean return value, called IsInWarehouse, which checks if a product is available in a warehouse, or not. But I need security in the function too, so I have [WebMethod][SoapHeader("soa pHeader")] public bool IsInWarehouse(s tring productName) { if (Login(username , password)) {
// query db about available product
} else { // ??? } }
If the product is in stock, it returns true, or else it returns false. But the caller of the web service needs to know if the login succeeded or failed. (Because it's custom authentication in a web service,
authentication has to be done inside every procedure that needs it) What do I do with the type of the return value? bool gives you 2 return values, I need 3.
Thanks for any help Justin Dutoit
"Justin Dutoit" <an**@anon.co m> wrote: [returning a boolean but wanting a tri-state]
In general, you can either create an enum for each possible state, and
return one of its members:
public enum QueryResult
{
InWarehouse, NotInWarehouse, QueryFailed
}
.... or use an 'out' parameter, to return more than one value:
public bool IsInWarehouse(s tring productName, out bool queryFailed)
{
queryFailed = false; // but set to 'true' on failure
...
return productFound; // separate true or false
}
P. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Alin Popovici |
last post by:
Hi!
I have this problem. I am sending as a parameter for a
webmethod a string containing '\r\n' sequences. For some
reason, when I debug my webmethod, the paramter is
received with the carriage return characters ('\r')
stripped. Can someone try this by creating a simple
webmethod that takes a string as a parameter and returns
the same string back. On the client, create a proxy, call
the webmethod and pass: "bla\r\nbla". If you put a...
|
by: Bruce W.1 |
last post by:
The intent of my web service is an RSS feed from a blog. Originally I
used a StringBuilder to make the XML and returned a string from the
webmethod. But this doesn't display properly in IE. So now I'm trying
an XmlTextWriter instead.
I whipped-up another webservice based on this:
http://www.codeproject.com/aspnet/RSSviaXmlTextWriter.asp?print=true
This example isn't set up strictly as a webservice. It seems to output
to an aspx...
|
by: Alin Popovici |
last post by:
Hi!
I have this problem. I am sending as a parameter for a
webmethod a string containing '\r\n' sequences. For some
reason, when I debug my webmethod, the paramter is
received with the carriage return characters ('\r')
stripped. Can someone try this by creating a simple
webmethod that takes a string as a parameter and returns
the same string back. On the client, create a proxy, call
the webmethod and pass: "bla\r\nbla". If you put a...
|
by: Jose Fernandez |
last post by:
Hello.
I'm building a web service and I get this error.
NEWS.News.CoverNews(string)': not all code paths return a value
This is the WebMethod
public SqlDataReader CoverNews(string Sport)
{
|
by: Henke |
last post by:
Hi
I have a webservice that should return a result object, like this:
public class Result
{
private object data;
private int status;
public object Data
{
get{return data;}
| |
by: Thomas D. |
last post by:
Hello all,
I'm using the IXmlSerializable interface for a project and encounter some
problems when testing my webservice in a client application. I know this
interface is undocumented and not intended for use, but I think this is the
only solution for my situation. I searched the web, in the hope finding the
answer, without any luck, so my final hope is with you.
Let me explain the situation:
I have an 'export'-wrapper to my regular...
|
by: MSDNAndi |
last post by:
Hi,
I have a set of simple webservices calls that worked fine using .NET
Framework 1.0.
I am calling a Java/Apache based webservices, the calling side is not able
to supply a proper WSDL.
What it does is to call a webservice with two parameters, one being a
integer, the other one being a "String" which contains XML (not the best
practice, however that is the target interface and we cannot change that).
|
by: louis_la_brocante |
last post by:
Dear all,
I am having trouble generating a client proxy for a webservice whose
methods return a "complex" type. The type is complex in that it is a
class whose members are a mix of primitive types and of more elaborate
classes implementing IXmlSerializable. The resulting WSDL file for the
webservice has two separate schemas in its <types> sections, and the
client proxy (generated with wsdl.exe) is missing the definitions of
the...
|
by: Jonathan |
last post by:
I have a SQL stored procedure for adding a new record in a transactions
table. It also has two return values: CounterID and IDKey.
I want to create a webservice that accepts the 10 input parameters and
returns the two return values.
My C# programmer here says that webservice methods can only return 1 value
per method. Is that right? Though I haven't ever created a webservice, I
would have thought that a method could return a whole lot...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |