WebService-based summary

2010-03-29  来源:本站原创  分类:Java  人气:321 

1, Web Service's profile
1 What is Web Service
Web services is to build interoperable distributed applications for the new platform.
Web service platform is a set of standards that defines how the Web application to achieve interoperability. You can use any language you like in any platform you like to write Web service, as long as we can through the Web service standard to query and access those services.
Web service platform, a need for a protocol to achieve the creation of distributed applications. Any platform has its own methods and types of data representation system. To achieve interoperability, Web service platform must provide a set of standard type system for communication between different platforms, programming languages and component models of different types of systems.
Based Web Services platform is XML + HTTP.
HTTP protocol is the most commonly used Internet protocols.
XML provides a way can be used for different platforms and programming languages language.
Web services platform is a simple interoperable messaging framework. It still lacks many other important issues such as security and routing features. However, once SOAP becomes more advanced, these matters will be solved.
Web services is expected to make the application easier to communicate.
★ Web services to Web applications have been upgraded to another level through the use of Web services, your application may be released to the world functions or message.
Web services use XML for encoding and decoding data, and by using the SOAP protocol to transfer from the open data.
Adoption of Web services, your accounting department of the Win 2k server with IT suppliers, UNIX servers to connect.
★ Web services applications, there are two types of reusable application components, some features are different applications often used. So why should cycle to develop them?
Web services application components can be provided as a service, such as currency conversion, weather forecasts, or even language translation and so on.
Ideal situation is that each application component is only one of the best version, so that anyone can use it in their applications.
Connect the existing software for different applications by providing a way to link their data, Web services help solve interoperability problems.
By using Web services, you can be in different applications and platforms to exchange data.
★ Web Services has two basic elements.
They are: SOAP and WSDL
(1) What is SOAP?
n SOAP Simple Object Access Protocol refers to
n SOAP is a communication protocol
n SOAP for communication between applications
n SOAP is a format used to send messages
n SOAP is designed to communicate via the Internet
n SOAP platform-independent
n SOAP is independent of language
n SOAP-based XML
n SOAP is very simple and can be extended
n SOAP allows you to bypass the firewall
n SOAP will serve as a W3C standard development (2) What is WSDL?
WSDL is based on XML, is used to describe Web Services and how to access Web Services language.
n WSDL means Web Services Description Language
n WSDL using the XML to prepare
n WSDL is an XML document
n WSDL is used to describe network services
n WSDL can also be used to locate network services
n WSDL is not the W3C standard
2 What is JWS
JWS (Java Web Service) is a Java application platform specifically for the development of Web services, systems and service-oriented system of products, its latest version is 2.0, Java EE 5 and Java SE 6 are all JWS 2.0 to provide support.
In the JWS 2.0, Java defines a series of new standards, JMS itself contains a number of tools, such as JAX-WS 2.0, JAXB 2.0, JAXP 1.4, SAAJ 1.3, and WS-Metadata and so on.
Service-oriented systems are often by multiple sub-functions with different independent components, through their mutual cooperation between the good and can implement complex needs. Service-oriented system, this feature, calling for independence form the interface between the public, the public interface for exchanging data with good definition. Due to data communication between units, which have well-defined interfaces to other components must be identified and a proper understanding of cooperation can be achieved.
In the definition of the public interface, there is a specific data exchange problem, that both sides need to follow a common data exchange standards, the data exchange standard known as protocols. Be in a separate communication between components, requires a series of stringent requirements on data communications standard format and rules.
The emergence of Web Service to solve the above problems, the use of WSDL defines unified interface format, SOAP messages using a unified input / output parameters of the uniform format. SOAP messages can be delivered by a variety of ways, for example, through HTTP, SMTP, and JMS protocol to pass. With HTTP, for example, in the service use client, WSDL interface definitions via HTTP-GET request to obtain, while the SOAP response message and reply messages transmitted via HTTP-POST request to achieve. In this way, based on WSDL and SOAP messaging mechanism to meet the service-oriented application development needs.
Web Service platform architecture consists of three major components: serialization and deserialization subsystem, call subsystem and publish subsystem. These three subsystems are not subject to specific language constraints, are not subject to restrictions on platforms and frameworks, regardless of the use of Java language, or. NET languages, regardless of platform or JWS use Axis to develop web services, will involve three basic functions of module.
(1) serialization and deserialization
In the JMS will be a Java object into an XML element in the process, known as serialization. On the contrary would be an XML element into the process of the corresponding Java object is called deserialization. Serialization and deserialization process depends on the Java classes and XML-Scheme mapping between, JWS independent serialization and deserialization subsystem is used for completion of these mapping and transformation.
In the web service client, serialization process parameters into a xml node, and then packaged into a Soap request message, sent to the server-side web service endpoint. To obtain the return value when the deserialization process starts, it will return value from the SOAP message specified in the xml nodes removed, and then transform it into corresponding Java objects Duanxiang customers. Transformation rules defined in the JWS is through JAXB annotations to complete. The new version of JAXB simplifies the description of binding rules, which allows rules directly into Java classes in the form of annotations.
For example:

