Home Database Mysql Tutorial CXF学习笔记(2)

CXF学习笔记(2)

Jun 07, 2016 pm 03:13 PM
release study success Serve notes

上一节中已经成功的发布了一个服务端webservice,这一部分将默认客户端调用webservice 这里我们重新建立了一个新的工程CXF-Client,把上一节中列举的jar包都搞过来即可,调用方式采用了和RMI类的机制,即客户端直接服务器端提供的服务接口(interface),CXF通过

上一节中已经成功的发布了一个服务端webservice,这一部分将默认客户端调用webservice

这里我们重新建立了一个新的工程CXF-Client,把上一节中列举的jar包都搞过来即可,调用方式采用了和RMI类似的机制,即客户端直接服务器端提供的服务接口(interface),CXF通过运行时代理生成远程服务的代理对象,在客户端完成对webservice的访问

几个必填的字段:setAddress-这个就是我们发布webservice时候的地址,保持一致

HelloWorldService:需要服务器端提供单独的Jar文件过来

package com.crazycoder2010.webservice.cxf.client;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

import com.crazycoder2010.webservice.cxf.server.HelloWorldService;

public class Client {
	public static void main(String[] args) {
		JaxWsProxyFactoryBean bean = new JaxWsProxyFactoryBean();
		bean.getInInterceptors().add(new LoggingInInterceptor());
		bean.getInFaultInterceptors().add(new LoggingOutInterceptor());
		bean.setServiceClass(HelloWorldService.class);
		bean.setAddress("http://localhost:9090/helloWorldService");
		HelloWorldService helloWorldService = (HelloWorldService)bean.create();
		String result = helloWorldService.sayHello("Kevin");
		System.out.println(result);
	}
}
Copy after login

运行输出:

2011-8-9 21:32:20 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://server.cxf.webservice.crazycoder2010.com/}HelloWorldServiceService from class com.crazycoder2010.webservice.cxf.server.HelloWorldService
2011-8-9 21:32:41 org.apache.cxf.interceptor.AbstractLoggingInterceptor log
信息: Inbound Message
----------------------------
ID: 1
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml;charset="utf-8"
Headers: {Content-type=[text/xml;charset="utf-8"], Transfer-encoding=[chunked]}
Payload: <?xml version="1.0" ?><envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><body><sayhelloresponse xmlns:ns2="http://server.cxf.webservice.crazycoder2010.com/"><return>Hello Kevin</return></sayhelloresponse></body></envelope>
--------------------------------------
Hello Kevin
Copy after login
小结:这种调用service的好处在于调用过程非常简单,就几行代码就完成一个webservice的调用,但是客户端也必须依赖服务器端的接口,这种调用方式限制是很大的,要求服务器端的webservice必须是java实现--这样也就失去了使用webservice的意义
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to delete Xiaohongshu notes How to delete Xiaohongshu notes Mar 21, 2024 pm 08:12 PM

How to delete Xiaohongshu notes? Notes can be edited in the Xiaohongshu APP. Most users don’t know how to delete Xiaohongshu notes. Next, the editor brings users pictures and texts on how to delete Xiaohongshu notes. Tutorial, interested users come and take a look! Xiaohongshu usage tutorial How to delete Xiaohongshu notes 1. First open the Xiaohongshu APP and enter the main page, select [Me] in the lower right corner to enter the special area; 2. Then in the My area, click on the note page shown in the picture below , select the note you want to delete; 3. Enter the note page, click [three dots] in the upper right corner; 4. Finally, the function bar will expand at the bottom, click [Delete] to complete.

How to publish works on Xiaohongshu How to publish articles and pictures on Xiaohongshu How to publish works on Xiaohongshu How to publish articles and pictures on Xiaohongshu Mar 22, 2024 pm 09:21 PM

You can view various contents on Xiaohongshu, which can provide you with various help and help you discover a better life. If you have anything you want to share, you can post it here so that everyone can take a look. , and at the same time, it can bring you profits. It is very cost-effective. If you don’t know how to publish your works here, you can check out the tutorial. You can use this software every day and publish various contents to help everyone use it better. Don’t miss it if you need it! 1. Open Xiaohongshu and click the plus icon below. 2. There are [Video] [Picture] [Live Picture] options here; select the content you want to publish and click to check. 3. Select [Next] on the content editing page. 4. Enter the text content you want to publish and click [Publish Pen]

Why can't Xiaohongshu publish videos of works? How does it publish its work? Why can't Xiaohongshu publish videos of works? How does it publish its work? Mar 21, 2024 pm 06:36 PM

With the rapid development of social media, short video platforms have become the main channel for many users to express themselves and share their lives. Many users may encounter various problems when publishing videos of their works on Xiaohongshu. This article will discuss the reasons that may cause the video publishing of Xiaohongshu works to fail and provide the correct publishing method. 1. Why can’t Xiaohongshu publish videos of works? The Xiaohongshu platform may occasionally experience system failures, which may be caused by system maintenance or upgrades. In this case, users may encounter the problem of being unable to publish videos of their works. Users need to wait patiently for the platform to return to normal before trying to publish. An unstable or slow network connection may prevent users from posting videos of their work on Xiaohongshu. Users should confirm their network environment to ensure that the connection is stable and

