Click here to Skip to main content
15,889,879 members
Home / Discussions / C#
   

C#

 
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
QuestionRandom Pin
MasterSharp2-Oct-07 14:21
MasterSharp2-Oct-07 14:21 
AnswerRe: Random Pin
Peter Vertes2-Oct-07 14:34
Peter Vertes2-Oct-07 14:34 
AnswerRe: Random Pin
PIEBALDconsult2-Oct-07 14:35
mvePIEBALDconsult2-Oct-07 14:35 
GeneralRe: Random Pin
MasterSharp2-Oct-07 14:38
MasterSharp2-Oct-07 14:38 
AnswerRe: Random Pin
Christian Graus2-Oct-07 14:54
protectorChristian Graus2-Oct-07 14:54 
GeneralRe: Random Pin
MasterSharp2-Oct-07 15:03
MasterSharp2-Oct-07 15:03 
GeneralRe: Random Pin
PIEBALDconsult2-Oct-07 16:24
mvePIEBALDconsult2-Oct-07 16:24 
GeneralRe: Random Pin
Paul Conrad2-Oct-07 16:40
professionalPaul Conrad2-Oct-07 16:40 
GeneralRe: Random Pin
Christian Graus2-Oct-07 17:10
protectorChristian Graus2-Oct-07 17:10 
GeneralRe: Random Pin
Peter Vertes2-Oct-07 18:17
Peter Vertes2-Oct-07 18:17 
GeneralRe: Random Pin
TJoe2-Oct-07 20:51
TJoe2-Oct-07 20:51 
QuestionVB6 ActiveX to push data to a C# Program [modified] Pin
TimNaber2-Oct-07 13:35
TimNaber2-Oct-07 13:35 
AnswerRe: VB6 ActiveX to push data to a C# Program Pin
Parwej Ahamad2-Oct-07 17:55
professionalParwej Ahamad2-Oct-07 17:55 
Questionint? Pin
seemamltn2-Oct-07 13:08
seemamltn2-Oct-07 13:08 
AnswerRe: int? Pin
Judah Gabriel Himango2-Oct-07 13:11
sponsorJudah Gabriel Himango2-Oct-07 13:11 
AnswerRe: int? Pin
Christian Graus2-Oct-07 13:11
protectorChristian Graus2-Oct-07 13:11 
QuestionHelp: NHibernate and SysCache2 [modified] Pin
emiaj2-Oct-07 12:27
emiaj2-Oct-07 12:27 

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.