이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 34. Implementing a WS Client


34.1. WS Client Overview

Overview

The key object in a WS client is the WS client proxy object, which enables you to access the remote Web service by invoking methods on the SEI. The proxy object itself can easily be instantiated using the jaxws:client element in Spring XML.

Demonstration location

The code presented in this chapter is taken from the following demonstration:
cxf-webinars-jboss-fuse-6.1/customer-ws-client
Copy to Clipboard Toggle word wrap
For details of how to download and install the demonstration code, see Chapter 31, Demonstration Code for Camel/CXF

WSDL contract

The WSDL contract is a platform-neutral and language-neutral description of the Web service interface. It contains all of the metadata that a client needs to find a Web service and invoke its operations. You can generate Java stub code from the WSDL contract, which provides an API that makes it easy to invoke the remote WSDL operations.

Service Endpoint Interface (SEI)

The most important piece of the generated stub code is the SEI, which is an ordinary Java interface that represents the Web service interface in the Java language.

WS client proxy

The WS client proxy is an object that converts Java method invocations to remote procedure calls, sending and receiving messages to a remote instance of the Web service across the network. The methods of the proxy are exposed through the SEI.
Note
The proxy type is generated dynamically by Apache CXF at run time. That is, their is no class in the stub code that corresponds to the implementation of the proxy (the only relevant entity is the SEI, which defines the proxy's interface).

The CustomerService client

To take a specific example, consider the customer-ws-client demonstration, which is available from the following location:
cxf-webinars-jboss-fuse-6.1/customer-ws-client
Copy to Clipboard Toggle word wrap
Figure 34.1, “Building a WS Client” shows an overview of the files required to implement and build the WS client.

Figure 34.1. Building a WS Client

Implementing and building the WS client

To implement and build the sample WS client shown in Figure 34.1, “Building a WS Client”, starting from scratch, you would perform the following steps:
  1. Obtain a copy of the WSDL contract.
  2. Generate the Java stub code from the WSDL contract using a WSDL-to-Java converter, ws2java. This gives you the SEI, CustomerService, and its related classes, such as Customer.
  3. Implement the main client class, ClientInvoker, which invokes the Web service operations. In this class define a bean property of type, CustomerService, so that the client class can receive a reference to the WS client proxy by property injection.
  4. In a Spring XML file, instantiate the WS client proxy and inject it into the main client class, ClientInvoker.
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat