472,805 Members | 1,151 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 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 2070

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
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.