WebService Development Concept

Source: Internet
Author: User
Tags abstract definition soap wsdl

First, thebasic concept of WEB service

Web service is made up of two parts

The basic communication protocol between the Soap--web service.

The Wsdl--web service describes the language, which defines what the Web service does, how it is done, and what information is queried.

Second, what is Webservice?

The WEB is a technology that enables applications to communicate with each other in a way that is independent of the platform and programming language. A WEB service is a software interface that describes a set of operations that can be accessed over a network through standardized XML messaging. It uses an XML-based protocol to describe the action to be performed or the data to be exchanged with another Web service. A set of Web services that interact in this way defines a special Web service application in a service-oriented architecture (service-oriented Architecture,soa).


Third, what is soap?

SOAP (Simple Object access Protocol) is an XML-based protocol that is a lightweight protocol for exchanging information and performing remote procedure calls in a decentralized or distributed environment. Using SOAP, regardless of any particular transport protocol (the most common or HTTP protocol), allows any type of object or code to communicate with each other in any language on any platform.

SOAP consists of four parts: thesoap wrapper (envelop), which defines a framework that describes what the content in the message is, who sent it, who should accept and handle it, and how to handle it;SOAP Encoding Rules (encoding rules), an instance of the data type that the application needs to use, a SOAP RPC representation (RPC representation), a contract that represents a remote procedure call and an answer, asoap binding (binding), Exchange information using the underlying protocol.

The focus of the application is envelop, which consists of one or more headers and a body .

The location of soap in an interoperable underlying WEB services protocol stack.

Four, What is WSDL?

The WSDL (Web Service Description Language)Web Server Description Language is the standard for describing Web services using XML documents and is the interface definition language for Web services, by Ariba, Intel, IBM, MS and so forth, through the WSDL, can describe the Web service three basic properties:

· What the service does --the operation provided by the service (method)

· How to access Services --data formats for interacting with services and necessary protocols

· where the service is located --protocol-related addresses, such as URLs

The WSDL document describes the Web service as a collection of ports, and the WSDL service description contains an abstract definition of a set of operations and messages, a specific protocol that binds to those operations and messages, and a network endpoint specification for this binding.

The location of the WSDL in the conceptual protocol stack of the Web service.

WSDL Description Language typically contains three parts

L What section: includes the type, message, and porttype elements

Type: Defines the data structure used by the Web service (using XML Schema Definitions)

message: A message is the basic communication element of soap. Each message can have one or more part, and each part represents a parameter.

PortType: Messages are summarized into different operations and are grouped into an entity called PortType. A porttype represents an interface (a collection of operations supported by a Web service), and each Web service can have multiple interfaces, both of which are represented using porttype. Each operation also contains the input and output sections.

2 How section: Contains binding elements
The binding element binds the porttype to a specific communication protocol (such as the SOAP Protocol on HTTP)

3 Where section: comprised of service elements

It puts the porttype,binding and the actual location (URI) of the Web service together to describe

V. What is WSDD?

WSDD is the Web Services Distribution Description (Web Service Deployment descriptor), which defines the interface of the Web service, such as the service name, the method provided, the parameters of the method, and so on.

Vi. what is UDDI?

UDDI is the unified description, Discovery, and integration (Universal Description, Discovery, and integration). UDDI is used to centralize and locate WSDL profiles, which act as a directory server.

Roles, operations, and artifacts in WEB services.

Service provider. From an enterprise perspective, this is the owner of the service. From an architectural standpoint, this is the platform for managed access services.

The service requester. From an enterprise perspective, this is an enterprise that requires a specific feature to be met. From an architectural standpoint, this is an application that looks for and invokes a service, or initiates an interaction with the service. The service requester role can be assumed by the browser and controlled by a person or a program without a user interface (for example, another Web service).

Service Registration Center.

