Click here to Skip to main content
15,903,203 members
Home / Discussions / C#
   

C#

 
GeneralRe: Image Open [modified] Pin
Xmen Real 2-Oct-07 20:39
professional Xmen Real 2-Oct-07 20:39 
GeneralRe: Image Open Pin
Andrei Ungureanu3-Oct-07 0:07
Andrei Ungureanu3-Oct-07 0:07 
QuestionSend message through my application Pin
amolpate2-Oct-07 20:00
professionalamolpate2-Oct-07 20:00 
AnswerRe: Send message through my application Pin
Christian Graus2-Oct-07 20:16
protectorChristian Graus2-Oct-07 20:16 
QuestionProblem binding a dataset in SQL Reporting Services Pin
Bonny Babu2-Oct-07 19:38
Bonny Babu2-Oct-07 19:38 
QuestionGeneric Methods [modified] Pin
N a v a n e e t h2-Oct-07 19:22
N a v a n e e t h2-Oct-07 19:22 
QuestionRe: Generic Methods Pin
TJoe2-Oct-07 19:55
TJoe2-Oct-07 19:55 
AnswerRe: Generic Methods Pin
N a v a n e e t h2-Oct-07 20:12
N a v a n e e t h2-Oct-07 20:12 
GeneralRe: Generic Methods [modified] Pin
TJoe2-Oct-07 20:23
TJoe2-Oct-07 20:23 
GeneralRe: Generic Methods Pin
N a v a n e e t h2-Oct-07 20:34
N a v a n e e t h2-Oct-07 20:34 
GeneralRe: Generic Methods Pin
TJoe2-Oct-07 20:41
TJoe2-Oct-07 20:41 
Questionhow to recieve sms in c#.net Pin
shabi uz zaman2-Oct-07 19:13
shabi uz zaman2-Oct-07 19:13 
AnswerRe: how to recieve sms in c#.net Pin
Christian Graus2-Oct-07 19:44
protectorChristian Graus2-Oct-07 19:44 
GeneralRe: how to recieve sms in c#.net Pin
shabi uz zaman2-Oct-07 21:22
shabi uz zaman2-Oct-07 21:22 
GeneralRe: how to recieve sms in c#.net Pin
ESTAN2-Oct-07 22:30
ESTAN2-Oct-07 22:30 
QuestionHow to reload data from data base to Webpage After some seconds ?. Pin
quangnd28022-Oct-07 18:02
quangnd28022-Oct-07 18:02 
AnswerRe: How to reload data from data base to Webpage After some seconds ?. Pin
Peter Vertes2-Oct-07 18:14
Peter Vertes2-Oct-07 18:14 
GeneralRe: How to reload data from data base to Webpage After some seconds ?. Pin
quangnd28023-Oct-07 18:25
quangnd28023-Oct-07 18:25 
AnswerRe: How to reload data from data base to Webpage After some seconds ?. Pin
Parwej Ahamad2-Oct-07 18:17
professionalParwej Ahamad2-Oct-07 18:17 
GeneralRe: How to reload data from data base to Webpage After some seconds ?. Pin
quangnd28023-Oct-07 18:25
quangnd28023-Oct-07 18:25 
QuestionWhy Round like this? Pin
rbuchana2-Oct-07 15:24
rbuchana2-Oct-07 15:24 
AnswerRe: Why Round like this? Pin
Peter Vertes2-Oct-07 15:36
Peter Vertes2-Oct-07 15:36 
AnswerRe: Why Round like this? Pin
Peter Vertes2-Oct-07 15:37
Peter Vertes2-Oct-07 15:37 
AnswerRe: Why Round like this? Pin
TJoe2-Oct-07 15:38
TJoe2-Oct-07 15:38 
QuestionProblem on web services Pin
mvpsolution2-Oct-07 14:32
mvpsolution2-Oct-07 14:32 
Hello:

I have here a problem where I am using web services.

From this example you can see that webservices is very tolerant of extra fields or missing fields. One issue though is that if you run one of the webservices and then update the other project's web reference it generates partial class code for your remote object in the namespace of the webservice. This is a problem.

For instance:

If you run the solution Version1 and then open the solution

Version2 and update the Web Reference in the project (you have to show hidden files) you get a file called Reference.cs.

In Reference.cs the system generates a wrapper for the class Foo

/// <remarks>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml","2.0.50727.1378")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]

public partial class Foo {...}

The problem is that when it does this it will return this object as when you call HelloWorld.

static void Main(string[] args)
{
ConsoleApplication1.localhost.Service1 s1 = new Service1();
MyLibrary.Foo f1 = new MyLibrary.Foo();
f1.Prop1 = "New";
MyLibrary.Foo f2 = (MyLibrary.Foo)s1.HelloWorld( f1);
System.Console.WriteLine("F1.Prop1=" + f2.Prop1);
}

Which is not what you want. The intended object is MyLibrary.Foo not ConsoleApplication1.localhost.Foo. Please figure out how prevent VS from creating the wrapper or any other solution.

Below are the project codes:
"Version1" Solution:
Webservices:
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Xml;
using System.Xml.Serialization;

using MyLibrary.Lib;

namespace Version1
{
///
/// Summary description for Service1
///

[WebService(Namespace = "http://localhost/")]
[ToolboxItem(false)]
public class Service1 : System.Web.Services.WebService
{
[WebMethod(EnableSession = true)]
[XmlInclude(typeof(Foo))]
public MyLibrary.Lib.FooHelloWorld(MyLibrary.Lib.Foo foo1)
{
foo1 = "Updated";
return foo1;
}
}
}

"MyLibrary.cs"

using System;
using System.Data;
using System.Configuration;
using System.Xml;
using System.Xml.Serialization;

namespace MyLibrary
{
public class Foo
{
private string m_prop1 = null;
public string Prop1
{
get { return m_prop1; }
set { m_prop1 = value; }
}

private string m_prop2 = null;
public string Prop2
{
get { return m_prop2; }
set { m_prop2 = value; }
}

public Foo()
{
m_prop1 = "abc";
m_prop2 = "cde";
}
}
}

Console application: "Program.cs"
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;

using MyLibrary.Lib;
namespace ConsoleApplication1
{
static void Main(string[] args)
{
ConsoleApplication1.localhost.Service1 s1 = new Service1();
MyLibrary.Foo f1 = new MyLibrary.Foo();
f1.Prop1 = "New";
MyLibrary.Foo f2 = (MyLibrary.Foo)s1.HelloWorld( f1);
System.Console.WriteLine("F1.Prop1=" + f2.Prop1);
}
}

*** NOte *** localhost is the name of the web services when i add reference.
If you can provide solution in this Version1 solution it will work also on Version2 solution.

Hope anyone can save me from hell... Thanks

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.