Deals

WSDL

WSDL stands for Web Services Definition Language.
It is written in XML.
         Basically, a WSDL is a contract between a service requester and a service provider.It contains information such as Interface, Data type, binding and address. Using a WSDL, a user can locate a web service and its publicly available functions/interfaces.It can also be used to integrate different services.

There are 6 major elements in a WSDL document.

  1. definitions: It is the root element for all the WSDL documents. It defines name of web service, declares namespaces and also contains all service elements.
  2. types: It contains all the data types used between server and client. WSDL is not bound to specific typing system, but by default it is W3C XML schema specifications. 
  3. message: It describes a one-way message( either request or response). It defines name of the message and message part elements.
  4. port type: It combines multiple messages with different operations that can be performed on those messages. the operation types include (1) one-way (2) request-response (3) Solicit response and (4) Notification.
  5. binding: It describes how the service will be implemented on the wire. So the SOAP specific information goes in here. It basically contains 2 attributes (1) name and (2) type. "name" attribute defines the name of the binding and "type" attribute points to the port that is used for binding.
  6. service: It defines the address for invoking the specific service.
In addition to these six major elements, WSDL also has 2 more utility elements:
  1. documentation: It is used for providing human readable documentation and can be used in any other WSDL documents.
  2. import: The import element is used to import other WSDL documents or XML Schemas. This enables more modular WSDL documents. For example, two WSDL documents can import the same basic elements and yet include their own service elements to make the same service available at two physical addresses. 

Creating New Database Connection in NetBeans for SQL Server

Prerequisites: SQL Server 2008 R2 Express and NetBeans installed in your computer with jdk1.5 or higher. And also you have to download SQL Server 2008 R2 Express JDBC driver and extract all files to "Microsoft SQL Server JDBC Driver 3.0" folder only. (Do not give any other names. It wont recognize).


Once the above prerequisites are completed, create a database and tables in SQL Server of your requirement.


1. Creating database in SQL Server 2008 R2 Express:
  1. Login to Server.
  2.                     
  3. Create Database. (Example : MyDB).
  4. Create table inside MyDB.( Example: EMP).
  5. Save all and execute any query to know that the database is working fine.
2. Create new Database Connection in NetBeans:
  1. Go to Windows->Services. Right click on Databases and then New Connection. 
  2. Check Data Input mode as "Direct URL Entry".
  3. Select driver name "New Driver".
  4. Click on Add.
  5. Select "sqljdbc4.jar" file from "Microsoft SQL Server JDBC Driver 3.0/sqljdbc<version>/enu/" folder.                                                                 
  6. Enter Username/password of server.
  7. The URL should be: jdbc:sqlserver://localhost:1433/databaseName=<your DB name>; 
  8. Select the schema of your database.
3. Other Settings:
  1. Make sure the Sql server service and Sql Browser service are running. Go to SQL Configuration Manager and click on SQL Server Services and check the services running. If not start them. By default SQL browser service is disabled. you have to enable/set automatic start and run the service.
  1.   One very important setting here is enabling TCP/IP port and setting its IP to 1433. Go to SQL Server Configuration Manager --> SQL Server Network Configuration-->protocols for SQLEXPRESS. Here make sure TCP/IP is enabled. Double click on TCP/IP and then on IPAdresses and go to IP All and set TCP Port to 1433.



Now you are all set for developing a database application in NetBeans. Congratulations!!!




SCJP in short.....



  1. Default access modifier: When a class is declared with a default access modifier in a package, second class can only extend that class if it is in the same package. Otherwise it gives a compilation error saying Class or interface must be public, in same package, or an accessible member class.          Tip: check for the access violations if any in the question to avoid further calculations/analysis. 
  2. Abstract Modifier:  1. If a class extends an abstract class, it should implement all its abstract methods. 2. It is legal to have non-abstract methods in an abstract class.3. Abstract methods end with semicolon rather than curly braces. 4. An abstract class cannot be instantiated.(we will get compilation error saying: class *** is an abstract class. It can't be instantiated. ). 5. If a single method in a class is abstract, the corresponding class must also be abstract.
  3. We cannot declare a class as both abstract and final.
  4. Interface: 1. All methods in an interface are implicitly public and abstract but not static and final. 2. All variables in interface must be constants( not instance variables) i.e., they must be declared public,static and final. 3. An interface can only extend an other interface but not class and it cannot implement other interface/class.                                                                
    Example1:

    1). public Interface MyInterface{
    void myInterfaceMethod()
    }

    2) public Interface MyInterface{
    public abstract void myInterfaceMethod();
    }
     the two lines of codes 1 & 2 are same.

    Example2:
     1). public Interface MyInterface{
    MYVAR =24;
    }
     class MyClass implements MyInterface{
     MYVAR =20;
     }
    It gives a compliation error. Since the variables declared in interface are constants, i.e., they are by default public static final, they cannot be re-assigned.
  5. Var-args:  Syntax: void myMethod(int... x){ }
    In a method declaration, there can be other arguments along with this and var-arg must be declared last. We can have only one var-arg argument for a method. 
  6. Constructors: 1. No return types. 2. Cannot be marked static/final or abstract. 
  7. Variable types: 1. Primitive 2. Reference variables 3. Instance Variables. Instance variables are declared inside class but outside any method.
  8. Encapsulation: If the question is asking about the behavior of the method or the value of a variable with in  the class or ultimate result of the variable, look for encapsulation is justified or not. For example: When there are methods like setters and getters, the variable used in those methods must be private to that class to ensure encapsulation.
  9. Ex:  public class Test  {  public int myVar;  int getMyVar(){ return myVar;}  void setMyVar(int myVar){ int x= myVar/6; }  }     Here in the above class, myVar maynot be always 1/6th of its value. One who uses "Test" classcan actually change it(yes!!As the myVar is declared public you see !!!)
  10. Overriding: 1. When overriding a super class method, the overriding method cannot be less restrictive. 2. That method and overriding method must have the same signature.( or else it becomes overloading!!). 3. If a method cannot be inherited(i.e., it is not re-implemented in the subclass), it cannot be overridden!It means, when we access a subclass and did not implement the method of super class, you cannot access that method using instance of the subclass. 
  11. Example: public class Test{ public static void main(String [] args){ Sub s=new Sub(); s.myMethod();   /* here it is illegal. Because myMethod is not re-implemented */ } } class Super{ void myMethod(){ System.out.println("super"); } class Sub extends Super{ void otherMethod(){} }
........still more to come