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

I'm going crazy with web services - PLEASE HELP!!

I've been days with that. I'm trying to work with web services sending and
returning objects, and the web service must store some objects.
- My first try (the most obvious in my opinion) was to use a class contained
in a extern dll so the web service and the application can use it and send
or return via web services: public customObject myWebMethod(customObject
obj); . I saw that web services can't deal with this cause the WS creates
another class with the same name, but it's not possible to cast from one to
another.

- Now I try to pass simple fields (strings for instance) and create the
objects in the web service and in the application. In the web service I have
a Hashtable where I want the objects to be stored. Is it possible? because I
get exceptions and I don't know why. The exception text is (it's translated
as my VS isn't in english):
------------------
'System.Web.Services.Protocols.SoapException' occurred in
system.web.services.dll

Additional information: System.Web.Services.Protocols.SoapException: The
server didn't recognize the value in the header HTTP SOAPAction:
http://tempuri.org/setUser.
at
System.Web.Services.Protocols.Soap11ServerProtocol Helper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.I nitialize()
at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)
---------------------

I have a basic test that doesn't work, but I put you here the code so you
can see if it's something wrong.

-------- The DLL has this simple class:

public class User
{
private string name;
private string phone;

public string Name
{
set { name = Name;}
get { return name;}
}
// the same with Phone

public User() {}
public User(string n, string p)
{
name = n;
phone = p;
}
}

---------- The Web Service has this:

public class Service1:System.Web.Services.WebService
{
private System.Collections.Hashtable users; //here I want to store
the objects

public Service1()
{
InitializaComponent();
users = new Hashtable();
}

// then the region generated by VS
// and here the web mehtods

[WebMethod]
public void setUser(string n, string p)
{
User u = new User(n,p);
users.Add(n,u); //add the new user to the HastTable with the name
as key
}

[WebMethod]
public string getPhone(string name)
{
User u = (User)users[name]; //get the object with the key
'name'
return u.Phone;
}

}

--------- And finally the application, that is a simple form that has a
couple of textboxes to insert name and phone, a listbox to show the results
and a couple of buttons to call the web methods. I put the important code

public class Form1: System.Windows.Forms.Form
{
// the visual components
private webServ.Service1 serv; //the web service
private User user; //a custom object from my class.
[...]

public Form1()
{
InitializeComponent();
serv = new webServ.Service1(); // call the web service
constructor
}
[...]

private void button1_Click(...)
{
// call the webmethod sendint the fields so the object is created in
the web service
serv.setUser(textBox1.Text, textBox2.Text);
}

private void button2_Click(...)
{
// call the second webmethod to get the Phone associated to the name
showed in the textBox
string phone = serv.getPhone(this.textBox1.Text);
User u = new User(textBox1.Text, phone); //create an object

//finally show the data in the listbox[...]
}
}

When the application crashes, it shows in the Reference.cs that:

public void setUser(string name, string phone){
this.Invoke("setUser", new object[] { name, phone});

-------------------------------
Please, I really need your help!

Regards,

Diego F.

Nov 16 '05 #1
0 2121

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

Similar topics

1
by: Richard | last post by:
I need help. I have a smarty based program that I am modifying. I have a smarty template file that consists of smarty and HTML. I need to integrate some PHP database calls into it. My problem...
5
by: spoilsport | last post by:
Ive got to write a multi-function program and I'm plugging in the functions but I keep getting this error from line 40. Im new to this and cant find an answer anywhere. Sam #include...
0
by: Diego F. | last post by:
I've been days with that. I'm trying to work with web services sending and returning objects, and the web service must store some objects. - My first try (the most obvious in my opinion) was to use...
3
by: Navin | last post by:
Hello friends... On a single asp.net web page i have a single server-side form that contains a couple of user-controls. Each user control has its own functionality and contains server-side textbox...
3
by: Larry Tate | last post by:
I have had a monstrous time getting any good debugging info out of the .net platform. Using ... ..NET Framework 1.1 Windows 2K Server VB.NET <- is this the problem? error handling in the...
7
by: Miguel Dias Moura | last post by:
Hello, In an ASP.Net / VB web page I want to display an image which filename depends of a parameter on the URL. I have this:
11
by: shapper | last post by:
Hello, I am creating a centered web site with various div's inside the main (pBase) div. Somehow, I am getting a gap on the top of my browser window both in IE and Firefox. I tried...
2
by: BLUE | last post by:
FirstClass members: - static int counter; - SingletonClass sc = SingletonClass.Instance; Moreovere FirstClass uses a static class named SecondClass with a static property...
1
by: shapper | last post by:
Hello, On my CMS I am signed as administrator and I am creating a Membership user and its profile: MembershipCreateStatus status; MembershipUser user = Membership.CreateUser("Joe", "Pass",...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.