TechBubbles

Archive for the 'Webservices' Category

WCF Service using ASP.NET AJAX Library

More often, the data to shown in an AJAX page is retrieved from the Web server using a Web service, a Windows Communication Foundation (WCF) service. The services that can also return JavaScriptObjectNotation(JSON) are potential candidates for AJAX pages.

This post explains about calling a WCF service using ASP.NET AJAX Library Data View control. The following are the steps to create and call the service using ASP.NET AJAX Library.

1. Creating a AJAX enabled WCF service

2. Loading the required scripts

3. Calling a service using ASP.NET AJAX Data View Control

Read more

Related Posts:

1 comment

REST and SOAP

Which is better SOAP or REST? One of the most common discussions. Both REST and SOAP are different approaches in writing the service oriented applications. REST is an architectural style for building client-server applications. SOAP is a protocol for exchanging data between two endpoints.

                                                    webservice

Read more

Related Posts:

1 comment

.NET Access Control Service

My previous article explained the basics of building windows azure services. Let’s start looking at the .NET Access Control Service. .NET Access Control Service allows you to use the authentication and authorization services from external sources that are maintained by security experts. Security experts control the authentication and issue the token to the application. Application just uses those tokens by avoiding the authentication process.

access_control1

Read more

Related Posts:

  • No Related Posts
No comments

Building Windows Azure Services

Introduction

Microsoft introduced cloud platform officially known as Azure Services Platform.It makes easy for .NET Developers to move their applications to the cloud using same tools and API’s they’re already familiar with. It provides highly-scalable execution environment for running .NET Applications and storing data in Microsoft data centers throughout the world.

WindowsAzure

Read more

Related Posts:

No comments

The .NET Service Bus With Example

You need to open an account with the .NET Service Bus, and need to use the .NET Service Bus administration Web site to create a new solution. You can open an account by visiting the following link http://portal.ex.azure.microsoft.com/. More about The .NET Service Bus can be found here.

AzureService

Read more

Related Posts:

1 comment

The .NET Service Bus

Introduction

The .NET Service bus is a powerful and useful feature from Windows Azure Cloud Computing. The .NET Service bus is designed to address the connectivity issues in advanced communication scenarios. The main issue it addresses is Internet connectivity. This post explains how it addresses these issues in real world.

Internet Connectivity Challenge

InternetConnectivity

Read more

Related Posts:

1 comment

Validating XML Document Using XSD in C#.NET

Introduction

This post explains how to apply  XML Schema Definition Language(XSD) to Extensible Markup Language (XML) document. Basics of XSD.

Create an XML Document

  1. Start Visual Studio .NET
  2. Create a new XML File.
  3. Add the following data to the XML Document
<Employee EmployeeID="123">
   <EmployeeName>James Bond</EmployeeName>
</Employee>

  4.  Save the file as Employee.xml file 

Create the XSD Schema, and Link to XML Document

1. Start Visual Studio .NET

2. Create a new empty text file

3. Add the following XSD Schema definitions to describe the XML document.

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:element name="Employee">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element name="EmployeeName" type="xsd:string"/>
         </xsd:sequence>
         <xsd:attribute name="EmployeeID" use="required" type="xsd:int"/>
      </xsd:complexType>
   </xsd:element>
</xsd:schema>

4. Save the file as Employee.xsd 
5. Open the original Employee.xml file, and link it to the XSD schema as follows
<?xml version="1.0"?>
<Employee EmployeeID="123"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="Employee.xsd">
   <EmployeeName>Rugby jersey</EmployeeName>
</Employee>

6. Save the modified xml as EmployeeWithXSD.xml.

Validate XML Document

1. Load the EmployeeWithXSD.xml using XmlTextReader as follows:

XmlTextReader r = new XmlTextReader("C:\\EmployeeWithXSD.xml");
XmlValidatingReader v = new XmlValidatingReader(r);
v.ValidationType = ValidationType.Schema;
v.ValidationEventHandler +=
   new ValidationEventHandler(MyValidationEventHandler);
while (v.Read())
{
   // Can add code here to process the content.
}
v.Close();

// Check whether the document is valid or invalid.
if (isValid)
   Console.WriteLine("Document is valid");
else
   Console.WriteLine("Document is invalid");
public static void MyValidationEventHandler(object sender,
                                            ValidationEventArgs args)
{
   isValid = false;
   Console.WriteLine("Validation event\n" + args.Message);
}

2. Build and run the application to use the XSD schema to validate the XML 

    document.

Related Posts:

4 comments

