Click here to Skip to main content
15,908,013 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: javascript: getelementbyId() cannot find my control! Please, adivice. Pin
Michael Sync26-Nov-07 19:13
Michael Sync26-Nov-07 19:13 
GeneralRe: javascript: getelementbyId() cannot find my control! Please, adivice. [modified] Pin
alexvw27-Nov-07 0:33
alexvw27-Nov-07 0:33 
QuestionProblem related to js file. Pin
soniasan26-Nov-07 0:31
soniasan26-Nov-07 0:31 
AnswerCross posting. Please ignore Pin
Vasudevan Deepak Kumar26-Nov-07 3:10
Vasudevan Deepak Kumar26-Nov-07 3:10 
QuestionBorders when embedding flash in a page Pin
Christian Graus25-Nov-07 23:26
protectorChristian Graus25-Nov-07 23:26 
AnswerRe: Borders when embedding flash in a page Pin
SABhatti26-Nov-07 5:48
SABhatti26-Nov-07 5:48 
GeneralRe: Borders when embedding flash in a page Pin
Christian Graus26-Nov-07 9:01
protectorChristian Graus26-Nov-07 9:01 
QuestionCannot serialize member CT_ToolKit.UtilityXmlBase.Properties of type System.Collections.Hashtable, because it implements IDictionary [modified] Pin
Philip Armstrong Sam25-Nov-07 19:04
Philip Armstrong Sam25-Nov-07 19:04 
Hi Friends,

I am using Framework 2.0. I am compiling a web service in runtime dynamically creating a proxy and want to invoke that method by passing a reference to the web service that is of the type XML.

I get the error "Cannot serialize member CT_ToolKit.UtilityXmlBase.Properties of type System.Collections.Hashtable, because it implements IDictionary" when I call the web service in the browser

Please provide a solution to my problem with the code how it has to be modified. The code submitted contains only some of the methods and not all with which is required.

Classes used:
-------------
public class UtilityXmlBase : IComparable
{

public virtual ToolData ToolInterface { get { return null; } }

public virtual ToolValueData ValueData
{ get
{ return new ToolValueData(ref m_element); } } // public property allows access to this as a ToolData object

protected XmlElement m_element;

// the properties tabel has been moved to the base class as any entity has the option of containgin properties.
// NB Properties are inteded to hold data that can be usefully displayed tothe user. Not data used by the internal workings of the
// toolkit. Internal data should be kept as attributes
protected Hashtable m_properties; public Hashtable Properties { get { return m_properties; } }
protected Hashtable m_matrices; public Hashtable Matrices { get { return m_matrices; } }

// universally available timestamp property
private String CreationTime { get { return GetAttribute(CT_Const.xml_Common_Att_Creation); } set { SetAttribute(CT_Const.xml_Common_Att_Creation, value); } }

///
/// Function ensure consitent creation time format
///

public void SetCreationTime()
{
CreationTime = DateTime.Now.ToString();
}
}