This is a searchable service description registry where service providers post their service descriptions. During a static binding development or dynamic binding execution, the service requester looks for the service and obtains the binding information for the service (in the service description). For statically bound service requesters, the service registry is an optional role in the architecture, because the service provider can send the description directly to the service requester. Similarly, service requesters can get service descriptions from sources other than the service registry, such as local files, FTP sites, Web sites, advertising and service discovery (advertisement and Discovery of Services,ads), or Discovery Web Services (Discovery of Web Services,disco).

Vii. Client and server side

Client

A set of related client classes generated from a WSDL file. The WSDL address can then be used to access the functionality provided by other systems or applications.

Typically, Web service can have three types of customers

L Business Partners (Partner) – including distributors, retailers and large consumers)

Such customers connect to Web service through XML technology such as SOAP, WSDL, EbXML, UDDI, etc.

L Thin customers-including web browsers, PDAs, and wireless devices

This type of customer is typically connected to a Web service via a lightweight protocol, such as HTTP

L fattening customers-including applets, applications, and existing systems
You typically use a heavyweight protocol (such as IIOP) to connect to a Web Service

Server-side

That is to provide an interface (essentially: method), so that other different systems or applications can be accessed, the function of the system. It includes the following:

1. An external interface

2. The implementation class for this interface

3. A deployment description file that describes the service (interface). Information about the services in the deployment file can be generated through the commands of axis.

These files are all included in a complete Web application and can be accessed by other systems when the Web container is launched.

Webservice Development Process Technical guidance (II.)

I. Introduction of file Format

1. JWs (Java Web Service) files-instant Deployment It is a properly formatted Java file with a suffix of. JWs. If it is published, it can be placed directly under the project root of the publication. It cannot specify a package name . If you reference another class, you cannot specify the package name only for other classes.

Ii. simple operation commands and basic concepts of axis tools

1. Display Help information: Java-djava.ext.dirs=lib Org.apache.axis.wsdl.WSDL2Java

Generate the client code instance: if necessary, switch to the Lib directory of axis in DOS. then execute this command. J Java-djava.ext.dirs=lib Org.apache.axis.wsdl.wsdl2java-a-h-d-s-t-S true-p com.qnuse.zj114.webservicehttp://134.9 6.71.58/qninterface/hzgsyj.asmx?wsdl

2. The Wsdl2java tool generates the client stub code from the WSDL file, the server-side framework (skeleton) code, and the data-type file in the WSDL (generating the corresponding Java code).

3. SERVER-CONFIG.WSDD records the description of Axis's published Web service.

Ii. Axis Tool Wsdl2java Command parameter explanation

1.-N,--nstopkg <argument>=<value>

Mapping of namespace to the package

2.-A,--all

Generate code for all elements, even unreferenced ones

3.-P,--package <argument>

Override all namespace to package mappings

Name instead

4.-H,--help

Print this message and exit

5.-V,--verbose

Print Informational Messages

6.-T,--testcase

To release the JUnit test case class for a Web service


Four, server-config.wsdd file explanation

It is the configuration file for axis and all published services are described inside.

If you do not have a SERVER-CONFIG.WSDD file, you can write a release profile, then use axis to generate it, and later publish a new service and add it directly to it.

For example, there is a Helloworld.class class, there is a SayHello (String msg) method, want to publish it webservices, first write the Publish file Deploy.wsdd file, that is, the SOAP service publish the description file DEPLOY.WSDD
Http://xml.apache.org/axis/wsdd/"xmlns:java=" Http://xml.apache.org/axis/wsdd/providers/java ">

Then, go to the DOS window and execute the following command:

JAVA-CP%axisclasspath% org.apache.axis.client.AdminClient DEPLOY.WSDD can generate SERVER-CONFIG.WSDD files.

If you want to publish new services, you can also add service descriptions directly to SERVER-CONFIG.WSDD.

Five, View the published WebService

