Creating and Consuming XML Web Services #24

  • visual studio .net -> File Menu -> new project -> Visual Basic/C# projects -> ASP.Net Web Service -> The project will get created
  • Some Files as created: AssemblyInfo.cs/vb: sharing and reuse in the CLR, Web.config, service1.asmx, service1.asmx.cs/vb
  • Create web service methods in the asmx.vb/cs files. A sample web-service method is already there
  • Now you can build the project using the Build Solution option
  • You can start the application, using the start option in the debug menu
  • Check other short-notes as listed in: http://www.justetc.net/knowledge/index.php?table=Articles&categoryID=24 to know different aspects of web service programming
  • You can publish the web-service using the publish option in the popup menu from the solution explorer. or the publish option in the build menu
  • Then you are required to change some configuration in the IIS server such as give directory browsing permission, make the virtual directory an IIS application, provide execute permission
  • XML WebService Discovery Mechanism: enables a client application to locate or discover the documents that describe an XML Web Service
  • You may want to create a discovery file and deploy in your web-server so that clients can know your services and make use of them.
  • To create, client application for a web-service, first you have to have the permission to access, then you need to add a web-reference to that service from your application
  • Create a proxy class, create an object of that proxy class, call the web service methods using this proxy object
  • You may want to use serialization and deserialization while communicating with the web-services

From: http://sitestree.com/?p=5229
Categories:24
Tags:
Post Data:2007-12-19 00:46:24

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Advanced Topics in .Net XML Web Services #24

  • SOAP Extensions: “SOAP Extensions are components that can access the SOAP messages. Think of them as objects that sit on the HTTP pipeline who can pick the SOAP messages at each stage and manipulate them.

    When the HTTP request comes from the client, it is handled by aspnet_isapi.dll. The appropriate handler for web services will be called and the web method will be invoked. It is during this stage where the SOAP Extension comes into picture. The SOAP Extension can access the SOAP message before and after calling the web method. Thus we now know in a vague manner what a SOAP extension is and where it fits in the life cycle of a SOAP message.

    SOAP Extensions can be used for a number of purposes. They can be used to secure web services, compress the verbose SOAP messages, log messages etc. In this article, we will see how to encrypt the SOAP message and send it over the network using SOAP Extensions.

    “Reference:Securing web services using SOAP extensions

  • You can use the web.config file to configure the SOAP Extensions to use and the priority of the SOAP extensions.
  • Configuring and Securing a Web Service: You can use the following elements of the web.config file to Configure a Web Service:

    compilation: compilation language and debug mode
    customErrors: On off remoteonly
    authentication: set to Windows Forms Passport None
    authorization: set users attribute to * ? or similar
    trace: enable disable application level tracing
    globalization: set globalization settings

  • Authentication: Windows: default – Windows and IIS authenticationForms: Use HTML forms to collect login credentialsPassport: Use a third party centralized authentication service using keysNone: no authentication required
  • Authorization: example:

From: http://sitestree.com/?p=5228
Categories:24
Tags:
Post Data:2013-01-13 09:19:13

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Debugging in .Net, (XML Web Services) #24

May not make sense to all. Just listing some related notes.

  • Tools: DbgClr – GUI Based, CorDbg – command line based
  • You can use the debug menu. Start, Step Into, Step Over, New Breakpoint options – as available in most Good to great IDEs for debugging
  • Watch Window: Check the values of variables and expressions
  • Call Stack Window: Function and procedure calls currently on stack
  • Locals Window: Variables that are local to current context
  • Autos Window: Variables in the current statement and in the previous statement
  • Breakpoints Window: Function break point, file breakpoint, address breakpoint, data breakpoint. Gives information on breakpoints – name, condition, hit count
  • Debug XML Web-services: During Development: Place break points in the line where you want to start your debugging. Start the application, keep on executing, and come to the point where the breakpointed (never mind – my invention) statement will execute. Now you can use other windows (watch, call stack,..)
  • Debug XML Web-services: After Deployment: Open the XML webservice in IE, from visual studio debug menu select processes -> aspnet_wp.exe then select Common Language Runtime, select the program to debug, close process dialog box. From visual studio, open the code behind the file that you want to debug, then set breakpoints there
  • Debug Must: In the web.config file, set debug=true.
  • Along with debugging, you can use tracing to collect runtime information for debugging purpose.
  • Three types of Tracing: TextWriterTraceListener: Write messages to an object of the TextWriter class. EventlogTraceListener: Write messages to event logs. DefaultTraceListener: Send debug messages to the output window.
  • As tracing usually generates a lot of information, it’s better that you turn off tracing while you don’t intend to use it. Use TraceSwitch classes for the purpose

From: http://sitestree.com/?p=5226
Categories:24
Tags:
Post Data:2008-02-16 11:45:08

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Advanced XML Web Services Programming #24

Attributes of a web method. Using attributes, you can define the behavior of the methods exposed.
Syntax

VB.net

_
Public Function ….