XML Schema Basics(XSD)

Introduction

This post gives a basic overview of XML Schema and how to use in development. XML schema describes what XML document contains and content of the XML document what fields and sub elements it can contain.

Standards for Describing XML Document

  • DTD : was the First formulized standard.
  • XDR: Much comprehensive standard than DTD.
  • XSD: Currently de facto standard for describing the XML documents. There are two versions in use 1.0 and 1.1. An XSD schema it self is a XML document.

XSD Elements

Elements are building blocks for any XML document, element defines the structure of the XML document. The following is the syntax to define the element in XSD Schema.

Example:

<xs: element name=”abc” type=”xyz” /> 

  1. An Element must have the name property, the same will appear in the XML document.
  2. Type property describes about what can be contained in the element when it appears in XML document. eg: xs:string, xs:integer, xs:boolean or xs:date

Example:

Sample XSD

<xs:element name="Employee_dob"
                    type="xs:date"/>

Sample XML

<Employee_dob>
     2000-01-12T12:13:14Z
</Employee_dob>

Fixed and Default Properties

The XSD element can contain the Fixed or Default properties.

Default means that if no value specified in the XML document then application uses the default value specified in the XSD document.

Example:

<xs:element name="Employee_name" type="xs:string" default="unknown"/>

Fixed means the value in the XML document can only have the value specified in the XSD.

Example:

<xs:element name="Customer_location" type="xs:string" fixed="UK"/> 

Cardinality

Specifies how many times an element can appear can be called Cardinality. it is specified using the attributes minOccurs and maxOccurs. Both attributes can assigned a non-negative value.

The default value for minOccurs and maxOccurs is 1.

Example:

<xs:element name="Employee_hobbies"

                    type="xs:string"

                    minOccurs="2"

                    maxOccurs="10"/>

 

Employee_hobbies element must appear at least twice and not more than 10 times in the XML document.

 

Simple Types

We can define our own types by modifying the existing types.

example: Define a code, that may be an integer with a max limit.

<xs:element name="Employee" type="xs:string"/> 
Complex Types:  is a container for other elements which specifies child
elements an element can contain.
Example:
<xs:element name="Employee">
    <xs:complexType>
            <xs:sequence>
                <xs:element name="Dob" type="xs:date" />
                <xs:element name="Address" type="xs:string" />
            </xs:sequence>
        </xs:complexType>
</xs:element> 
  1. Created a definition for element Employee
  2. <xs:complexType> is a container for other <xs:elements>
  3. Complex type do not have the type attribute and contains the <xs:sequence> element.
  4. The sequence element specifies that XML document must appear in the same order they are declared in the XSD Schema.
<Employee>
    <Dob> 2000-01-12T12:13:14Z </Dob>
    <Address> 39 spring field road London </Address>
</Employee>

Related Posts:

2 comments

WSE Settings 3.0 Tool

The WSE features can be enabled by using WSE 3.0 tool which is a graphical user interface in visual studio 2005. You have to download the WSE 3.0 for .NET to configure the WSE 3.0 tool.

To open the WSE Settings 3.0 tool from Visual Studio 2005.

  1. Open the Solution or project that you want to use the WSE with.
  2. Right click the project point to WSE Settings 3.0 and click

  WSEsettings

To use the WSE settings 3.0 Tool from the start menu

1. Click Start, point to Microsoft WSE 3.0, and then click Configuration Tool.

WSEStart

Read more

Related Posts:

2 comments

Overview of WSE 3.0

Introduction

Web Services Enhancements is a .NET class library to develop web services using latest protocols.

Features

  • Securing the Web Services: It is difficult to secure a web service that cross the security domains. We can secure a web service by sending over secure transport, such as Secure Socket Layer(SSL) but that holds good when the communication is point-to-point. Some times SOAP message has to be routed to so many intermediaries before reaching the receiver. We can address this problem by Adding Security Credentials to SOAP Message.Alternatively we can digitalsign a SOAP Message using WSE.
  • Sending Large Amounts of Data Using WSE:  WSE 3.0 supports the MTOM Message Transmission Optimization Mechanism for sending large amount of data in a soap message. Enabling a Web service to Send and Receive Large amounts of data.    
  • SOAP Messages Routing: SOAP messages can be routed through intermediaries before it reaching to the destination. Routing SOAP Messages using WSE.
  • Hosting the Web services outside IIS: WSE enables ASP.NET web services to be hosted in console applications, windows services and COM+ components. Hosting Web service outside IIS.

Related Posts:

2 comments

Next Page »