1. The first thing to look at is the configuration of the project's Web. XML, for example: the configuration of axis in Zj114boss Web. XML is:

<servlet>

<servlet-name>axis</servlet-name> <servlet-class>org.apache.axis.transport.http.axisservlet </servlet-class>

<load-on-startup>5</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>axis</servlet-name>

<url-pattern>/webservice/*</url-pattern>

</servlet-mapping>

2. Start the container, or look at the test environment. On IE, type: Http://134.96.71.27:8080/zj114boss-1.0/webservice you will see all the published service.

3. See the detailed WSDL content. Example: View production environment HTTP://134.96.71.73/USBOSS/WEBSERVICE/SSOSERVICE?WSDL

VI. Serialization and deserialization

Serialization/deserialization in English the corresponding translation is Serializer/deserializer, the function of a serializer is to follow a certain mapping rules and coding style, a type of Java object through a specific mechanism, the transformation into the form of XML description The function of the deserializer is the inverse of the work performed by the serializer, which complements each other and appears in pairs. The serialization/deserialization in Axis uses the factory pattern in the design paradigm, where each serializer uniquely corresponds to one serializerfactory; each deserializer corresponds to only one deserializerfactory.

Axis has provided a rich serialization/deserialization for developers, and for Java's basic data types, most commonly used container classes (such as array types, vector types, and so on) provide implementations, especially for the DOM objects (such as document, element, etc.) and Java objects that conform to the Bean specification provide a fully functional serialization/deserialization, but for some special types of objects that need to be passed through a Web service, we have to develop our own serialization/deserialization.

Eight, Axis compared to the advantages of SOAP V2

Axis is the third generation of Apache soap, and since 2000 the SOAP V2 development team has been discussing how to make axis more flexible, configurable, and able to handle SOAP and various XML standards from the broad spectrum. Through constant discussion and code writing, axis now has the following results compared to soap V2:

Increased speed. Axis handles XML documents with event-based sax, which improves speed and efficiency over Apache soap.

Increased flexibility.

Improved stability.

Provides component-oriented deployment.

Provides a concise transport abstraction framework. Its core engine is completely independent of the transmission mode. This allows for more flexibility in the choice of which protocol transmission is based.

Supports WSDL. Includes WSDL and client code generation, and so on.

Nine, performance

Axis uses version 1.3 and Xfire uses version 1.0. Xfire uses spring's Servicesbean way to publish Web services. The Web services client was developed using Delphi 7 to make 10,000 successive calls to Web services published through Axis and to Web services published through Xfire (that is, continuous use after fetching the WSDL once). Axis calls 10,000 memory consumption of 48M, spents 1 minutes 40 seconds Xfire calls 10,000 times memory consumption 38M, time 1 minutes 05 seconds. Using the Axis2 test, it was found that Web services published through AXIS2 could be imported in Delphi, but the runtime would have an error.

10. Development and testing tools

Development tools

1. Use axis's relevant eclipse plugin, or other form of plug-in. Example: ObjectWeb Lomboz an Eclipse based IDE for EE development

2. Use the Axis Code itself tool (DOS command line or ant script) to develop.

Testing the WebService Interface tool

1. vb Script test. This method is more convenient to operate.

Microsoft's SOAP Toolkit Development Kit, this toolkit can be from Microsoft's homepage: http://download.microsoft.com/download/xml/soap/2.0/W98NT42KMe/EN-US/ SoapToolkit20.exe

2. Generate the *testcase.java file for testing.

For detailed test code, see testing the WebService use case code.

Developed with Eclipse plug-ins

Use this ObjectWeb Lomboz tool to implement code development. This is the simplest way. The efficiency is very high, but the understanding of some basic knowledge of webservice is of little help. The steps are as follows:

1. To build a new project.

2. Put the WSDL file in the project.

3. Right-click to create a new WebService client or server-side code. You can choose axis, proxy two ways to achieve.

WebService Development Concept

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.