C#
[WebMethod (BufferResponse=false)]public int HelloWorld(){……

Attributes:

  • BufferResponse: Should the response be buffered?
  • CacheDuration: Number of seconds the response is cached in memory
  • Description: Describe a web method
  • EnableSession: Should session state be enabled or not?
  • MessageName: Alias to a web method
  • TransactionOption: Transaction support for a web-method

Creating Asynchronous methods: later ……

From: http://sitestree.com/?p=5225
Categories:24
Tags:
Post Data:2011-05-16 15:16:30

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

XmlTextReader Overview #24

Overview of .Net XmlReader and XmlWriter Object

XmlReader

Can read XML data both from file or stream. Readonly access. Also, provides information about the XML data. XmlTextReader class is derived from XmlReader. It provides faster access to XML data though it does not support validating DTD or XML schema. XmlValidatingReader class supports both DTD and schema validation. Attributes of XmlTextWriter class areAttributeCount,Depth,HasAttributes,HasValue,IsEmptyElement, Item,Value. Some methods are: IsStartElement, MoveToElement, MoveToFirstAttribute, MoveToNextAttribute, Read, ReadAttributeValue, ReadString, ReadStartElement, ReadEndElement, Skip

Example
   dim reader as New XmlTextReader("")   while reader.Read() select case reader.Nodetype     case XmlNodeType.Element            Console.Write("")   if reader.HasAttributes then   while reader.movetonextAttribute()   Console.Write(reader.value)   End While   end if  case XmlNodeType.Text Console.Write(reader.value)       case XmlNodeType.EndElement   Console.WriteLine("")end selectend while

From: http://sitestree.com/?p=4748
Categories:24
Tags:
Post Data:2011-10-11 17:18:58

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Overview of XML programming in Dot Net #24

Overview of XML programming in Dot Net

XML DOM(Document Object Model)

Three ways to read XML documents in dot net are: XML DOM, SAX, XMLReader.DOM loads entire XML data into memory for processing, it is both read-write, I mean you can change XML data and save. DOM uses data-structures to represent the data in the RAM.

SAX does not load all XML data in memory rather processes sequentially. SAX is good for just reading large XML file/data but as it does not store the data in the RAM and does not use any data structure, it can not perform complex operations(search) on the data.

XmlReader class of the .net framework can also be used to read and process xml data. It provides read only and forward only access.

How XML DOM works?

The root node of an XML document is represented by the XmlDocument. XmlDocument is derived from XmlNode class. XmlDocument provides methods such as Load(Load XML data from file), LoadXml(takes XML string as parameter to load), and Save(to save XML data into a file). Also, you can use XmlDocument to traverse through the XML data and process/print

Example code:Vb.net

dim xmlDo as New XmlDocument

xmlDoc.load(emp.xml);//or xmlDoc.loadXml(“”);

Console.WriteLine(xmlDoc.InnerXml.ToString)

xmlDoc.save(“newDoc.xml”);

C#

XmlDocument xmlDoc = New XmlDocument();

xmlDoc.load(emp.xml);//or xmlDoc.loadXml(“”);

Console.WriteLine(xmlDoc.InnerXml.ToString())

xmlDoc.save(“newDoc.xml”);

Parsing an XML document

————————

C#

count=0;

i=1;

XmlNode node=xmlDoc.ChildNodes[1];

foreach(XmlNode node1 in node.ChildNodes)

{

foreach(XmlNode node2 in node1.ChildNodes)

{

Console.WriteLine(xmlDoc.DocumentElement.FirstChild.ChildNodes[count].Name+”:”+node2.FirstChild.Value); count = count + 1;

}

i=i+1;

count=0;

}

count =0

i=1

dim node1 as XmlNode;

node1 = xmlDoc.ChildNodes(1)

foreach node1 in node1.ChildNodes

dim node2 as XmlNode

foreach node2 in node1.ChildNodes

xmlDoc.DocumentElement.FirstChild.ChildNodes(count).Name +”:”+node2.FirstChild.value

next

i=1+1

count=0

next

———- From: http://sitestree.com/?p=4747
Categories:24
Tags:
Post Data:2011-04-21 04:17:46

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Quick guide to RPM (Red Hat Package Manager) #26

Quick Guide to RPM

RPM-Red Hat Package Manager

Caldera, Suse, Fedora also use RPM

  1. rpm -qa | more

to check the installed software in the system

q=query

a=list

  1. rpm -qi faq

Query individual package

q=query

i=requires a package name

faq=the package

  1. rpm -ql faq

List all the files for the package faq

q=query

l=list files

faq=package name

  1. rpm -ivh xapp-1.1.0.i386.rpm

install a package

i=install

v=verbose

h=show progress with hash

  1. rpm -e faq

remove package

-e = erase

  1. rpm -e –nodeps faq

erase without checking any dependancy

may cause some other packages to fail

  1. rpm -Va

Verify all of the files on your system.

  1. rpm -qf /usr/bin/uptime

check a file for its source/package

  1. rpm -ivh –force pack-1.0.0.i386.rpm

sometimes you will need it. When you go to install, you may get ‘already installed’ message, if you want to remove you may get ‘not installed’ message, –force is the solution.

  1. rpm -ivh –nodeps pack-1.0.0.i386.rpm

install without checking dependencies

[may not be a very good thing sometimes] From: http://sitestree.com/?p=4750
Categories:26
Tags:
Post Data:2006-11-30 22:11:36

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Build RPM Package #26

Check the tutorial below for a detail discussionhttp://www.rpm.org/max-rpm/ From: http://sitestree.com/?p=4749
Categories:26
Tags:
Post Data:2010-08-25 17:48:18

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

How to create a RPM package in Linux #26 #RHCSA

How to create a RPM package in Linux

Creating basic installation RPM package is really easy. You just have to use rpmbuild command. rpmbuild will be applied to your source files and a RPM package will be created [all source files will be included in the RPM package]. Somewhere you need to specify the path of your source files. Just before creating the RPM package, your source files will be copied to a temporary location [termed as Build Root]. Actually, you need to write a spec file. rpmbuild will read that file to extract parameters and will act based on the parameter values.

Sample RPM Package

Summary: A summary description of the software.
Name: xyz
Version: 1.0.0
Release: 1
Group: System Environment/Base
BuildRoot: /var/tmp/%{name}-buildroot
Prefix:/opt/xyz
%description
Description of your software
%pre%prep%build%installrm -rf /opt/xyz/$RPM_BUILD_ROOTmkdir -p /opt/xyz/$RPM_BUILD_ROOT/dir1mkdir -p /opt/xyz/$RPM_BUILD_ROOT/dir2cp -r your_source_files_path/* /opt/xyz/$RPM_BUILD_ROOT/%post%cleanrm -rf /opt/xyz/$RPM_BUILD_ROOT%files%defattr(-,root,root)/opt/xyz/dir1/opt/xyz/dir2

In the example, BuildRoot is assigned to: /var/tmp/%{name}-buildroot. %install section is doing the building/creation of the RPM package. From Summary to %description are the headers to specify different information as the names indicate. %install section is creating the directories needed and copying your source files to BuildRoot directory(cp -r your_source_files_path/* /opt/xyz/$RPM_BUILD_ROOT/). %files section specifies where rpm package will install your software.%clean section just cleans the BuildRoot directory after the RPM package is created.

Just a note: As I mentioned Prefix to be /opt/xyz, I provided /opt/xyz in the paths. If you keep Prefix to be null, then you need to remove /opt/xyz from the paths. You can place shell commands under %pre section. These command will run just before the RPM package is being installed(using rpm -i command). Under %post section, you can also place some shell commands that will run immediately after the software installation(using rpm -i command). You can use %preor %post section for operations like creating databases, users, and assigning permissions

This may not be 100% perfect. I did not test it on any system, but it should be almost ok. For another example, please visit: http://www.redhat.com/magazine/002dec04/features/betterliving-part2/

The spec file should have name of type name-version_release.spec. After creating the spec file, run the command rpmbuild -ba the_spec_file_name. It will create rpm packages under /usr/src/redhat/BUILD/x86_64 and /usr/src/redhat/SRPMS. You need to copy the spec file under /usr/src/redhat/SPECS/

To install the created RPM package, use rpm -ivh rpmpackagename.rpm command. Look %files section to know where the software will be installed. You can change the path using commands like:rpm -ivh –prefix /opt/rty/ rpmpackagename.rpm. Check our guide on rpm command From: http://sitestree.com/?p=4751
Categories:26, RHCSA
Tags:
Post Data:2009-01-06 06:48:45

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>

Overview on Windows Azure Cloud – Demo for inside Azure – what can you do with Windows Azure #27

Overview on Windows Azure Cloud – Demo for inside Azure – what can you do with Windows Azure. Overview on Windows Azure Cloud – Demo for inside Azure – what can you do with Windows Azure From: http://sitestree.com/?p=5347
Categories:27
Tags:
Post Data:2008-03-19 09:38:37

    Shop Online: <a href='https://www.ShopForSoul.com/' target='new' rel="noopener">https://www.ShopForSoul.com/</a>
    (Big Data, Cloud, Security, Machine Learning): Courses: <a href='http://Training.SitesTree.com' target='new' rel="noopener"> http://Training.SitesTree.com</a> 
    In Bengali: <a href='http://Bangla.SaLearningSchool.com' target='new' rel="noopener">http://Bangla.SaLearningSchool.com</a>
    <a href='http://SitesTree.com' target='new' rel="noopener">http://SitesTree.com</a>
    8112223 Canada Inc./JustEtc: <a href='http://JustEtc.net' target='new' rel="noopener">http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning) </a>
    Shop Online: <a href='https://www.ShopForSoul.com'> https://www.ShopForSoul.com/</a>
    Medium: <a href='https://medium.com/@SayedAhmedCanada' target='new' rel="noopener"> https://medium.com/@SayedAhmedCanada </a>