public class ScenarioModel : UtilityXmlBase
{

XmlElement m_scenarioElement { get { return m_element; } set { m_element = value; } } // m_scenario element is a property for internal use
public ScenarioModel()
{
}
// it gives us renamed reference to the base member m_element


// I dont like this being public but it is neccessary for the remote web service
// to be able to extract the xml.
public XmlElement ScenarioElement { get { return m_scenarioElement; } }

public String Name { get { return GetAttribute("Name"); } set { SetAttribute("Name", value); } }
public String ID { get { return GetAttribute("id"); } internal set { SetAttribute("id", value); } }
public String LastUpdate { get { return GetProperty("lastUpdate"); } protected set { SetProperty("lastUpdate", value); } }
public String LastID { get { return GetAttribute("lastId"); } internal set {SetAttribute("lastId", value);}}
public String Owner { get { return GetAttribute(CT_Const.xml_Common_Att_Owner); } set { SetAttribute(CT_Const.xml_Common_Att_Owner, value); } }



internal ScenarioModel(XmlElement element)
:base(element)
{
m_scenarioElement = element;
}

internal XmlElement Parent { get { return (XmlElement)m_scenarioElement.ParentNode; } } // the parent node of the scenario
/*
}

public class ScenarioController : ScenarioModel, IScenarioServices, IXmlSerializable
{

//ScenarioController m_ParentScenario; // parent scenario

// arrays of mods, components and Tools
Hashtable m_mods; public Hashtable Mods { get { return m_mods; } }// array of mods in scenario
Hashtable m_components; public Hashtable Components { get { return m_components; } }// hashtable of components in scenario
Hashtable m_tools; public Hashtable Tools { get { return m_tools; } } // array of tools in scenario
Hashtable m_linkages; public Hashtable Linkages { get { return m_linkages; } }


//SCP - Add comments
String m_comments; public String Comments { get { return m_comments; } set { m_comments = value.ToString(); UpdateComments(value.ToString()); } }// comments in scenario

public ScenarioController()
{

}
}

Web Service Implementation:
--------------------------
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using CT_ToolKit;
using System.Xml;
using System.Xml.Serialization;


[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{


public Service () {

//Uncomment the following line if using designed components
//InitializeComponent();
}

private void InitializeComponent()
{
throw new Exception("The method or operation is not implemented.");
}

//The object theScenario will have a reference passed in an XML format.
[WebMethod(Description = "Calculations for Motor")]
//[XmlInclude(typeof(XmlDocument[]))]
public ScenarioController Toolone(ScenarioController theScenario)
{

string t_Uv0 = "0", d_M = "0", m_cosPhi = "0", t_I2 = "0";

// for fetching the scenario details (code starts)
//ScenarioController seCtrl = (ScenarioController)theScenario;
ScenarioController seCtrl = new ScenarioController();

ComponentController[] ccs = seCtrl.GetComponents();
foreach (ComponentController cc in ccs)
{

PropertyController[] pps = cc.GetProperties();
foreach (PropertyController pp in pps)
{
if (pp.Name == "Transformer_Uv0")
{
t_Uv0 = pp.Value;
}
if (pp.Name == "Transformer_I2")
{
t_I2 = pp.Value;
}
if (pp.Name == "Drive_m")
{
d_M = pp.Value;
}
if (pp.Name == "M_Sync_AC_cosPhi")
{
m_cosPhi = pp.Value;
}
}
}

// formula calculation starts
double uv0 = Convert.ToDouble(t_Uv0);
double i2 = Convert.ToDouble(t_I2);
double cosPhi = Convert.ToDouble(m_cosPhi);
double drive_M = Convert.ToDouble(d_M);

// INTERMEDIATE CALCULATION (DC)
double udc = uv0 * 3 * (1.414 / 3.14);
double idc = i2 * 3.14 / 2.449;

// OUTPUT CALCULATION (AC)
double m_Sync_U = udc * (drive_M / 1.414);
double m_Sync_I = (udc * idc) / (m_Sync_U * cosPhi);

decimal m_Sync_U1 = decimal.Round(Convert.ToDecimal(m_Sync_U), 2);
decimal m_Sync_I1 = decimal.Round(Convert.ToDecimal(m_Sync_I), 2);
// formula ends


// FOR UPDATING THE PROPERTY IN THE GRID VIEW
foreach (ComponentController cc1 in ccs)
{
PropertyController[] pps1 = cc1.GetProperties();
foreach (PropertyController pp1 in pps1)
{
if (pp1.Name == "M_Sync_AC_U")
{
pp1.SetValue(m_Sync_U1.ToString());

}
if (pp1.Name == "M_Sync_AC_I")
{
pp1.SetValue(m_Sync_I1.ToString());

}
}
}
//return (theScenario);
return (seCtrl);


}

// for fetching the scenario details (code ends)

}

Client Code to invoke the Web Service:
-------------------------------------
object wsvcClass = results.CompiledAssembly.CreateInstance(serviceName);

MethodInfo mi1 = wsvcClass.GetType().GetMethod(methodName);
object Result = null;
try
{
Result = mi1.Invoke(wsvcClass, args);

}










Armstrong


-- modified at 6:17 Tuesday 27th November, 2007
QuestionUsing JSP Pin
gReaen25-Nov-07 18:14
gReaen25-Nov-07 18:14 
AnswerRe: Using JSP Pin
Christian Graus25-Nov-07 19:03
protectorChristian Graus25-Nov-07 19:03 
AnswerRe: Using JSP Pin
Vasudevan Deepak Kumar26-Nov-07 3:13
Vasudevan Deepak Kumar26-Nov-07 3:13 
QuestionHow to find Reciprocal URL Pin
swguy2325-Nov-07 17:30
swguy2325-Nov-07 17:30 
AnswerRe: How to find Reciprocal URL Pin
Paul Conrad25-Nov-07 18:19
professionalPaul Conrad25-Nov-07 18:19 
AnswerRe: How to find Reciprocal URL Pin
Michael Sync25-Nov-07 18:56
Michael Sync25-Nov-07 18:56 
QuestionHelp with database Pin
gReaen25-Nov-07 5:55
gReaen25-Nov-07 5:55 
AnswerRe: Help with database Pin
Paul Conrad25-Nov-07 9:42
professionalPaul Conrad25-Nov-07 9:42 
QuestionRe: Help with database Pin
gReaen25-Nov-07 18:13
gReaen25-Nov-07 18:13 
AnswerRe: Help with database Pin
Vasudevan Deepak Kumar25-Nov-07 22:04
Vasudevan Deepak Kumar25-Nov-07 22:04 
QuestionHow to retrieve a image from a database and display along with other components Pin
faesel25-Nov-07 2:43
faesel25-Nov-07 2:43 
AnswerRe: How to retrieve a image from a database and display along with other components Pin
Christian Graus25-Nov-07 8:35
protectorChristian Graus25-Nov-07 8:35 
GeneralRe: How to retrieve a image from a database and display along with other components [modified] Pin
faesel26-Nov-07 6:33
faesel26-Nov-07 6:33 
AnswerRe: How to retrieve a image from a database and display along with other components Pin
faesel28-Nov-07 5:00
faesel28-Nov-07 5:00 
QuestionSQL Server Connection pooling in classic ASP? Pin
joker79724-Nov-07 7:00
joker79724-Nov-07 7:00 
QuestionHelp me in this script Pin
Menhal24-Nov-07 2:03
Menhal24-Nov-07 2:03 
AnswerRe: Help me in this script Pin
Shog924-Nov-07 7:47
sitebuilderShog924-Nov-07 7:47 

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.