ASMX Web Services and XML Serialization ForumDiscussion on writing ASMX Web Services using the .NET Framework and on using the XML Serialization technology.© 2009 Microsoft Corporation. All rights reserved.Mon, 23 Nov 2009 12:50:34 Z7b956220-a7d7-4a66-b66a-4789d0753c8bhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/2eb4e1e2-c0f4-4618-b1de-9b06b7a1db84http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/2eb4e1e2-c0f4-4618-b1de-9b06b7a1db84xpdinghttp://social.msdn.microsoft.com/Profile/en-US/?user=xpdingWeb service constructor<p><font style="BACKGROUND-COLOR: #fffbf0">I defined a class (MyWebService)&nbsp;that inherits <font size="2">System.Web.Services.WebService class. I would like to pass a username and password when initialize the web service so the user that try to access the web service can be authenticated against the database. However, when I try to use the web service in the client project, it seems I can only use the default non-parameters constructor.<br /><br />Is it impossible to to initialize a web service using the non-default constructor?<br /><br />Cheers<br /></font><font color="#008080" size="2"></p></font></font>Mon, 14 Nov 2005 17:33:07 Z2009-11-23T12:50:33Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/b5bc2967-b97c-4156-aceb-3500fd463249http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/b5bc2967-b97c-4156-aceb-3500fd463249Beneventihttp://social.msdn.microsoft.com/Profile/en-US/?user=BeneventiJSON Serialization instead of XML SerializationHello, I need to write a simple Web Service that returns data with JSON Serialization instead of XML (SOAP).<br/><br/>Can anyone post a sample solution to achieve this goal?<br/><br/>Best regards<br/><br/>AlessandroThu, 19 Nov 2009 14:19:54 Z2009-11-20T00:33:23Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/65224159-b7bf-44dc-937b-94fe2440ba70http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/65224159-b7bf-44dc-937b-94fe2440ba70John Saundershttp://social.msdn.microsoft.com/Profile/en-US/?user=John%20SaundersWSE is Obsolete - Use Only If NecessaryTo my fellow Web Service Developers:<br/><br/>I have repeatedly encountered developers who learn about WSE (Web Service Enhancements) through Google or some other search engine. In many cases, they were not searching for WSE, but instead were searching for &quot;web service security&quot; or &quot;web service outside of IIS&quot;. Because the search turned up a WSE article, some of these developers are starting off with WSE when they don't need to.<br/><br/>I want to make clear what I so frequently have to repeat: WSE is obsolete. It has been replaced by WCF (Windows Communication Framework). WSE is not supported by Visual Studio 2008 or above. This should give you an idea about how Microsoft thinks about WSE. If your project is at all important, and if you expect it to last more than a few months, then you will not be doing yourself any favors by depending on this obsolete software.<br/><br/>WCF is supported by .NET 3.0 and above, though your best option would be .NET 3.5 SP1. Some organizations will not upgrade to .NET 3.5 because they are concerned about the impact on their existing .NET 2.0 applications. There is little need for concern: .NET 3.5 SP1 consists of .NET 2.0 SP2 and some additional assemblies that are not used by your existing .NET 2.0 applications. It will also not change your IIS script mappings the same way the upgrading from .NET 1.1 to .NET 2.0 did.<br/><br/>Obviously, if you are working on an existing WSE application, then you should upgrade to WSE when you get a chance, but should continue to maintain your application until you upgrade. A small number of you will have no choice but to use WSE for new applications; perhaps you must still support Windows 2000. If you have no choice but to use WSE, then feel free to post your WSE questions in this forum. I have found that WSE questions are answered more quickly if you put &quot;WSE&quot; into the subject of the question.<br/><br/>Good Luck to All,<br/>John Saunders<br/><br/>Microsoft MVP, Connected Systems<br/>(See <a href="https://mvp.support.microsoft.com/profile/john.saunders/">https://mvp.support.microsoft.com/profile/john.saunders/</a>)<br/><hr class="sig">John Saunders<br/> Use File-&gt;New Project to create Web Service Projects<br/> Use WCF for All New Web Service Development, instead of old ASMX or obsolete WSETue, 02 Jun 2009 00:20:25 Z2009-11-19T21:17:53Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/7f4ccb60-b096-470e-9273-1525d03c4543http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/7f4ccb60-b096-470e-9273-1525d03c4543iceman_82http://social.msdn.microsoft.com/Profile/en-US/?user=iceman_82Create web services interfaceHi, <div>I'm working on project of integration and I have to generate web services interface everytime that the web services exposed are updated. This request is made to create mock of this web services.</div> <div>Now I'm using the wsdl command to create this web services interface, but I have to operate manually for each web services everytime that the exposed web sevices are updated. Does exist any tool to made this operation as automatic batch process?</div> <div>Sorry for bad english.</div> <div>Thank you very much in advance.</div> <div>bye</div>Mon, 09 Nov 2009 11:33:49 Z2009-11-19T18:26:49Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/94bc68cb-e166-4974-9e9a-1b775c5a0253http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/94bc68cb-e166-4974-9e9a-1b775c5a0253klerik123456http://social.msdn.microsoft.com/Profile/en-US/?user=klerik123456XML custom serialization in asmx web service<p>Hi, I try used custom XML serialization on my own class with IXmlSerializable, and also use xml scheme.<br/></p> <pre lang="x-c#">public class Service : System.Web.Services.WebService { [XmlSchemaProvider(&quot;GetSchemaDocument&quot;)] public class EmployeeDetails3 : IXmlSerializable { public int employeeID; public string firstName; public string lastName; private string phoneNumber; const string ns = &quot;&quot;; public static XmlQualifiedName GetSchemaDocument(XmlSchemaSet xs) { string schemaPath = &quot;E:\\Project\\CustomSerializationInASPNET.WebService\\App_Data\\EmployeeDetails3.xsd&quot;; XmlSerializer schemaSerializer = new XmlSerializer(typeof(XmlSchema)); XmlSchema s = (XmlSchema)schemaSerializer.Deserialize(new XmlTextReader(schemaPath), null); xs.XmlResolver = new XmlUrlResolver(); xs.Add(s); return new XmlQualifiedName(&quot;EmployeeDetails3&quot;, ns); } void IXmlSerializable.WriteXml(XmlWriter w) { w.WriteStartElement(&quot;Employee&quot;, ns); w.WriteStartElement(&quot;Name&quot;, ns); w.WriteElementString(&quot;First&quot;, ns, firstName); w.WriteElementString(&quot;Last&quot;, ns, lastName); w.WriteEndElement(); w.WriteElementString(&quot;ID&quot;, ns, employeeID.ToString()); w.WriteElementString(&quot;Phone&quot;, ns, phoneNumber.ToString()); w.WriteEndElement(); } System.Xml.Schema.XmlSchema IXmlSerializable.GetSchema() { return null; } public EmployeeDetails3() { } public EmployeeDetails3(int employeeID, string firstName, string lastName, string phoneNumber) { this.employeeID = employeeID; this.firstName = firstName; this.lastName = lastName; this.phoneNumber = phoneNumber; } } [WebMethod] public EmployeeDetails3[] GetEmployee3() { EmployeeDetails3[] employeeObj = new EmployeeDetails3[3]; employeeObj[0] = new EmployeeDetails3(1, &quot;X&quot;, &quot;X&quot;, &quot;X&quot;); employeeObj[1] = new EmployeeDetails3(2, &quot;Y&quot;, &quot;Y&quot;, &quot;Y&quot;); employeeObj[2] = new EmployeeDetails3(3, &quot;Z&quot;, &quot;Z&quot;, &quot;Z&quot;); return employeeObj; } }</pre> <span style="font-family:Courier New">Xml scheme for my own object is :<br/><br/> <pre lang=x-xml>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;xs:schema elementFormDefault=&quot;qualified&quot; xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt; &lt;xs:element name=&quot;EmployeeDetails3&quot; nillable=&quot;true&quot; type=&quot;EmployeeDetails3&quot; /&gt; &lt;xs:complexType name=&quot;EmployeeDetails3&quot;&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot; name=&quot;First&quot; type=&quot;xs:string&quot; /&gt; &lt;xs:element minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot; name=&quot;Last&quot; type=&quot;xs:string&quot; /&gt; &lt;xs:element minOccurs=&quot;1&quot; maxOccurs=&quot;1&quot; name=&quot;ID&quot; type=&quot;xs:int&quot; /&gt; &lt;xs:element minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot; name=&quot;Phone&quot; type=&quot;xs:string&quot; /&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt;</pre> <p><strong>I think the xml scheme is wrong, I am beginner. What is wrong with my xml scheme ?</strong></p> <p>If I try compile my project and test on asp.net development server it finish with this warnning:</p> <p>T*his web service does not conform to WS-I Basic Profile v1.1.</p> <p>Please examine each of the normative statement violations below. Follow the recommendations to remedy it, or add setting to the config section to turn off BP 1.1 conformance warnings for the entire vroot.</p> <p>To turn off BP 1.1 conformance warnings for the entire vroot remove the 'BP1.1' value from the section of the configuration file of your application:</p> <p><br/>R2105: All xsd:schema elements contained in a wsdl:types element of a DESCRIPTION MUST have a targetNamespace attribute with a valid and non-null value, UNLESS the xsd:schema element has xsd:import and/or xsd:annotation as its only child element(s). - schema from service description with targetNamespace='http://tempuri.org/'.</p> <font face="Courier New"> <p>Recommendation: Please examine your schema definitions and add explicit targetNamespace attribute. Requiring a targetNamespace on all xsd:schema elements that are children of wsdl:types is a good practice, places a minimal burden on authors of WSDL documents, and avoids the cases that are not as clearly defined as they might be.*</p> </font></span> <p> </p>Tue, 10 Nov 2009 12:46:52 Z2009-11-19T18:25:26Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/d6223dc7-2bc1-44c6-b2ec-74ed958b3311http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/d6223dc7-2bc1-44c6-b2ec-74ed958b3311ryguy72http://social.msdn.microsoft.com/Profile/en-US/?user=ryguy72Newbie, trying to add Google Maps to my site<br/> <p class=MsoNormal>I downloaded the sample code from here:</p> <p class=MsoNormal><a href="http://blog.evonet.com.au/post/Integrating-Google-Maps-into-an-ASPNET-page.aspx">http://blog.evonet.com.au/post/Integrating-Google-Maps-into-an-ASPNET-page.aspx</a></p> <p class=MsoNormal> </p> <p class=MsoNormal>I tried to run it in my site and I get an error that reads:</p> <p class=MsoNormal><span class=keyword>Error</span>  Rendering Control – UpdatePanel1    </p> <p class=MsoNormal>An unhandled exception has occurred.    </p> <p class=MsoNormal>The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases. </p> <p class=MsoNormal> </p> <p class=MsoNormal>Here is all the GoogleMaps.aspx:</p> <p class=MsoNormal><span style="background:yellow none repeat scroll 0% 0%;font-size:10pt;font-family:'Courier New'">&lt;%</span> <span style="font-size:10pt;font-family:'Courier New';color:blue">@</span> <span style="font-size:10pt;font-family:'Courier New'"> <span style="color:#a31515">Page</span> <span style="color:red">Language</span> <span style="color:blue">=&quot;VB&quot;</span> <span style="color:red">AutoEventWireup</span> <span style="color:blue">=&quot;false&quot;</span> <span style="color:red">CodeFile</span> <span style="color:blue">=&quot;GoogleMaps.aspx.vb&quot;</span> <span style="color:red">Inherits</span> <span style="color:blue">=&quot;GoogleMaps&quot;</span> <span style="background:yellow none repeat scroll 0% 0%">%&gt;</span> </span></p> <p class=MsoNormal><span style="background:yellow none repeat scroll 0% 0%;font-size:10pt;font-family:'Courier New'">&lt;%</span> <span style="font-size:10pt;font-family:'Courier New';color:blue">@</span> <span style="font-size:10pt;font-family:'Courier New'"> <span style="color:#a31515">Register</span> <span style="color:red">Assembly</span> <span style="color:blue">=&quot;GMaps&quot;</span> <span style="color:red">Namespace</span> <span style="color:blue">=&quot;Subgurim.Controles&quot;</span> <span style="color:red">TagPrefix</span> <span style="color:blue">=&quot;cc1&quot;</span> <span style="background:yellow none repeat scroll 0% 0%">%&gt;</span> </span></p> <p class=MsoNormal><span style="background:yellow none repeat scroll 0% 0%;font-size:10pt;font-family:'Courier New'"> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>    </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">form</span> <span style="color:red">id</span> <span style="color:blue">=&quot;form1&quot;</span> <span style="color:red">runat</span> <span style="color:blue">=&quot;server&quot;&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>    </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">asp</span> <span style="color:blue">:</span> <span style="color:#a31515">ScriptManager</span> <span style="color:red">ID</span> <span style="color:blue">=&quot;ScriptManager&quot;</span> <span style="color:red">runat</span> <span style="color:blue">=&quot;server&quot;</span> <span style="color:blue">/&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>    </span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>    </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">br</span> <span style="color:blue">/&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>    </span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>    </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">asp</span> <span style="color:blue">:</span> <span style="color:#a31515">UpdatePanel</span> <span style="color:red">ID</span> <span style="color:blue">=&quot;UpdatePanel1&quot;</span> <span style="color:red">runat</span> <span style="color:blue">=&quot;server&quot;</span> <span style="color:red">UpdateMode</span> <span style="color:blue">=&quot;Conditional&quot;&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">ContentTemplate</span> <span style="color:blue">&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>            </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">p</span> <span style="color:red">style</span> <span style="color:blue">=&quot;</span> <span style="color:red">text-align</span> : <span style="color:blue">right</span> ; <span style="color:red">margin-right</span> : <span style="color:blue">300px&quot;&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>                </span> Street Address:</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>                </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">asp</span> <span style="color:blue">:</span> <span style="color:#a31515">TextBox</span> <span style="color:red">ID</span> <span style="color:blue">=&quot;txtStreetAddress&quot;</span> <span style="color:red">runat</span> <span style="color:blue">=&quot;server&quot;</span> <span style="color:red">Width</span> <span style="color:blue">=&quot;150px&quot;</span> <span style="color:blue">/&gt;&lt;</span> <span style="color:#a31515">br</span> <span style="color:blue">/&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>                </span> Suburb:</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>                </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">asp</span> <span style="color:blue">:</span> <span style="color:#a31515">TextBox</span> <span style="color:red">ID</span> <span style="color:blue">=&quot;txtSuburb&quot;</span> <span style="color:red">runat</span> <span style="color:blue">=&quot;server&quot;</span> <span style="color:red">Width</span> <span style="color:blue">=&quot;150px&quot;</span> <span style="color:blue">/&gt;&lt;</span> <span style="color:#a31515">br</span> <span style="color:blue">/&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>                </span> Country:</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>    </span> <span>            </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">asp</span> <span style="color:blue">:</span> <span style="color:#a31515">TextBox</span> <span style="color:red">ID</span> <span style="color:blue">=&quot;txtCountry&quot;</span> <span style="color:red">runat</span> <span style="color:blue">=&quot;server&quot;</span> <span style="color:red">Width</span> <span style="color:blue">=&quot;150px&quot;</span> <span style="color:blue">/&gt;&lt;</span> <span style="color:#a31515">br</span> <span style="color:blue">/&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>                </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">br</span> <span style="color:blue">/&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>                </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">asp</span> <span style="color:blue">:</span> <span style="color:#a31515">Button</span> <span style="color:red">Text</span> <span style="color:blue">=&quot;Show Map&quot;</span> <span style="color:red">ID</span> <span style="color:blue">=&quot;lnkShowMap&quot;</span> <span style="color:red">runat</span> <span style="color:blue">=&quot;server&quot;</span> <span style="color:blue">/&gt;&lt;</span> <span style="color:#a31515">br</span> <span style="color:blue">/&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>                </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">br</span> <span style="color:blue">/&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>            </span> <span style="color:blue">&lt;/</span> <span style="color:#a31515">p</span> <span style="color:blue">&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>            </span> <span style="color:blue">&lt;</span> <span style="color:#a31515">cc1</span> <span style="color:blue">:</span> <span style="color:#a31515">GMap</span> <span style="color:red">ID</span> <span style="color:blue">=&quot;GMap1&quot;</span> <span style="color:red">runat</span> <span style="color:blue">=&quot;server&quot;</span> <span style="color:blue">/&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> <span style="color:blue">&lt;/</span> <span style="color:#a31515">ContentTemplate</span> <span style="color:blue">&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>    </span> <span style="color:blue">&lt;/</span> <span style="color:#a31515">asp</span> <span style="color:blue">:</span> <span style="color:#a31515">UpdatePanel</span> <span style="color:blue">&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New';color:blue"> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New';color:blue"> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>    </span> <span style="color:blue">&lt;/</span> <span style="color:#a31515">form</span> <span style="color:blue">&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New';color:blue">&lt;/</span> <span style="font-size:10pt;font-family:'Courier New';color:#a31515">body</span> <span style="font-size:10pt;font-family:'Courier New';color:blue">&gt;</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New';color:blue">&lt;/</span> <span style="font-size:10pt;font-family:'Courier New';color:#a31515">html</span> <span style="font-size:10pt;font-family:'Courier New';color:blue">&gt;</span></p> <p class=MsoNormal> </p> <p class=MsoNormal> </p> <p class=MsoNormal>Here is the GoogleMaps.aspx.vb</p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New';color:blue">Imports</span> <span style="font-size:10pt;font-family:'Courier New'"> System</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New';color:blue">Imports</span> <span style="font-size:10pt;font-family:'Courier New'"> System.Collections.Generic</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New';color:blue">Imports</span> <span style="font-size:10pt;font-family:'Courier New'"> System.Web.UI.WebControls</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New';color:blue">Partial</span> <span style="font-size:10pt;font-family:'Courier New'"> <span style="color:blue">Class</span> GoogleMaps</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>    </span> <span style="color:blue">Inherits</span> System.Web.UI.Page</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>    </span> <span style="color:blue">Protected</span> <span style="color:blue">Sub</span> lnkShowMap_Click(<span style="color:blue">ByVal</span> sender <span style="color:blue">As</span> <span style="color:blue">Object</span> , <span style="color:blue">ByVal</span> e <span style="color:blue">As</span> System.EventArgs) <span style="color:blue">Handles</span> lnkShowMap.Click</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> <span style="color:blue">Dim</span> strFullAddress <span style="color:blue">As</span> <span style="color:blue">String</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> <span style="color:blue">Dim</span> sMapKey <span style="color:blue">As</span> <span style="color:blue">String</span> = ConfigurationManager.AppSettings(<span style="color:#a31515">&quot;googlemaps.subgurim.net&quot;</span> )</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> <span style="color:blue">Dim</span> GeoCode <span style="color:blue">As</span> Subgurim.Controles.GeoCode</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> <span style="color:green">' Combine our address fields to create the full address.<span>  </span> The street, suburb and country should be seperated by</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> <span style="color:green">' periods (.)</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> strFullAddress = txtStreetAddress.Text &amp; <span style="color:#a31515">&quot;. &quot;</span> &amp; txtSuburb.Text &amp; <span style="color:#a31515">&quot;. &quot;</span> &amp; txtCountry.Text</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> <span style="color:green">' Work out the longitude and latitude</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> GeoCode = Subgurim.Controles.GMap.geoCodeRequest(strFullAddress, sMapKey)</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> <span style="color:blue">Dim</span> gLatLng <span style="color:blue">As</span> <span style="color:blue">New</span> Subgurim.Controles.GLatLng(GeoCode.Placemark.coordinates.lat, GeoCode.Placemark.coordinates.lng)</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> <span style="color:green">' Display the map</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> GMap1.setCenter(gLatLng, 16, Subgurim.Controles.GMapType.GTypes.Normal)</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> <span style="color:blue">Dim</span> oMarker <span style="color:blue">As</span> <span style="color:blue">New</span> Subgurim.Controles.GMarker(gLatLng)</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>        </span> GMap1.addGMarker(oMarker)</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New'"><span>    </span> <span style="color:blue">End</span> <span style="color:blue">Sub</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New';color:blue">End</span> <span style="font-size:10pt;font-family:'Courier New'"> <span style="color:blue">Class</span> </span></p> <p class=MsoNormal> </p> <p class=MsoNormal>Finally, I have this in my web.config, right after my ConnectionString to my database:</p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New';color:blue"><span>    </span> &lt;</span> <span style="font-size:10pt;font-family:'Courier New';color:#a31515">appSettings</span> <span style="font-size:10pt;font-family:'Courier New';color:blue">&gt;</span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New';color:blue"><span>        </span> &lt;</span> <span style="font-size:10pt;font-family:'Courier New';color:#a31515">add</span> <span style="font-size:10pt;font-family:'Courier New';color:blue"> </span> <span style="font-size:10pt;font-family:'Courier New';color:red">key</span> <span style="font-size:10pt;font-family:'Courier New';color:blue">=</span> <span style="font-size:10pt;font-family:'Courier New'">&quot;<span style="color:blue">googlemaps.subgurim.net</span> &quot;<span style="color:blue"> </span> <span style="color:red">value</span> <span style="color:blue">=</span> &quot;<span style="color:blue">ABQIAAAAH0utotGZ69FubgbYS8V7rBSm8BbgdIHpNXbmtebu-fiLwIq8GxSYeo5ieKqzt_iRbt4Sx65dLQPiBg</span> &quot;<span style="color:blue"> /&gt;</span> </span></p> <p class=MsoNormal><span style="font-size:10pt;font-family:'Courier New';color:blue"><span>    </span> &lt;/</span> <span style="font-size:10pt;font-family:'Courier New';color:#a31515">appSettings</span> <span style="font-size:10pt;font-family:'Courier New';color:blue">&gt;</span></p> <p class=MsoNormal> </p> <p class=MsoNormal>I’m not too sure if the order of the code matters much in the web.config area.</p> <p class=MsoNormal> </p> <p class=MsoNormal>Can someone please tell me what I am doing wrong?</p> <p class=MsoNormal> </p> <p class=MsoNormal> </p> <p class=MsoNormal>Thanks!</p> <p class=MsoNormal>Ryan--- </p>Sun, 15 Nov 2009 18:04:18 Z2009-11-19T18:20:55Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/c175baa2-e7f5-4891-a3b1-a2945d4c2ebchttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/c175baa2-e7f5-4891-a3b1-a2945d4c2ebciam_shivahttp://social.msdn.microsoft.com/Profile/en-US/?user=iam_shivaIntegrate Plam (PDA) and .Net applicationHi,<br/><br/>I need to communicate to .net application with some specific parameters from different palm devices (pdas) and store those parameters in the database.  Could any one tell me a simple solution and how to integrate both the applications.<br/><br/>Thank you in advance.<br/><br/>Kind Regards,<br/>Shiva.Wed, 18 Nov 2009 06:18:31 Z2009-11-19T18:18:14Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/d06e0859-1537-4e96-8251-c66457c3fdf6http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/d06e0859-1537-4e96-8251-c66457c3fdf6vikas02http://social.msdn.microsoft.com/Profile/en-US/?user=vikas02connect outllok to sql database<p>i want to save outlook data into sql database table..like when i create a cotact in outlook.i want to save this contact into sql database table......<br/>how to connect outllok to sql server???????????</p> <p>PL reply..........</p>Thu, 19 Nov 2009 06:28:54 Z2009-11-19T18:16:50Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/b219bccd-1b99-4f9a-8576-6ca7b6fa04cehttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/b219bccd-1b99-4f9a-8576-6ca7b6fa04ceJWilliamsAtSWCGhttp://social.msdn.microsoft.com/Profile/en-US/?user=JWilliamsAtSWCGHow can I open a library's app.config from a web service?I have three projects under one solution.&nbsp; The first project is a class library that contains all database handling.&nbsp; The second project is a WebService that performs the business logic and acts as the middle man between the UI and the database handling library.&nbsp; The third project is a WinForms project that consists of the users UI.<br /> <br /> My class library contains an app.config with the various settings pertaining only to itself (connection strings, default values, etc).&nbsp; To read from this configuration I was originally using ConfigurationManager.&nbsp; However, I quickly found out the ConfigurationManager used the executing application's configuration and not the library's configuration.&nbsp; To use the library's configuration I used (placed in a method inside the library)<br /> <br /> <div style="color: Black; background-color: White;"> <pre>ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location); </pre> </div> <br /> This worked fine when I called the library directly from the UI project after I added the library's app.config as a linked existing item and gave it a build action of content.&nbsp; I then moved all calls to the library from the UI to the WebService and added the library's app.config in the same manner as I did for the UI.&nbsp; This however, is not allowing me to use the library's app.config.&nbsp; When calling the library's method from the WebService, the above line of code is openning an unknown configuration file.&nbsp; The code<br /> <br /> <div style="color: Black; background-color: White;"> <pre>Assembly.GetExecutingAssembly().Location </pre> </div> <br /> shows that the dll is always copied to &quot;&lt;User&gt;\AppData\Local\Temp\Temporary ASP.NET Files\root\fbe2780f\77f4c55e\assembly\dl3\c8e6491c\79da3d9d_8248ca01\&lt;Library&gt;&quot;.&nbsp; The library's app.config is not copied to this location and is then not opened (though a config is openned because OpenExeConfiguration doesn't return null.)<br /> <br /> <br /> How can I access the library's app.config from a method contained within the library which is called from the web service?<br /> <br />Fri, 09 Oct 2009 02:20:16 Z2009-11-19T15:42:01Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/a7e4a600-e687-4527-98cf-524dd8d75b84http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/a7e4a600-e687-4527-98cf-524dd8d75b84vikas02http://social.msdn.microsoft.com/Profile/en-US/?user=vikas02webservice to list all country currency value<p>hello..</p> <p>i want list all country currency value with the web service help n these currency value should be update automatically......<br/>plz reply</p>Wed, 18 Nov 2009 10:28:54 Z2009-11-19T00:55:04Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/ea0c405e-9c1e-43c1-8a63-8b9367b3596fhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/ea0c405e-9c1e-43c1-8a63-8b9367b3596ftimbmchttp://social.msdn.microsoft.com/Profile/en-US/?user=timbmcWSE 3.0 Quickstart DOA with Visual Studio 2008 and .NET 3.5I installed Visual Studio 2008 and WSE 3 and .NET 3.5 and am attempting unsuccessfully to run the BinaryDataMTOM quick start example. I get a &quot;Conversion Report&quot; that says that the .csproj file was converted.  I then get 6 build errors.  Here is the first.<br/> <br/> Message    1    Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:configuration'.    C:\Program Files\Microsoft WSE\v3.0\Samples\CS\QuickStart\Basic\BinaryDataMTOM\BinaryDataMTOMService\web.config    10    2    C:\...\BinaryDataMTOMService\<br/> <br/> It looks like MS took down a file from the corporate web site.  Odd.  I thought disk space was cheap.<br/> <br/> My task is to come up with a textbook correct test web client to show .NET users how to use our server.  I'm new to .NET and was depending on having working samples, and not just as a time saver.  I'm not qualified to judge if some random internet advice is correct or not, even if what I do might appear to work at first.<br/> <br/> Is there an actual working WSE download?  Could someone from the WSE team please post an updated web.config file?Wed, 18 Nov 2009 21:42:41 Z2009-11-18T21:42:42Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/702f0ea1-089c-4246-baac-add36553a48chttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/702f0ea1-089c-4246-baac-add36553a48cArunWrenchhttp://social.msdn.microsoft.com/Profile/en-US/?user=ArunWrenchAutocad file printingHi...<br/>I created a web service to print autocad file (PS file). I am using a autocad 2007. In some PCs, while printing the autocad file showing an error(error and method is given below:)<br/><br/>EXCEPTION : System.ArgumentNullException: Value cannot be null.<br/>Parameter name: type<br/>   at System.Activator.CreateInstance(Type type, Boolean nonPublic)<br/>   at Service.HelloWorld()<br/><br/>My method is below:<br/><br/> <pre> public string HelloWorld() { string sRet = string.Empty; Type oClassType; object[] oParams = new object[1]; object moAcadApp = null; object oDocs = null; object oRet = null; try { oParams[0] = true; //oClassType = Type.GetTypeFromProgID(&quot;AutoCAD.Application.17&quot;, &quot;localhost&quot;, true); oClassType = Type.GetTypeFromProgID(&quot;AutoCAD.Application&quot;); moAcadApp = Activator.CreateInstance(oClassType); moAcadApp.GetType().InvokeMember(&quot;Visible&quot;, BindingFlags.SetProperty, null, moAcadApp, oParams); oDocs = moAcadApp.GetType().InvokeMember(&quot;Documents&quot;, BindingFlags.GetProperty, null, moAcadApp, null); oParams = new object[3]; oParams[0] = @&quot;D:\PDF\MyACAD-1.dwg&quot;; oParams[1] = Missing.Value; oParams[2] = Missing.Value; oRet = oDocs.GetType().InvokeMember(&quot;Open&quot;, BindingFlags.InvokeMethod, null, oDocs, oParams); oRet = oRet.GetType().InvokeMember(&quot;Plot&quot;, BindingFlags.GetProperty, null, oRet, null); oParams = new object[2]; oParams[0] = &quot;D:\\PDF\\file.ps&quot;; oParams[1] = &quot;Generic PostScript Printer&quot;; oRet.GetType().InvokeMember(&quot;PlotToFile&quot;, BindingFlags.InvokeMethod, null, oRet, oParams); sRet = &quot;DONE!&quot;; } catch (Exception eX) { sRet = &quot;EXCEPTION : &quot; + eX.ToString(); } return sRet; }</pre>Wed, 18 Nov 2009 07:27:52 Z2009-11-18T07:27:54Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/9919ef8a-c67b-47ef-85fe-26ce8f4f58c4http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/9919ef8a-c67b-47ef-85fe-26ce8f4f58c4ryguy72http://social.msdn.microsoft.com/Profile/en-US/?user=ryguy72Trying to Connect my calendar to a SQL Server DBI am trying to link my calendar to a SQL Server DB.  I’m following the example here:<br/> http://www.codeproject.com/KB/webforms/MellDataCalendar.aspx<br/> <br/> On that site, though, they link to an Access DB on the desktop.  I’m pointing to a SQL Server DB on, well my desktop for now, but soon a server.  My question is, how do I set up to connection to the SQL Server DB?<br/> <br/> In the example from the site above, it is done like this:<br/>             dim con as OleDbConnection = new OleDbConnection(&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\DataCalendar\calendar.mdb&quot;)<br/> <br/> Here is my code; I am trying to point to my SQL Server like this:<br/> &lt;% @Register Namespace=&quot;DataControls&quot; Assembly=&quot;DataCalendar&quot; TagPrefix=&quot;dc&quot; %&gt;<br/> <br/> &lt;% @Import Namespace=&quot;System.Data&quot; %&gt;<br/> &lt;% @Import Namespace=&quot;System.Data.OleDb&quot; %&gt;<br/> <br/> &lt;script language=&quot;vb&quot; runat=&quot;server&quot;&gt;<br/> <br/>     Function GetEventData() as DataTable<br/>         '-- We'll see if the events have already been loaded into a session<br/>         '-- variable.  Session variables may or may not be appropriate for<br/>         '-- your environment; if not, you may wish to load events from the database<br/>         '-- on each page call, or use the application cache.<br/>         <br/>         If (Session(&quot;EventData&quot;) is Nothing or Request(&quot;refresh&quot;)= &quot;1&quot;) then<br/>             '-- read data from an SqlDataSource3 query<br/>             dim con as OleDbConnection = new OleDbConnection(&quot;PubCrawlsConnectionString&quot;)<br/>             dim cmd as OleDbCommand = new OleDbCommand()<br/>             cmd.Connection = con<br/>             'cmd.CommandText = &quot;Select * From EventInfo&quot;<br/>             cmd.CommandText = &quot;SELECT Events.EventTitle, Events.EventDate, Categories.CategoryTitle FROM Categories INNER JOIN Events ON Categories.CategoryID = Events.EventCategory&quot;<br/>             dim ds as DataSet = new DataSet()<br/>             dim da as OleDbDataAdapter = new OleDbDataAdapter(cmd)<br/>             da.Fill(ds)<br/>             con.Close()<br/>         <br/>             Session(&quot;EventData&quot;) = ds.Tables(0)<br/>         End If<br/>         <br/>         return CType(Session(&quot;EventData&quot;), DataTable)<br/>     End Function<br/>     <br/> <br/>     Sub Page_Load(o as Object, e as EventArgs)<br/>         cal1.DataSource = GetEventData()<br/>         cal1.DayField = &quot;EventDate&quot;<br/>     End Sub<br/>     <br/> &lt;/script&gt;<br/> <br/> <br/> &lt;html&gt;<br/>     &lt;head&gt;<br/>         &lt;title&gt;DataCalendar - Example 2 with Session Variable&lt;/title&gt;<br/>         &lt;style&gt;<br/>             a       {text-decoration: none; } <br/>             a:hover {text-decoration: underline; }<br/>         &lt;/style&gt;<br/>     &lt;/head&gt;<br/>     <br/>     &lt;body&gt;<br/>         &lt;form id=&quot;Form1&quot; runat=&quot;server&quot;&gt;<br/>         <br/>             &lt;h3&gt;Events from an SqlDataSource3 database through OleDb&lt;/h3&gt;<br/>             <br/>             &lt;dc:DataCalendar id=&quot;cal1&quot; runat=&quot;server&quot; width=&quot;100%&quot;<br/>                              VisibleDate=&quot;10/1/2009&quot;&gt;<br/>                 &lt;DayStyle HorizontalAlign=&quot;Left&quot; VerticalAlign=&quot;Top&quot;<br/>                           Font-Size=&quot;8&quot; Font-Name=&quot;Arial&quot; /&gt;<br/>                           <br/>                 &lt;OtherMonthDayStyle BackColor=&quot;LightGray&quot; ForeColor=&quot;DarkGray&quot;<br/>                            /&gt;<br/> <br/>                 &lt;ItemTemplate&gt;<br/>                     &lt;br /&gt;                    <br/>                     &lt;a href='eventDetail.aspx?id=&lt;%Container.DataItem(&quot;EventID&quot;) %&gt;'&gt;                    <br/>                         &lt;img src='images/&lt;%Container.DataItem(&quot;CategoryImage&quot;) %&gt;' height=&quot;12&quot; width=&quot;12&quot; align=&quot;absmiddle&quot; border=&quot;0&quot;/&gt;<br/>                         &lt;font color='&lt;%Container.DataItem(&quot;CategoryColor&quot;) %&gt;'&gt;<br/>                             &lt;%Container.DataItem(&quot;EventTitle&quot;) %&gt;<br/>                         &lt;/font&gt;<br/>                     &lt;/a&gt;                            <br/>                 &lt;/ItemTemplate&gt;<br/>                 <br/>                 &lt;NoEventsTemplate&gt;<br/>                     &lt;br /&gt;<br/>                     &lt;br /&gt;<br/>                     &lt;br /&gt;<br/>                     &lt;br /&gt;<br/>                     &lt;br /&gt;<br/>                 &lt;/NoEventsTemplate&gt;<br/>                 <br/>             &lt;/dc:DataCalendar&gt;<br/>             <br/>         &lt;/form&gt;<br/>     &lt;/body&gt;<br/>         <br/> &lt;/html&gt;<br/> <br/> Again, when I set up an Access DB on my desktop and point to that, the code works perfect.  When I set up my SQL Server, and point to that, NOTHING WORKS.  Any idea on what I can do to make this work on my site.<br/> <br/> Thanks!<br/> Ryan---Sun, 15 Nov 2009 18:08:07 Z2009-11-18T01:39:04Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/32cab6f8-d081-470d-b40d-a71bd0538e48http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/32cab6f8-d081-470d-b40d-a71bd0538e48Dino Dhttp://social.msdn.microsoft.com/Profile/en-US/?user=Dino%20D\r replaced in the deserialised xml<p>I am reading a string with carriage returns and new lines into a string.</p> <p>This string is later added to a xml, serialised, written to the db.</p> <p>And When I read the string again from db, deserialise it to the object,I see that \rs are missing.</p> <p>How can I preserver the \r?<br/><br/>Thanks</p>Thu, 12 Nov 2009 19:59:18 Z2009-11-17T17:40:00Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/29007e10-e728-4254-9f5d-9811e1ca5156http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/29007e10-e728-4254-9f5d-9811e1ca5156nickfinityhttp://social.msdn.microsoft.com/Profile/en-US/?user=nickfinityPartial deserializeHello,<br/> <br/> I haven't done much XML serialization/deserialization, but I think it's the best route for what I'm trying to do now. I created an XSD file and generated a class using the xsd command. It works fine when I load my entire xml file. What I don't know how to do, however, is a partial load. I need to load a &quot;base&quot; file, but then I need to load overrides/overwrites that is only a partial file. For example, let's say I have this:<br/> <pre lang=x-xml>&lt;document&gt;<br/> &lt;title&gt;Title1&lt;/title&gt;<br/> ... a bunch of other stuff...<br/> &lt;/document&gt;</pre> <br/> The next call will only contain a subset of the original, but could have different values.<br/> <pre lang=x-xml>&lt;document&gt;<br/> &lt;title&gt;A new title&lt;/title&gt;<br/> &lt;/document&gt;</pre> I need to keep all of the other stuff and only overwrite the title. Could someone point me in the right direction? I'm assuming I need to override the deserialization method? <br/> <br/> Thanks for any help, I really appreciate it.<br/> <br/> Thanks,<br/> NickTue, 17 Nov 2009 15:41:02 Z2009-11-17T15:41:04Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/d4ada97a-0e4e-4e1c-88d4-1b692cf9d505http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/d4ada97a-0e4e-4e1c-88d4-1b692cf9d505JabberWhttp://social.msdn.microsoft.com/Profile/en-US/?user=JabberWcycling graph xml serialization<p>Hi<br/> I'm developing a java web service which should be consumed by .NET client. Generally, it shouldn't be any problem, this technology is quite mature this days.<br/> However, there is problem with some particular data type. On the object level, I have a cycling graph reference. Obviously this can't be serializaed as a plain XML document. The most streightforwad approach is xsd:ID/xsd:IDREF usage, which handles such case, for example:<br/>  &lt;xs:complexType name=&quot;a&quot;&gt;<br/>    &lt;xs:sequence&gt;<br/>      &lt;xs:element name=&quot;id&quot; type=&quot;xs:ID&quot; minOccurs=&quot;0&quot;/&gt;<br/>      &lt;xs:element name=&quot;myB&quot; type=&quot;xs:IDREF&quot; minOccurs=&quot;0&quot;/&gt;<br/>      &lt;xs:element name=&quot;someAfield&quot; type=&quot;xs:string&quot; minOccurs=&quot;0&quot;/&gt;<br/>    &lt;/xs:sequence&gt;<br/>  &lt;/xs:complexType&gt;<br/><br/>  &lt;xs:complexType name=&quot;b&quot;&gt;<br/>    &lt;xs:sequence&gt;<br/>      &lt;xs:element name=&quot;id&quot; type=&quot;xs:ID&quot; minOccurs=&quot;0&quot;/&gt;<br/>      &lt;xs:element name=&quot;myA&quot; type=&quot;xs:IDREF&quot; minOccurs=&quot;0&quot;/&gt;<br/>      &lt;xs:element name=&quot;someBfield&quot; type=&quot;xs:string&quot; minOccurs=&quot;0&quot;/&gt;<br/>    &lt;/xs:sequence&gt;<br/>  &lt;/xs:complexType&gt;<br/><br/>The problem with IDREF is that on the design time the reference is not strictly typed. I.e., if such schema is imported to .NET, the type of field, specified by IDREF, will be an object, i.e. completely opaque. Of course, it looks not good.<br/> In java (jaxb) there is a way to hint the type referenced by IDREF, using jaxb:property, for example:<br/>  &lt;xs:complexType name=&quot;b&quot;&gt;<br/>    &lt;xs:sequence&gt;<br/>      &lt;xs:element name=&quot;id&quot; type=&quot;xs:ID&quot; minOccurs=&quot;0&quot;/&gt;<br/>      &lt;xs:element name=&quot;myA&quot; type=&quot;xs:IDREF&quot; minOccurs=&quot;0&quot;/&gt;<br/>        &lt;xs:annotation&gt;<br/>           &lt;xs:appinfo&gt;<br/>              &lt;jaxb:property&gt;<br/>                 &lt;jaxb:baseType name=&quot;a&quot;/&gt;<br/>              &lt;/jaxb:property&gt;<br/>           &lt;/xs:appinfo&gt;<br/>        &lt;/xs:annotation&gt;<br/>      &lt;/xs:element&gt;<br/>      &lt;xs:element name=&quot;someBfield&quot; type=&quot;xs:string&quot; minOccurs=&quot;0&quot;/&gt;<br/>    &lt;/xs:sequence&gt;<br/>  &lt;/xs:complexType&gt;<br/>Thus, the generated code will be strongly typed: the field &quot;myA&quot; will have a type &quot;a&quot;.<br/>Is there such thing in a .NET?<br/><br/>Greatly appreciating any inputs,<br/>Sincerely,<br/>J.</p>Tue, 17 Nov 2009 10:35:35 Z2009-11-17T10:35:37Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/ae05781c-20b1-4b9a-b02c-6a102cfdba02http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/ae05781c-20b1-4b9a-b02c-6a102cfdba02nano2khttp://social.msdn.microsoft.com/Profile/en-US/?user=nano2kWebservice reinitializes after deleting subfolder of websiteHello<br/><br/>I'm developing a webservice at the following phisical disk address: C:\Inetpub\www\MyWebservice<br/>The webservice accepts some files and puts them into some subdirectory like: C:\Inetpub\www\MyWebservice\files.<br/>Binary files are stored in &quot;bin&quot; folder: C:\Inetpub\www\MyWebservice\bin.<br/><br/>From times to times the folder is <strong>moved</strong> by hand by some human operator. The webservice then recreates the &quot;files&quot; subfolder and continues to copy files as they arrive.<br/><br/>My problem is when the &quot;files&quot; folder is deleted (as the result of moving process), the webservice reinitializes. This means that all &quot;static&quot; data is lost. Static data stored on server side is like cached objects, &quot;session&quot; data, etc.<br/><br/>How can I prevent this behavior? I'd rather keep the storage folder under C:\Inetpub\www\MyWebservice path than moving to a totally different location like: D:\files. I know this would be a better choice but for now I need it that way.<br/><br/>Thanks anyone.<br/>Mon, 16 Nov 2009 17:04:51 Z2009-11-17T07:44:43Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/e4c655de-60bc-42f5-a963-00843f8400c8http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/e4c655de-60bc-42f5-a963-00843f8400c8Joao C. Santoshttp://social.msdn.microsoft.com/Profile/en-US/?user=Joao%20C.%20SantosWeb Service ProblemHi,<br/> <br/> I have a problem when developing a web service. i have a dll that correspondes to a WS wrapper. When I had it as a reference to a project and create the Service object i have access to the Url attribute, just as if it was a web reference. but when i create my own web service and had the dll as a reference (not a web reference) and create the Service object i only have access to the web methods, and i don't know how to give access to all the attributes and methods i have in the wrapper dll.<br/> I've already browsed for help and found mentions to use the SoapHttpClientProtocol but i still got nothing.<br/> Can someone help or provide the guidelines on how to achieve this? <br/> <br/> Thanks for any help provided<br/> João<br/><hr class="sig">Regards, JoãoFri, 13 Nov 2009 13:26:34 Z2009-11-17T03:13:12Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/e6451bb4-8d1e-45af-8e6b-58fdbace05b5http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/e6451bb4-8d1e-45af-8e6b-58fdbace05b5Tharigondahttp://social.msdn.microsoft.com/Profile/en-US/?user=TharigondaSoap Header<div class=container> <div class=body><span class=v11 style="color:darkblue"><br/> <span style="font-family:Arial;color:black">Hi All,<br/> <br/> I have an SOAP Message, WSDL file and added this file to my Windows Application. This webservice is not coded in .NET. The XML will be <br/> &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br/> &lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:ns1=&quot;http://ws.ecprovws.bcs.com/&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;<br/> &lt;soapenv:Header&gt;<br/> &lt;ecProvAuthHeader0&gt;&lt;clientId&gt;ClientId&lt;/clientId&gt;&lt;clientKey&gt;ClientKey&lt;/clientKey&gt;&lt;/ecProvAuthHeader0&gt;<br/> &lt;/soapenv:Header&gt;<br/> &lt;soapenv:Body&gt;<br/> &lt;createRegistrant xmlns=&quot;http://ws.ecprovws.bcs.com/&quot;&gt;<br/> &lt;registrantWs xmlns=&quot;&quot;&gt;<br/> &lt;conferenceId&gt;ConferenceId&lt;/conferenceId&gt;<br/> &lt;firstName&gt;FirstName&lt;/firstName&gt;<br/> &lt;lastName&gt;LastName&lt;/lastName&gt;<br/> &lt;email&gt;Email&lt;/email&gt;<br/> &lt;maxPin&gt;MaxPIN&lt;/maxPin&gt;<br/> &lt;pin&gt;PIN&lt;/pin&gt;<br/> &lt;role&gt;Role&lt;/role&gt;<br/> &lt;txId&gt;TxId&lt;/txId&gt;<br/> &lt;/registrantWs&gt;<br/> &lt;/createRegistrant&gt;<br/> &lt;/soapenv:Body&gt;<br/> &lt;/soapenv:Envelope&gt;<br/> <br/> <br/> I have created a proxy class for the WSDL file and added to my windows application. I want to call a method<br/> &quot;createRegistrant&quot; so I have used the below code <br/> EcProvWsService objService = new EcProvWsService();<br/> registrantWs objRegistrant = new registrantWs();<br/> objRegistrant.email = &quot;&quot;;<br/> objRegistrant.conferenceId =&quot;&quot;;<br/> objRegistrant.firstName = &quot;&quot;;<br/> objRegistrant.lastName = &quot;&quot;;<br/> objService.createRegistrant(objRegistrant);<br/> <br/> But for SoapHeader I am not able to create intance for &quot;ecProvAuthHeader0&quot; just like <br/> ecProvAuthHeader0 obj = new ecProvAuthHeader0();<br/> obj.ClientID= &quot;&quot;;<br/> obj.ClientKey = &quot;&quot;;<br/> objService.ecProvAuthHeaderoValue = obj;<br/> <br/> So please anybody help me how to code for soap header in this case.<br/> <br/> Thanks in Advace.</span> </span></div> </div>Wed, 11 Nov 2009 09:46:13 Z2009-11-17T03:10:36Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/8b26a6f4-0198-48d0-ad67-82421236febehttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/8b26a6f4-0198-48d0-ad67-82421236febechriszero_dhttp://social.msdn.microsoft.com/Profile/en-US/?user=chriszero_dXmlSerializer don't call the Property_setI have a problem when I try to deserialize a List&lt;T&gt;.<br/> the perfectly serialize to a Xml. But it doesn't deserialize.<br/> When I use the debugger it seems that the set { } is never called.<br/> <br/> here is a snippet of the code:<br/> <br/> <pre lang="x-c#">public abstract class ConfigurableObject { protected SortedList&lt;string, ConfigurableValue&gt; configVars = new SortedList&lt;string, ConfigurableValue&gt;(); [XmlIgnore] public virtual SortedList&lt;string, ConfigurableValue&gt; ConfigVariables { get { return configVars; } set { configVars = value; } } protected ConfigurableObject() { configVars.Add(&quot;Description&quot;, new ConfigurableValue()); } [...] public virtual List&lt;ConfigurableValue&gt; ConfigList { get { List&lt;ConfigurableValue&gt; list = new List&lt;ConfigurableValue&gt;(); foreach (KeyValuePair&lt;string, ConfigurableValue&gt; en in this.configVars) { ConfigurableValue val = en.Value; val.Name = en.Key; list.Add(val); } return list; } set { foreach (ConfigurableValue val in value) { if (this.configVars.ContainsKey(val.Name)) { this.configVars[val.Name] = val; } this.configVars.Add(val.Name, val); } } } [...] }</pre> All other properties are Fine.<br/> <br/> Thanks.<br/>Wed, 11 Nov 2009 09:29:09 Z2009-11-17T03:09:30Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/88711ff6-2112-462a-b862-187f06a26d50http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/88711ff6-2112-462a-b862-187f06a26d50ddpommeshttp://social.msdn.microsoft.com/Profile/en-US/?user=ddpommesCanDeserialize does not work with generated assemblies using sgen.exeHi<br/><br/><br/>I have the following example code to demonstrate my problem.<br/><br/> <pre lang="x-c#">using System.Xml; using System.Xml.Serialization; namespace ConsoleApplication1 { public class Program { public static void Main(string[] args) { XmlSerializer serializer = new XmlSerializer(typeof(Example)); XmlWriter writer = XmlWriter.Create(&quot;test.xml&quot;); Example input = new Example { Text = &quot;Test&quot; }; serializer.Serialize(writer, input); writer.Close(); XmlReader reader = XmlReader.Create(&quot;test.xml&quot;); bool canDeserialize = serializer.CanDeserialize(reader); Example result = (Example)serializer.Deserialize(reader); } [XmlRoot(&quot;example&quot;, Namespace = &quot;http://tempuri.org/Example&quot;)] public class Example { [XmlAttribute(&quot;text&quot;)] public string Text { get; set; } } } }</pre> If I run this code, the value of canDeserialize is true (like it should be).<br/><br/>If I now add a post build step that speeds up the XmlSerializer constructor (and generates the serialization assemblies on compile time) the CanDeserialize method is not working anymore. It will return false, but the Example object is still deserialized correctly.<br/><br/>My post build step looks like this:<br/>&quot;[path to sgen.exe]\sgen.exe&quot; &quot;$(TargetPath)&quot; /force<br/><br/>I tried the sgen.exe from the Windows 6.0A SDK (version: 2.0.50727.3038) and the one from the Windows 6.1 SDK (version: 2.0.50727.1432).<br/>I'm using VS2008 and .NET Framework 3.5 SP1.<br/><br/>Did I do something wrong or is this a bug?<br/><br/><br/>Thanks for the help.<br/><br/>ddpommes<br/><br/><br/><br/><br/>Fri, 13 Nov 2009 14:15:34 Z2009-11-17T03:07:24Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/4a34635c-bc21-4144-b3b1-60aba54eb7a4http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/4a34635c-bc21-4144-b3b1-60aba54eb7a4Nik6http://social.msdn.microsoft.com/Profile/en-US/?user=Nik6Web Services Memory Leak<font face=Arial size=2> <p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>Hi,</font></p> <p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3> </font></p> <p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>I am writing a C# web service. But I am having memory leak problem with the web services. </font></p> <p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>To check the problem, I created a simple web service with just one function that will take two integers as parameters and return their addition. I created an application that consumes this web service and ran it for 10000 times. </font></p> <p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>But even this simple web service was consuming memory. I used the ANTS memory profiler to check the memory consumption. It showed that ‘Hashtable+bucket[]’ object is consuming most of the used memory. Looks like this object is storing server identity IDs for all the connections. </font></p> <p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3>What exactly this object stores? Is there any way to release the memory used by this object? Or can we avoid using this object? How can I stop memory leak problem for the web services?</font></p> <p class=MsoNormal style="margin:0in 0in 0pt"><font face="Times New Roman" size=3> </font></p> <p align=left>Thanks.</font></p>Fri, 07 Dec 2007 15:22:33 Z2009-11-17T03:03:31Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/be9c555e-5d06-43b1-9224-bcaa2040d7c6http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/be9c555e-5d06-43b1-9224-bcaa2040d7c6Joe Zamorahttp://social.msdn.microsoft.com/Profile/en-US/?user=Joe%20ZamoraGlobal.asax Application/Session_Start is never called from ASP.NET 3.5 web serviceI've been beating my head against the screen trying to get log4net working in my 3.5 web service.  Per community instruction, you should add the following line to the Global.asax.cs file: <div><br/></div> <div> <div>void Application_Start(object sender, EventArgs e)   </div> <div>{  </div> <div>    // Code that runs on application startup  </div> <div>    log4net.Config.XmlConfigurator.Configure();  </div> <div>} </div> <div><br/></div> <div>However, after trying to catch a break in the debugger (see <a href="http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/8d1b5ff4-e52f-4270-864b-4a63f66765c7/">this</a>), I'm pretty confident that the Global.asax file is being ignored completely.  Has anyone had any success with log4net/Global.asax/Application_Start in an ASP.NET 3.5 web service?</div> </div>Thu, 12 Nov 2009 00:12:54 Z2009-11-17T02:58:58Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/858ae2f4-5678-4047-b43e-6efe13226229http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/858ae2f4-5678-4047-b43e-6efe13226229silentChttp://social.msdn.microsoft.com/Profile/en-US/?user=silentCObtaining IP Address of ClientUnder ASP, you can obtain the client's IP from Request.ServerVariables(&quot;REMOTE_ADDR&quot;). What is the equivalent in a Web Service?<br>Thu, 16 Nov 2006 22:13:52 Z2009-11-17T02:56:49Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/3704ec3e-51a0-4fc8-8e47-cb447bd0eca2http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/3704ec3e-51a0-4fc8-8e47-cb447bd0eca2ryguy72http://social.msdn.microsoft.com/Profile/en-US/?user=ryguy72Pass 2 Parameters from Two DropDownLists to GridView<br/> <p class=MsoNormal>I am trying to figure out a way to NOT display any items in my DropDownList when my page loads.<span>  </span> I’m linking to a list of states in my DB and Alabama, and related information, is always displayed on the page as soon as the page loads.<span>  </span> I’d really like the page to load and show only the DropDownBoxes and then I’ll pick an item from the list and display all records, in my GridView, that match.</p> <p class=MsoNormal> </p> <p class=MsoNormal>Also, I am trying to figure out how to update one DropDownList based on what is selected in another drip down list.<span>  </span> For instance, if I pick Arizona as a State and Corporate Deduction as a Topic (Topic is my second DropDownList) I’d like to see only those items that match both Arizona and Corporate Deduction.<span>  </span> This would allow me to drill down into the data and display only specific records rather than displaying lots of records, which is what I am doing now.<span>  </span> Right now, my GridView is linked to ObjectDataSource1, and this is linked to a DataSet1, and this essentially has all my data in the DB, filtered by State.<span>  </span> It’s pretty easy to link the GridView to a DropDownList and pass the selected parameter to the filter and display only records that match that parameter.<span>  </span> I can’t figure out how to get the GridView to point to two (or more) DropDownLists.<span>  </span> And I can’t figure out how to filter for two parameters, using two separate DropDownLists (or more), and pass both of these parameters to the GridView.</p> <p class=MsoNormal> </p> <p class=MsoNormal>Please help!!</p> <p class=MsoNormal> </p> <p class=MsoNormal> </p> <p class=MsoNormal>Thanks,</p> <p class=MsoNormal>Ryan---</p>Sun, 15 Nov 2009 17:53:38 Z2009-11-17T01:03:38Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/ceea70b3-2524-4a7a-ba64-37a0c61fa8d0http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/ceea70b3-2524-4a7a-ba64-37a0c61fa8d0codebasehttp://social.msdn.microsoft.com/Profile/en-US/?user=codebaseGet User and Roles to login webserviceto login webservice and check user and roles in use<br/> if user login have in roles (Administrator) continue webservice, <br/> but else alert dialog login user<br/> <br/> <br/> <p>Web.config</p> <p>&lt;authorization&gt;<br/>         &lt;allow roles=&quot;Administrator&quot; /&gt;<br/>         &lt;deny users=&quot;*&quot; /&gt;</p> <p>&lt;/authorization&gt;</p> <p>&lt;authentication mode=&quot;Windows&quot; /&gt; <br/>     <br/> &lt;identity impersonate=&quot;true&quot;/&gt;</p> <p> </p> <p>IIS config</p> Enable anonymous acces = false<br/> Integrated Windows authentication = trueMon, 16 Nov 2009 06:04:37 Z2009-11-16T07:55:22Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/454527c0-b8fb-49f1-82fb-483f7d862bd4http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/454527c0-b8fb-49f1-82fb-483f7d862bd4codebasehttp://social.msdn.microsoft.com/Profile/en-US/?user=codebasewrite file in webservice with vb.net&lt;WebMethod()&gt; _<br/> Public Function WriteFile(ByVal s As String) As Boolean<br/> Dim b As Boolean = False<br/> <br/> On Error GoTo Exception<br/> <br/> Dim ioFile As New System.IO.StreamWriter(&quot;C:\Inetpub\wwwroot\Services1\bin\log.txt&quot;, True)<br/> ioFile.WriteLine(s)<br/> ioFile.Close()<br/> b = True<br/> <br/> GoTo Finalize<br/> <br/> Exception:<br/> b = False<br/> Debug.WriteLine(&quot;Some error occurs: [WriteFile]&quot; &amp; Err.Number &amp; &quot; : &quot; &amp; Err.Description)<br/> <br/> Finalize:<br/> If b = True Then<br/> Debug.WriteLine(&quot;[WriteFile]: Success[0]&quot;)<br/> End If<br/> <br/> Return b<br/> <br/> End Function<br/> <br/> <span style="color:#ff0000">Error: &quot;Some error occurs: [WriteFile]5 : Access to the path 'C:\Inetpub\wwwroot\Services1\bin\log.txt' is denied.&quot;<br/> </span> <br/> How to call webservice with consume<br/> Dim sampleserv As New localhost.Service1<br/> Dim b as Boolean<br/> <br/> b = sampleserv.WriteFile(&quot;test write log file&quot;)Fri, 13 Nov 2009 15:36:02 Z2009-11-14T16:02:50Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/3d441525-ead9-4294-bf8c-19a5489f6d59http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/3d441525-ead9-4294-bf8c-19a5489f6d59Farhan.Net Engineerhttp://social.msdn.microsoft.com/Profile/en-US/?user=Farhan.Net%20EngineerValidation result : ERROR DURING PARSING OF THE SCHEMA FILE, service.asmx.wsdl is not compliant with java ME WEBSERVICES SPECIFICATION(JSR-172) when net beans software is accepting the .net webservice i am getting the following error:Validation result, ERROR DURING PARSING OF THE SCHEMA FILE, service.asmx.wsdl is not compliant with java ME WEBSERVICES SPECIFICATION(JSR-172)Sat, 14 Nov 2009 09:18:08 Z2009-11-14T09:18:09Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/4ea37ff1-565b-4c9e-ba38-cd87f6ae8be5http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/4ea37ff1-565b-4c9e-ba38-cd87f6ae8be5ddpommeshttp://social.msdn.microsoft.com/Profile/en-US/?user=ddpommesXmlSerializer Deserialize() does not work with a wrapping validating XmlReaderHi<br/><br/><br/>The main question for me probably is: What changes if I wrap an XmlReader with another XmlReader?<br/>I have the following case: <br/>- I check with XmlSerializer.CanDeserialize if I can deserialize an object from a XmlReader.<br/>- After that I deserialize the object from the XmlReader.<br/><br/>Everything works fine.<br/>Now I wanted to add a schema validation, so I wrapped the XmlReader with another XmlReader doing the validation against a schema.<br/>Deserializing the object is now not working anymore. As a result I get an object of Type Example, but the Text property is null.<br/>The validation works. If I omit the text-attribute in the xml file, the validation throws an exception that the text-attribute is required.<br/><br/>So what changed with the wrapping of the XmlReader? Shouldn't the wrapping reader behave just like the unwrapped reader?<br/>I know that the check of CanDeserialize has something to do with the problem. If I don't do that check deserializing will work.<br/><br/><br/>Here is my example code:<br/> <pre lang="x-c#">using System.Reflection; using System.Xml; using System.Xml.Serialization; namespace ConsoleApplication1 { public class Program { public static void Main(string[] args) { XmlSerializer serializer = new XmlSerializer(typeof(Example)); XmlWriter writer = XmlWriter.Create(&quot;test.xml&quot;); Example input = new Example { Text = &quot;Test&quot; }; serializer.Serialize(writer, input); writer.Close(); XmlReader reader = XmlReader.Create(&quot;test.xml&quot;); if (serializer.CanDeserialize(reader)) { XmlReaderSettings settings = new XmlReaderSettings(); settings.ValidationType = ValidationType.Schema; settings.Schemas.Add(&quot;http://tempuri.org/Example&quot;, XmlReader.Create(Assembly.GetExecutingAssembly().GetManifestResourceStream(&quot;ConsoleApplication1.Example.xsd&quot;))); XmlReader validationReader = XmlReader.Create(reader, settings); Example result = (Example)serializer.Deserialize(validationReader); } } [XmlRoot(&quot;example&quot;, Namespace = &quot;http://tempuri.org/Example&quot;)] public class Example { [XmlAttribute(&quot;text&quot;)] public string Text { get; set; } } } } </pre> <br/><br/>And the example xsd file (that is included as an embedded resource):<br/> <pre lang=x-xml>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;xs:schema id=&quot;Example&quot; targetNamespace=&quot;http://tempuri.org/Example&quot; elementFormDefault=&quot;qualified&quot; xmlns=&quot;http://tempuri.org/Example&quot; xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt; &lt;xs:element name=&quot;example&quot;&gt; &lt;xs:complexType&gt; &lt;xs:attribute name=&quot;text&quot; use=&quot;required&quot; type=&quot;xs:string&quot;/&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; </pre> <br/><br/><br/><br/>Thanks for the help.<br/><br/>ddpommes<br/><br/><br/><br/><br/><br/><br/>Fri, 13 Nov 2009 14:36:22 Z2009-11-13T14:36:24Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/8c1163cd-f136-4e30-9c64-a5f6354695a3http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/8c1163cd-f136-4e30-9c64-a5f6354695a3NIKKENEThttp://social.msdn.microsoft.com/Profile/en-US/?user=NIKKENETDESERIALIZE PDF STREAMGood evening,<br/>        i have to use a java web service to download a pdf file using c#.<br/>The java ws return a stream like:<br/>&lt;?xml version=&quot;1.0&quot;&gt;<br/>&lt;response&gt;<br/>    &lt;file&gt;&lt;/file&gt;<br/>&lt;/response&gt;<br/>in the tag &quot;file&quot; the ws return pdf byte array.<br/>How can i save the file on filesystem?<br/>Thank's a lot!Wed, 11 Nov 2009 17:50:54 Z2009-11-17T04:59:33Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/db8e60f7-ac51-40f6-849f-20819f7598e6http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/db8e60f7-ac51-40f6-849f-20819f7598e6ashish.bisenhttp://social.msdn.microsoft.com/Profile/en-US/?user=ashish.bisenUsing PrincipalPermission on WebMethods with Forms Authentication + Role Based Security in C#<p>In web services ,I have written some method.I want to give role base Authentication.<br/>In web service method i am using like this<br/>[PrincipalPermission(SecurityAction.Demand, Role = &quot;RoleName&quot;)]<br/>public DataSet GetUserDetails(...paramlist...)<br/>{<br/>//...<br/>}<br/>In diffrent application im creating object of that service and calling all methods.<br/>BUT<br/>After Login i am not able to access this method?<br/>How to solve this error<br/>I want after login particulat Role based user can se that method only<br/>???</p>Fri, 13 Nov 2009 11:55:02 Z2009-11-13T11:55:03Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/30dbeec7-2df5-45f9-8c6f-36a2dfa3e089http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/30dbeec7-2df5-45f9-8c6f-36a2dfa3e089Dino Dhttp://social.msdn.microsoft.com/Profile/en-US/?user=Dino%20D\r replaced in the deserialised xml<p>I am reading a string with carriage returns and new lines into a string.</p> <p>This string is later added to a xml, serialised, written to the db.</p> <p>And When I read the string again from db, deserialise it to the object,I see that \rs are missing.</p> <p>How can I preserver the \r?<br/><br/>Thanks</p>Thu, 12 Nov 2009 19:58:03 Z2009-11-12T19:58:04Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/0e89f271-41a9-484b-bd49-46a385663ba7http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/0e89f271-41a9-484b-bd49-46a385663ba7Froggy991http://social.msdn.microsoft.com/Profile/en-US/?user=Froggy991How to get the object being deserilizeHi, <div><br/></div> <div>I am trying to Set values using reflection under UnknownElement event.</div> <div><br/></div> <div>The problem is that I am getting the PerentNode in XmlElementEventArgs e.ObjectBeingDeserialized and not the root object I am trying to deserialize.</div> <div>The root object is also a singletone object if its matter.</div> <div><br/></div> <div>I need to know if theres a way to get the root object that is being deserialized. </div> <div><br/></div> <div>Code exmple (where the objectBeingDeserialized is the what I can't manage to get) </div> <div> <div> </div> <div> <pre lang="x-c#"> //try to find the appropriate collection property FieldInfo fInfo = <span style="font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal">objectBeingDeserialized</span>.GetType().GetField(fieldEntityName, BindingFlags.Instance | BindingFlags.NonPublic); //if the field exist if (fInfo != null) { //set value to field fInfo.SetValue(<span style="font-family:Verdana, Arial, Helvetica, sans-serif;white-space:normal">objectBeingDeserialized</span>, entity);<br/> } </pre> <br/></div> </div> <div><br/></div> <div>Any help will be mostly appriciated.</div> <div>Nir</div>Thu, 12 Nov 2009 07:30:10 Z2009-11-12T07:30:10Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/d5d4d148-0f0d-48d4-b19f-4308b0b46bdchttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/d5d4d148-0f0d-48d4-b19f-4308b0b46bdcjohnbsyshttp://social.msdn.microsoft.com/Profile/en-US/?user=johnbsysCalls always return Null when using SOAPExtension class<p>I am using a SOAPExtension to insert a SOAPHeader.  I can see the XML result come back correctly from the Web Service but it does not make it back to the original call results.  I get a null reference exception on the result after the call.<br/>----------------------------------------------------<br/>public class myExtension : SoapExtension<br/>    {<br/>        public bool outgoing = true;<br/>        public bool incoming = false;<br/>        public Stream oldStream;<br/>        public Stream newStream;<br/>        public Stream cvWireStream;<br/>        public Stream cvApplicationStream;<br/>       </p> <p>public override Stream ChainStream(Stream stream)<br/>        {<br/>            outputStream = stream;<br/>            oldStream = stream;<br/>            newStream = new MemoryStream();<br/>            return newStream;<br/>        }</p> <p>public string getXMLFromCache()<br/>        {<br/>            newStream.Position = 0; // start at the beginning!<br/>            string strSOAPresponse = ExtractFromStream(newStream);<br/>            return strSOAPresponse;<br/>        }</p> <p>private String ExtractFromStream(Stream target)<br/>        {<br/>            if (target != null)<br/>                return (new StreamReader(target)).ReadToEnd();<br/>            return &quot;&quot;;<br/>        }</p> <p>public class user : SoapHeader<br/>        {<br/>            public string name;<br/>            public string password;<br/>        }</p> <p>public override void ProcessMessage(SoapMessage message)<br/>        {<br/>            StreamReader readStr;<br/>            StreamWriter writeStr;<br/>            string soapMsg1 = &quot;&quot;;<br/>            XmlDocument xDoc = new XmlDocument();</p> <p><br/>            if (message.Stage == SoapMessageStage.BeforeSerialize)<br/>            {<br/>                var lvUser = new user();<br/>                lvUser.name = &quot;JOHN&quot;;<br/>                lvUser.password = &quot;TEST&quot;;<br/>                message.Headers.Add(lvUser);<br/>            }</p> <p>            if (message.Stage == SoapMessageStage.AfterSerialize)<br/>            {               <br/>                newStream.Position = 0;<br/>                Copy(newStream, oldStream);<br/>            }</p> <p>            if (message.Stage == SoapMessageStage.BeforeDeserialize)<br/>            {<br/>                Copy(oldStream, newStream);<br/>                newStream.Position = 0;<br/>            }</p> <p>            if (message.Stage == SoapMessageStage.AfterDeserialize)<br/>            {<br/>                String soapBodyString = getXMLFromCache();    //<strong>&lt;&lt;---- SoapBodyString shows returned ReceiptURL1 XML correctly</strong><br/>                object TEST = message.GetReturnValue();       //<strong>&lt;&lt;---- TEST shows NULL</strong><br/>            }<br/>         }<br/>      }</p> <p>----------------------------------------------------------------------------------------------</p> <p> public string GetReceiptURL(string pvReceiptNumber)<br/>        {<br/>            var lvReceiptURLRequest = new ReceiptURLByReceiptRequest();<br/>            lvReceiptURLRequest.receiptNumber = pvReceiptNumber;<br/>            var lvReceiptURL = new ReceiptURL();            <br/>            var lveRETRService = new eRETRService();<br/>            lveRETRService.Url = cvWebSite;<br/>            try<br/>            {<br/>                lvReceiptURL = lveRETRService.getReceiptURLByReceipt(lvReceiptURLRequest);  //<strong>&lt;&lt;---- Call to Web Service</strong>  <br/><br/><strong>** lvReceiptURL comes back as Null</strong>  <br/>    <br/>            }<br/>            catch (Exception Ex)<br/>            {<br/>                MessageBox.Show(Ex.Message);<br/>                return &quot;&quot;;<br/>            }<br/>            return lvReceiptURL.ReceiptURL1;  //<strong>&lt;&lt;---- This is always coming back as NULL even though I can see it in the AfterDeserialize event</strong>----&gt;&gt;<br/>        }</p>Tue, 10 Nov 2009 19:31:00 Z2009-11-11T16:26:06Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/732a5d2e-636a-4093-9884-1b1edf248bdfhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/732a5d2e-636a-4093-9884-1b1edf248bdfWood-MSDNhttp://social.msdn.microsoft.com/Profile/en-US/?user=Wood-MSDNERROR_NO_DATA was thrown sometimes by web service/SOAPI've a web service on machine A which also has a WS client (for my experiment purpose). If I keep looping to call a WS foo(), occasionally I will get ERROR_NO_DATA HResult from the service. What is the reason and how do I eliminate this exception at all, if possible? <br/><br/>Any pointer is appreicated. <br/><br/>Thanks.Fri, 06 Nov 2009 05:23:29 Z2009-11-11T16:00:05Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/133562e9-21b9-4cea-ab6b-636a77e2193chttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/133562e9-21b9-4cea-ab6b-636a77e2193cjennethttp://social.msdn.microsoft.com/Profile/en-US/?user=jennetDeserializing a node which has the xsi:type specifiedHi<br/> <br/> This isn't in relation to ASMX web services, but is a XMLSerializer problem so I hope I've got the correct forum.<br/> <br/> Basically I have a simple custom object which is for a value in my database. I've defined it like this:<br/> public class PropertyValue<br/>     {<br/>         [XmlAttribute(&quot;type&quot;, Namespace = &quot;http://www.w3.org/2001/XMLSchema-instance&quot;)]<br/>         public string Type { get; set; }<br/>         <br/>         [XmlText]<br/>         public string Text { get; set; }<br/>     }<br/> <br/> and it's used as the property of another object :<br/> [XmlRoot(ElementName = &quot;Property&quot;)]<br/>     public class MyProperty : MyListItem<br/>     {<br/>         [XmlAttribute]<br/>         public String Address { get; set; }<br/>         <br/>        .....<br/>         <br/>         [XmlElement]<br/>         public PropertyValue Value { get; set; }<br/> <br/>        .....<br/>     }<br/> <br/> When returning the details from the database I use the xml serializer to change the objects into xml and it spits out code like this:<br/> &lt;Property Address=&quot;this is the address&quot;&gt;<br/> ......<br/> &lt;Value xsi:type=&quot;http://www.w3.org/2001/XMLSchema#decimal&quot;&gt;3.14159265358979&lt;/Value&gt;<br/> ....<br/> &lt;/Property&gt;<br/> <br/> Which is what I was wanting - but the problem is that I also need to accept xml (this method is part of a WCF operation) and deserialize it back into the object. My WCF operation accepts a stream which is the xml, and *should* deserialize but bugs out.<br/> If I pass in this:<br/> &lt;Property&gt;<br/> ...<br/> &lt;Value xsi:type=&quot;http://www.w3.org/2001/XMLSchema#decimal&quot;&gt;3.14159265358979&lt;/Value&gt;<br/> &lt;/Property&gt;<br/> I get error &quot;Undefined namespace &quot;xsi&quot;.<br/> <br/> If I change to this:<br/> &lt;Property xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;<br/> ...<br/> &lt;Value xsi:type=&quot;http://www.w3.org/2001/XMLSchema#decimal&quot;&gt;3.14159265358979&lt;/Value&gt;<br/> &lt;/Property&gt;<br/> I get error &quot;undefined namespace &quot;http&quot; (which really confuses me)<br/> <br/> If I remove and just use &quot;type&quot; as below, if deserializes without error but the Type property of the PropertyValue object is null.<br/> &lt;Property&gt;<br/> ...<br/> &lt;Value type=&quot;http://www.w3.org/2001/XMLSchema#decimal&quot;&gt;3.14159265358979&lt;/Value&gt;<br/> &lt;/Property&gt;<br/> <br/> My deserialization test code is:<br/> [Test]<br/>         public void TestDeser()<br/>         {<br/>             string dataType = &quot;http://www.w3.org/2001/XMLSchema#decimal&quot;;<br/>             string value = Math.PI.ToString();<br/> <br/>             string xmlstring = string.Format(<br/>                     @&quot;&lt;Property xmlns:xsi=&quot;&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&quot;&gt;&lt;Value xsi:type=&quot;&quot;{1}&quot;&quot;&gt;{2}&lt;/Value&gt;&lt;Scope/&gt;&lt;/Property&gt;&quot;, propTypeSi, dataType, value);<br/> <br/>             Stream s = new MemoryStream(Encoding.Default.GetBytes(xmlstring2));<br/> <br/>             Type type = typeof (MyPropery);<br/>             var xser = new XmlSerializer(type);<br/> <br/>             var output = xser.Deserialize(s) as MyListItem; <br/>             var prop = output as MyProperty;<br/>             //if we've managed to get this far I still end up with prop.Value.Type = null<br/> }<br/> <br/> I'm stuck! If anyone could help I'd really appreciate it!Wed, 11 Nov 2009 11:13:52 Z2009-11-11T11:13:54Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/e44c754c-cc8d-412e-bb2c-ee38dc39cb9ehttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/e44c754c-cc8d-412e-bb2c-ee38dc39cb9eSimonTeWhttp://social.msdn.microsoft.com/Profile/en-US/?user=SimonTeWData Compression when Uploading to ASP.NET 2.0 Web ServiceHi <br/><br/>I think I have a problem that hasn't been covered in this forum before: Is it possible to implement data compression in ASP.NET 2.0 web services when <strong>uploading</strong> data to the web service from a client?  We are using HTTP POST not SOAP to transmit the data.<br/><br/>Background: I'm dealing with a server-side application that allows handheld devices to upload scanned barcodes via an ASP.NET 2.0 web service.  99% of the traffic is going from the handheld devices to the server - up to 500,000 scanned barcodes a day.<br/><br/>We ditiched SOAP in favour of HTTP POST to get the sizes of the messages down.  Each message is fairly short (a few hundred bytes) and we found the overhead of all those SOAP headers markedly increased the message size.  The reason we want to get the message size down as much as possible is that the data is sent over a cellular network.  The network operator charges on the total amount of data sent, not on the number of messages.<br/><br/>The guys who write the code for the handhelds (in Visual C++) say they will have no problem implementing data compression.  I just have to figure out how to decompress it at the server side.  <br/><br/>All the posts I've found on this forum, and other articles I've seen on the web, deal with compression when downloading data, not uploading it.  I assume decompressing data is possible on the server side but how difficult is it?  Does it just involve some simple setting like AutomaticDecompression, or perhaps creating a derived class from System.Web.Services.WebService (and then deriving the web service classes from that derived class), or does it involve something more complicated?<br/><br/>Cheers<br/>Simon<br/>Tue, 10 Nov 2009 21:00:22 Z2009-11-10T21:00:24Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/ba2023cb-042f-4e1d-b2cf-09300b1f30e0http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/ba2023cb-042f-4e1d-b2cf-09300b1f30e0Terry Mohrehttp://social.msdn.microsoft.com/Profile/en-US/?user=Terry%20MohreSoapHttpClientProtocol CancelAsync how does one make this work?Hello, <div>How do you cancel an Async method call to a web service?</div> <div><br/></div> <div>We have a web proxy which calls a web method on our web service.</div> <div>The web method UploadEncounter uploads a byte array from the client application to the web service server.</div> <div>We wish to cancel this upload either by a User action (button press) or in reaction to a timeout with in the application.</div> <div><br/></div> <div>We have had no success when calling the proxy's Abort() or <span style="font-family:Arial;font-size:13px;white-space:pre">CancelAsync.</span></div> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre">The registered callback shows the Cancel being completed or the Abort occurring yet the data of the byte array still continues to be transfered to the sever via the web service.</span></span></div> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre">The web proxy class</span></span></div> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre"><br/></span></span></div> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre"> public partial class DataSync : System.Web.Services.Protocols.SoapHttpClientProtocol</span></span></div> <div><span style="font-family:Arial;font-size:small"><span style="font-size:13px;white-space:pre"><br/></span></span></div> <div>The function in the web proxy </div> <div> <div> public void UploadEncounter(byte[] bytes, string vchClientId, bool bProcess, object userState) {</div> <div>            if ((this.UploadEncounterOperationCompleted == null)) {</div> <div>                this.UploadEncounterOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUploadEncounterOperationCompleted);</div> <div>            }</div> <div>            this.InvokeAsync(&quot;UploadEncounter&quot;, new object[] {</div> <div>                        bytes,</div> <div>                        vchClientId,</div> <div>                        bProcess}, this.UploadEncounterOperationCompleted, userState);</div> <div>        }</div> </div> <div>The operation completed function</div> <div> <div>   private void OnUploadEncounterStressOperationCompleted(object arg) {</div> <div>            if ((this.UploadEncounterStressCompleted != null)) {</div> <div>                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));</div> <div>                this.UploadEncounterStressCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));</div> <div>            }</div> <div>        }</div> <div><br/></div> <div><br/></div> <div>The application calls</div> <div>                 // datasync web proxy class</div> <div> <div>                datasync.UploadEncounterStressAsync(buffer, &quot;AsyncStressTest&quot;, false, &quot;&lt;&lt;WG&gt;&gt;&quot;); </div> <div>                datasync.UploadEncounterStressCompleted += new UploadEncounterStressCompletedEventHandler(datasync_UploadEncounterStressCompleted);</div> <div><br/></div> <div><br/></div> <div>the callback handler</div> <div> <div>        void datasync_UploadEncounterStressCompleted(object sender, AsyncCompletedEventArgs e)</div> <div>        {</div> <div>//WE unhook the handler</div> <div>            datasync.UploadEncounterStressCompleted -= datasync_UploadEncounterStressCompleted;</div> <div><br/></div> <div>// WE write a log here to report the returned stats</div> <div>                TextLog(string.Format(&quot;Returned Upload Encounter{0}   # {1} of {2} \t Time {3} Milliseconds \t Cancelled {4} \t Error = {5}   &quot;, </div> <div>                                                    EncounterId,</div> <div>                                                    success, </div> <div>                                                    total, </div> <div>                                                    ts.TotalMilliseconds ,e.Cancelled.ToString(),(e.Error != null) ? e.Error.ToString():&quot;No Error&quot;</div> <div>                                                    ));</div> <div>        }</div> <div>// handles a button press from the user to cancel the upload</div> </div> <div> <div>        private void btHaltTest1_Click(object sender, EventArgs e)</div> <div>        {</div> <div>        </div> <div>// Attempts to Cancel return a success but the data continues to the server!!!!</div> <div>          datasync.CancelAsync(&quot;&lt;&lt;WG&gt;&gt;&quot;);// call the web proxy's CancelAsync</div> <div>// Attempts to Abort return a exeception but the data continues to the server!!!!</div> <div>//uncomment           datasync.Abort(); // or call the web proxy Abort</div> <div>// we report to a log </div> <div>            TextLog(string.Format(&quot;Canceled UploadEncounter Encounter {0} \t Time Taken {1} milliseconds&quot;, EncounterId, ts.TotalMilliseconds));</div> <div>            </div> <div>        }</div> <div>thanks</div> <div>Terry</div> </div> </div> </div>Tue, 10 Nov 2009 20:30:34 Z2009-11-10T20:30:37Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/e3c2e002-93e1-45a2-b5dc-72232a3fc81chttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/e3c2e002-93e1-45a2-b5dc-72232a3fc81cTrysthttp://social.msdn.microsoft.com/Profile/en-US/?user=TrystRemoving namespaces on child elements from serialised objectHi all,<br/> <br/> I am serialising a collection types and on the attributes, which have been serialised as child elements, and each of these child elements has the default namespace on them (<strong class=ns>http://tempuri.org/</strong> ). Now I know these has come down from the object that has been serialised, but is there anyway I can remove these namespaces (or replace then) during the serialisation process?<br/> <br/> The XML output I am getting is as follows...<br/> <br/> <pre lang=x-xml>&lt;SearchCompany&gt; &lt;Company_ID xmlns=&quot;http://tempuri.org/&quot;&gt;98838401&lt;/Company_ID&gt; &lt;CompanyName xmlns=&quot;http://tempuri.org/&quot;&gt;3X Bankprojekt GmbH&lt;/CompanyName&gt; &lt;CompanyNumber xmlns=&quot;http://tempuri.org/&quot;&gt;510620&lt;/CompanyNumber&gt; &lt;CompanyStatus xmlns=&quot;http://tempuri.org/&quot;&gt;active&lt;/CompanyStatus&gt; &lt;Street xmlns=&quot;http://tempuri.org/&quot;&gt;St.-Martinus-Str. 3&lt;/Street&gt; &lt;City xmlns=&quot;http://tempuri.org/&quot;&gt;Ellwangen&lt;/City&gt; &lt;Postalcode xmlns=&quot;http://tempuri.org/&quot;&gt;73479&lt;/Postalcode&gt; &lt;LastAccountsDate xmlns=&quot;http://tempuri.org/&quot;&gt;0&lt;/LastAccountsDate&gt; &lt;CreditScore xmlns=&quot;http://tempuri.org/&quot;&gt;0&lt;/CreditScore&gt; &lt;/SearchCompany&gt; </pre> Thanks in advance.<br/> <br/> Tryst<br/> <br/><hr class="sig">TrystSat, 07 Nov 2009 22:05:26 Z2009-11-09T19:33:24Zhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/3a993e91-a0bc-48e5-baad-ecd39f36ef3fhttp://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/3a993e91-a0bc-48e5-baad-ecd39f36ef3fTrysthttp://social.msdn.microsoft.com/Profile/en-US/?user=TrystHow do you apply XmlWriterSettings to a XmlTextWriter object?How can you apply an XmlWriterSettings object to a XmlTextWriter object? There is no parameter in the XmlTextWriter constructor that takes an instance <br/> of XmlWriterSettings, and when you try to assign to the Settings property of the XmlTextWriter object I can't, as it is read only :-s<br/> <br/> My code is as follows...<br/> <br/> <pre lang="x-c#">XmlWriterSettings objXmlWriterSettings = new XmlWriterSettings(); objXmlWriterSettings.Indent = true; objXmlWriterSettings.OmitXmlDeclaration = false; using (XmlTextWriter objXmlWriter = new XmlTextWriter(string.Format(&quot;{0}{1}&quot;, RootPath, TransformationResultsXmlPath), null)) { objXmlWriter.Formatting = Formatting.Indented; objXslTransform.Load(string.Format(&quot;{0}{1}&quot;, RootPath, TransformationXsltPath)); objXslTransform.Transform(objXpathDoc, null, objXmlWriter); }</pre><hr class="sig">TrystSun, 08 Nov 2009 18:47:34 Z2009-11-09T19:06:26Z