Why can't Xiaohongshu be released? What should I do if the content published by Xiaohongshu cannot be displayed? Why can't Xiaohongshu be released? What should I do if the content published by Xiaohongshu cannot be displayed? Mar 21, 2024 pm 07:47 PM

As a lifestyle sharing platform, Xiaohongshu has attracted a large number of users to share their daily life and grow products. Many users have reported that their published content cannot be displayed. What is going on? This article will analyze the possible reasons why Xiaohongshu cannot be released and provide solutions. 1. Why can’t Xiaohongshu be released? Xiaohongshu implements strict community guidelines and has zero tolerance for publishing advertisements, spam, vulgar content, etc. If the user's content violates the regulations, the system will block it and the content will not be displayed. Xiaohongshu requires users to publish high-quality and valuable content, and the content needs to be unique and innovative. If the content is too generic and lacks innovation, it may not pass review and therefore not be displayed on the platform. 3. Account abnormality

How to delete Xiaohongshu releases? How to recover after deletion? How to delete Xiaohongshu releases? How to recover after deletion? Mar 21, 2024 pm 05:10 PM

As a popular social e-commerce platform, Xiaohongshu has attracted a large number of users to share their daily life and shopping experiences. Sometimes we may inadvertently publish some inappropriate content, which needs to be deleted in time to better maintain our personal image or comply with platform regulations. 1. How to delete Xiaohongshu releases? 1. Log in to your Xiaohongshu account and enter your personal homepage. 2. At the bottom of the personal homepage, find the &quot;My Creations&quot; option and click to enter. 3. On the &quot;My Creations&quot; page, you can see all published content, including notes, videos, etc. 4. Find the content that needs to be deleted and click the &quot;...&quot; button on the right. 5. In the pop-up menu, select the &quot;Delete&quot; option. 6. After confirming the deletion, the content will disappear from your personal homepage and public page.

How to publish works on Xiaohongshu app? Tutorial on publishing works on Xiaohongshu app in five minutes How to publish works on Xiaohongshu app? Tutorial on publishing works on Xiaohongshu app in five minutes Mar 12, 2024 pm 05:10 PM

How does the Xiaohongshu app publish works? Many friends know that there are a large number of creative works and a strong dating circle in this software. For users who are new to this software, they probably don’t know how to publish their works, so that more people can watch the other side of you. If you still don’t know how to publish the works in it, then quickly refer to the five-minute tutorial on publishing works on the Xiaohongshu app recommended by the editor of this site. Tutorial on publishing works in Xiaohongshu app in five minutes 1. Click [Three] As shown in the picture, click [Three] pointed by the red arrow in the upper left corner. 2. Click [Creation Center] As shown in the picture, click [Creation Center] pointed by the red arrow. 3. Click [Go to Publish] as shown in the picture,

When is the best time to publish Xiaohongshu? Where does it post the most traffic recommendations from? When is the best time to publish Xiaohongshu? Where does it post the most traffic recommendations from? Mar 21, 2024 pm 08:11 PM

In today's social network era, Xiaohongshu has become an important platform for young people to share their lives and obtain information. Many users hope to attract more attention and traffic by publishing content on Xiaohongshu. So, when is the best time to post content? This article will explore in detail the selection of Xiaohongshu’s publishing time and the publishing location with the most traffic recommendations. 1. When is the best time to publish Xiaohongshu? The best time to publish content on Xiaohongshu is usually during periods of high user activity. According to the characteristics and behavioral habits of Xiaohongshu users, there are several time periods that are more appropriate. During the time period from 7 pm to 9 pm, most users have returned home from get off work and started browsing content on their mobile phones in search of relaxation and entertainment. Therefore, content posted during this period is more likely to attract users

What should I do if the notes I posted on Xiaohongshu are missing? What's the reason why the notes it just sent can't be found? What should I do if the notes I posted on Xiaohongshu are missing? What's the reason why the notes it just sent can't be found? Mar 21, 2024 pm 09:30 PM

As a Xiaohongshu user, we have all encountered the situation where published notes suddenly disappeared, which is undoubtedly confusing and worrying. In this case, what should we do? This article will focus on the topic of &quot;What to do if the notes published by Xiaohongshu are missing&quot; and give you a detailed answer. 1. What should I do if the notes published by Xiaohongshu are missing? First, don't panic. If you find that your notes are missing, staying calm is key and don't panic. This may be caused by platform system failure or operational errors. Checking release records is easy. Just open the Xiaohongshu App and click &quot;Me&quot; → &quot;Publish&quot; → &quot;All Publications&quot; to view your own publishing records. Here you can easily find previously published notes. 3.Repost. If found

See all articles