@Entity
@Name("hotel")
@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
@XmlType(name="", propOrder = {
    "id",
    "img",
    "name",
    "address",
    "city",
    "state",
    "zip",
    "country",
    "price",
    "ipAddress"
})
@XmlRootElement(name="Hotel")
public class Hotel implements Serializable
{
   private Long id;
   private String img;
   private String name;
   private String address;
   private String city;
   private String state;
   private String zip;
   private String country;
   private BigDecimal price;
   private String ipAddress = "192.168.1.112"; 

@Id @GeneratedValue
   public Long getId()
   {
      return id;
   }
   public void setId(Long id)
   {
      this.id = id;
   } 

@Length(max = 50)
@NotNull
public String getImg() {
return img;
} 

public void setImg(String img) {
this.img = img;
} 

@Length(max=50) @NotNull
   public String getName()
   {
      return name;
   }
   public void setName(String name)
   {
      this.name = name;
   } 

   @Length(max=100) @NotNull
   public String getAddress()
   {
      return address;
   }
   public void setAddress(String address)
   {
      this.address = address;
   } 

   @Length(max=40) @NotNull
   public String getCity()
   {
      return city;
   }
   public void setCity(String city)
   {
      this.city = city;
   } 

   @Length(min=4, max=6) @NotNull
   public String getZip()
   {
      return zip;
   }
   public void setZip(String zip)
   {
      this.zip = zip;
   } 

   @Length(min=2, max=10) @NotNull
   public String getState()
   {
      return state;
   }
   public void setState(String state)
   {
      this.state = state;
   } 

   @Length(min=2, max=40) @NotNull
   public String getCountry()
   {
      return country;
   }
   public void setCountry(String country)
   {
      this.country = country;
   } 

   @Column(precision=6, scale=2)
   public BigDecimal getPrice()
   {
      return price;
   }
   public void setPrice(BigDecimal price)
   {
      this.price = price;
   }
   @Transient
   public String getIpAddress() {
   return ipAddress;
   }
   public void setIpAddress(String ipAddress) {
   this.ipAddress = ipAddress;
   }
   @Override
   public String toString()
   {
      return "Hotel(" + name + "," + address + "," + city + "," + zip + ")";
   }
}

(2) the process of service call
In the service-oriented distributed systems, the general framework of the traditional client-server in the client-side Client as service consumers, but will the server-side known as the service providers.
In accordance with the current web service standards, a service is called, in the service delivery end of the broad process is as follows:
① accepted and pre-processing SOAP request message, for example, efficacy, handling SOAP messages packet headers.
② get the message from the message want to call the interface and the concrete operation.
③ the use of web services support, to find concrete realization of the object, and calls the object's interface. This object can be a different language. JWS support the mapping from WSDL to Java, you can find it through the WSDL corresponding to the Java service endpoint implementation class.
④ tool use serialization deserialization process, the SOAP request message to the service request parameters removed, passed to step 3, the corresponding function of the target object.
⑤ target Java object to perform the corresponding operations, the results of the calculation to return the form of an object.
⑥ using the tools of the sequence of serial process, according to wsdl, as defined in the Step 5 results in the object sequence into XML elements, and packaged into the SOAP reply message.
⑦ to Step 6 of the SOAP reply message sent back to service call-side.
Corresponding in the service using the side of the calling procedure is as follows:
① First, create a service endpoint interface object SEI (Service Endpoint Interface), the Web service client usually there is a corresponding factory class to complete SEI object instantiation. In the JWS in, SEI object is normally provided by Java proxy to achieve.
② client calling them by SEI package web service interface.
③ the use of tools serialization serialization process, according to the definition of WSDL, the client calls the interface parameters into XML elements, then the element encapsulated in the SOAP request message inside.
④ In the synchronous mode, in the SOAP request message is issued, the client will wait for SOAP response message; asynchronous mode, the client-side code in the order of implementation of the follow-up, until the listener through the SOAP request message is received inside.
⑤ Analysis obtained from the server-side SOAP response message, use the tool in the anti-serialization serialization process, the SOAP response message in the data into client-side object, the object's value is to be called service return value.
(3) web services with JMS, for example the release, web services, the main function of ① distribution system in the form of URL has been released publicly WEB services, WSDL documents and SOAP request message and the Java binding target class.
② Release JAVA object file (such as Java Object files, WAR files, JAR files and associated configuration files, etc.).
③ Configure serialization and deserialization subsystem.
④ configure web service endpoint listener and SOAP messages pretreatment process.

