Posts

Showing posts with the label wsdl

2-Way SSL for WCF Web Service Hosted on IIS

I recently was involved in getting the above to work in our environment. The steps follows: Ensure that the SSL certificates are correctly signed Ensure that the SSL certificate chain is present and valid Install the certificates in the “Current User” account for validation Execute mmc.exe, add “Certificates” snap-in with “My user account” Install the certificate within “Personal” store Verify by using Internet Explorer to retrieve the WSDL from the remote web service If the certificate and chain are correct, Internet Explorer will validate them and report so with “Certificate is OK” Install the certificates (and the entire chain) in the “Local Computer” account Execute mmc.exe, add “Certificates” snap-in with “Computer account” Install the certificate within “Personal” store Note the thumbprint of the certificate Configure the WCF web.config to make use of “Client Certificates” by finding the certificate within the “LocalMachine” using the thumbprint (remove the spac...

Developing ASMX Web Services and Controlling the Generated WSDL

Microsoft has made the development of web services very simple for developers who use Visual Studio. Add a web service project and the basic plumbing code is generated! Many developers do not know what goes behind the hood or how to customise the generated WSDL when required. I’ve listed some salient ones that may be of help… Apply [WebService(Namespace = " http://www.johannes.org/webservice/2011/11/03/ ",Name=" ExtendingWebService ", Description=" version 1.0 ")] to the class to get these: < wsdl : definitions targetNamespace = "http://www.johannes.org/webservice/2011/11/03/" > < wsdl : documentation > version 1.0 </ wsdl : documentation > ... < wsdl : service name = "ExtendingWebService" > Apply [WebMethod(Description=" This web service is a typical one ")] to the operation to get this: < wsdl : operation name = "..." > < wsdl : documentation > This web service is a...

Understanding the WSDL File

Image
Due to the maturity of Web Services toolkits, many developers do not make the effort to understand and interpret the WSDL file. This is especially so in a code-first development environment where the WSDL is automatically generated. For those who cannot afford time to read the specifications , I’ve tried to summarise the salient concepts for both WSDL 1.1 and WSDL 2.0 in the following UML Class Diagrams. In the following diagrams, the colour annotations follows: Blue denotes type/ schema definitions Orange denotes abstract interface definitions Yellow denotes concrete definitions Green denotes message definitions WSDL 1.1 Concept Model   WSDL 2.0 Conceptual Model You should note that the main differences between 1.1 and 2.0 are: Definition is now Description PortType is now Interface Message definitions have been deprecated and so have the message bindings Port is now EndPoint Address, formerly a standalone element, is now an attribute of EndPoint Fault is ...

Use and abuse of the .NET DataSet

Here are some facts about the DataSet that ones needs to be aware of. A DataSet: is up to 30x less performant than a DataReader (refer here ) – the disparity in performance increases as more records are retrieved represents an in-memory database for the application (supports keys, relationships, validation, etc.) can be either strongly-typed or un-typed is a provider-neutral data representation is a dis-connected data object supports edits and updates as well as random access can be sorted, filtered can be very easily bound to UI controls has excellent integration with XML (serialisation to and from XML) Appropriate Use Cases DataSets are often abused and thus discouraged from use. However, they can be useful in the following scenarios: Need for a dis-connected data object that is to be batch-edited, separately updated and subsequently synchronised with the database. Although ideal for OCC or desktop client, this is also possible for a web application with a session-based DataSe...

Web Services Versioning

You’ve developed the killer web service for your own consumption. You thought that sharing it with others would have been the best thing to do…You give out the WSDL and now, your service consumers are loving it! Weeks and months went by, you need to enhance the application and ripple some of the changes to your killer web service. Now what? Two types of changes There are ( backward-) compatible changes and there are incompatible changes. Examples of compatible ones (these are typically additive changes): Abstract Definitions adding new optional XML schema element or attribute declaration to an existing message definition < xsd : complexType ... > < xsd : sequence > < xsd : element ... /> < xsd : element ... /> < xsd : element ... minOccurs = "0" /> </ xsd : sequence > </ xsd : complexType > adding wildcards (i.e. xsd:any or xsd:anyAttribute) to an existing message definition < xsd : any names...

asmx .NET Web Service Nuances

When the WSDL specifies that the minimum occurrence of certain elements is zero, the .NET WSDL proxy generator will generate 2 properties for that element (instead of 1). On top of what usually gets generated – a property named according to the XML element – the generator creates another property named Specified of Boolean type. As an example: the WSDL specifies an XML element named policy of type string with minimum occurrence of zero. <xs:element minOccurs=”0” name=”policy” type=”xs:string” /> The generated proxy code will have a read/ write property named policy as expected public string policy {    get { return _policy; }    set { _policy = value; } } Due to the minimum occurrence constraint, another read/ write property named policySpecified will be generated. public bool policySpecified {    get { return _policySpecified; }    set { _policySpecified = value; } } The use of this property is to indicate to the framework that the parti...