相关文章
  • How to use axis publish a webservice, step summary 2010-07-19

    How to use axis publish a webservice, step summary (through wsdd papers to publish): 1. How to create a wsdl file. Method 1: Define an interface, it inherits a remote call Remote interface, and then define a class that implements the interface. Can a

  • Axis WebService based on some of the problems and develop solutions 2010-12-15

    Axis WebService based on some of the problems and develop solutions 1.server-conig.wsdd error in the custom Bean Description: DEMO from the static module to the time required to implement business logic and found that the distribution file automatica

  • The webservice based Zend_Soap and multi-language communication (java) (a) 2010-10-22

    ZF manual looked at the instructions on the Zend_Soap, feeling very faint and incomprehensible, is not a personal understanding of a problem, it is not known, and always feel that there is no hands-on document did not even read more Top things, then

  • For the first time to write webservice based on jax-ws 2010-03-29

    Environment: MyEclipse6.5 tomcat6.0 jax-ws2.1 jdk1.6.0.18

  • Spring rack based summary 2010-09-05

    1. Definition: Spring is an open source inversion of control (IOC) and the tangential-oriented (AOP) of the container framework, mainly for simplifying enterprise development, can be applied to any java application. The main advantages of using the f

  • WebService principle 2011-01-05

    Principles of Web Service Summary webservice 2009-12-29 19:54:59 Read 421 Comments 0 Font Size: medium and small subscription. 1. Basic principles: From a macro perspective, is based on the protocol (SOAP Protocol) web services, from the micro level,

  • Construction of the DSS based on data warehouse 2010-05-31

    As the DSS (decision support system) deficiencies, which turned out to not bring much surprise to the industry. However, with the addition of the data warehouse, DSS systems in an embarrassing situation was gradually improving. 1. DSS 's inherent Dec

  • [Change] webservice axis2 way of summing up the development 2010-06-03

    Summary of axis2 webservice method development Keywords: webservice webservice development summary First of all, the web project to build a HelloWorld Axis2 related to package into the project lib where To ensure correct axis2 novice proposed to all

  • Based on the electronic map system shows GeoServer 2010-06-13

    Overview of an AJAX applications, front page on OpenLayers2.2 version to develop, map service is based on GeoServer1.5, background check based on Spring and Hibernate. Before and after the JSON-based approach to communication. Note: To make the code

  • JavaScript calls webService 2010-08-16

    Web Service is an application component, it is logical to provide data to other applications and services. The application provided by a number of network protocols and standard data formats (Http, XML, Soap) to access the Web Service, through an int

  • Encoding method of dynamic call WebService 2010-10-08

    Call the method, but also support the band ref Parameters /// <summary> /// According to the specified information, call the remote WebService Methods /// </summary> /// <param name="url">WebService The http address of the form

  • WebService learning segment 2011-09-27

    SOA (Service-Oriented Architecture) 1 concept: (Some people say that is a framework, some people say is a methodology) is an IT architectural style that supports your business into a set of interlinked services or repeatable business tasks, when you

  • Distributed Acquisition System Selection 2010-08-01

    Recent projects required by the crawler to the original stand-alone system, multi-threaded programs into distributed multi-system multi-process system with collaboration of reptiles. The original of the crawler is based on the multi-threaded concurre

  • The study concluded on sentiment analysis (to) 2011-05-20

    This classification is only a very rough classification, and as of May this year, after not continue to update. Paper contains is not very full, but small is not necessarily a bad thing, see more! 1 Topic modeling for sentiment analysis 1.1 Unsupervi

  • The study concluded on sentiment analysis (transfer) 2011-05-20

    This classification is only a very rough classification, and as of May this year, then did not continue to update. Papers contain is not very full, but small is not necessarily a bad thing, see more! 1 Topic modeling for sentiment analysis 1.1 Unsupe

  • WebService to learn, develop summary 2010-03-26

    Basic concepts: 1, What is Web services? Web applications can be made with the platform and programming language-independent way to communicate with each other a technical. Web service is a software interface that describes a group on the network thr

  • HTTPS environment based on the webservice build step by step 2010-04-10

    Exposure time ago webservice, the webservice ssl based need to ensure security and to provide digital support. Not previously been engaged on this part, after groping least some harvest. Now to share some of my experience about. A digital certificate

  • several ways to deploy services webservice Summary 2010-05-09

    java webservice calls various methods from the past plus xml webservice technology has gradually matured, but it really needed to use up time!! Since graduation reasons, I read a lot of knowledge on the webservice, today and all this together and all

  • The webservice project based on xfire 2010-05-28

    The webservice project based on xfire if you want to get into their own look!

  • eclispe webservice developed under the detailed summary 2010-07-24

    eclispe webservice developed under the detailed summary summarized in detail under eclipse webservice Environment is jdk1.5 + axis1.4 Preparations to the official website to download axis-bin.zip archive to which the axis folder to the tomcat's webap