At first I used SPRINGMVC to do the interface, the front end can be post a JSON-formatted string, to the backend automatically assembled into my desired Java object, need to set up a converter:bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">property name="messageConverters">list>bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" />st>property>bean>This allows the JSON data to be transmitted via JS:functionaddUser(){v
CXF Interceptor in phase order Java code
In Org.apache.cxf.phase.PhaseManagerImpl
Final void createinphases () {
int i = 0;
inphases = new sortedarrayset
Inphases.add (new Phase (phase.receive, ++i * 1000));
Inphases.add (new Phase (Phase.pre_stream, ++i * 1000));
Inphases.add (new Phase (Phase.user_stream, ++i * 1000));
Inphases.add (new Phase (Phase.post_stream, ++i * 1000));
Inphases.add (new Phase (Phase.read, ++i * 100
Server Publishing methods and client access are different than JaxwsServer Publishing Method: PackageService;ImportJavax.xml.ws.Endpoint;ImportOrg.apache.cxf.jaxws.JaxWsServerFactoryBean;/*** Publishing Service*/ Public classFabu { Public Static voidMain (string[] args) {//that publishes the SOAP protocol.Jaxwsserverfactorybean Jaxwsserverfactorybean =NewJaxwsserverfactorybean (); //Specify WebService AddressJaxwsserverfactorybean.setaddress ("Http://127.0.0.1:12345/weather"); //Specify PortType
Tomcat Uninstall failed I am this because Jaxb-impl.jar this package, Java 7 inside, but CXF other tools will use it, have to join in the project,Tomcat Undeploy fail, I found that generally under Windows Server, is the Windows version of Tomcat, which will only be available when it is released and may not be encountered, butWhen running for a period of time, such as 1 days after uninstallation, the uninstallation fails, the solution, modifies $ (tomc
It is mainly set during client calls:
When using WebService, we may need a backup WebService server. once the master server is down, we can use the backup server. in this case, you need to modify the connection time of the client to the server.
In the spring + cxf WebService environment, the client has two configurable Time Attributes: connectiontimeout and receivetimeout.
Connectiontimeout -- WebService is based on a TCP connection. This attrib
// At this point, the server-side application has been generated
// Deploy it to Tomcat run
// The corresponding WSDL address is http: // localhost: 8080/test/WS/person? WSDL
// Open the WSDL address in the browser and download it. Note that the suffix is changed to WSDL. Here is person. WSDL.
// ================================== Client program ================ ===// Enter the command line-> cxf installation directory/bin
// Enter the wsdl2java
Recently began to learn to deploy WebServices under the cxf framework, at first it is to use the annotation class or use the JAX-WS approach such as @ WebService and other methods to release WebService combined with spring
However, it was suddenly found that the coupling between the Code and the Java code was greater, so we needed to find the exhausted xfie Aegis Method for deployment. It seems that such articles are hard to find,
Although it took a
topic.
Download the CFX package from the Apache website, decompress it to a certain path, and set the environment variable:
Cxf_home = E:/Java/apache-cxf-2.1.3, and add % cxf_home %/bin in path. Then, you can enter:
Wsdl2java-impl-server cueapinterfaceforsi. WSDL is used to generate interface classes, implementation classes, and other data classes. -The impl parameter requires the generation of implementation classes. If this parameter is not provide
Today do docking CXF server interface, never did, find a half-day method always error. To download the 2.7 version of the official website and then all the jar packages are connected or error, discouraged! And then found that the colleague has written before the class has a comment on the required jar package, try to, the version is older.
Cxf-2.0.5-incubator.jar
Jaxb-impl-2.2.1.jar
Wsdl4j-
First, the Environment configuration
New Cxf_home C:\ProgramFiles (my) \apache-cxf-2.7.2
In Classpath%csf_home%\lib
Add%csf_home%\bin to Path
Verify:
Operation win+r---> cmd---> Carriage return---"wsdl2java-v
The results show that Wsdl2java-apache CXF 2.7.2
Proven configuration Successful
Second, the use of Wsdl2java tools
Operation win+r---> cmd---> Carriage return---"wsdl2java-frontend jaxws21-p com.ji
CXF Annotation of WebService1, detailed error such as the followingUsage:java Org.apache.catalina.startup.Catalina [-config {pathname}] [-nonaming] {-help | start | stop}2014-5-4 22 : 42:12 org.apache.catalina.core.AprLifecycleListener init info: Loaded APR based Apache Tomcat Native Library 1.1.27 using AP R version 1.4.6.2014-5-4 22:42:12 org.apache.catalina.core.AprLifecycleListener init info: APR Capabilities:ipv6 [true], Sendfile [true], accept f
CXF with spring releases WS services with SOAP services, RESTful services1. Visit: http://localhost:8088/sniperWS/services/See what services are available, including Available SOAP services, Available RESTful Services2. Client calls RESTful services:Http://localhost:8088/sniperWS/services/address/getSuggestions.query Call Example: $.ajax ({ URL: "Http://ip:port/sniperWS/services/address/getSuggestions.query", dataType: "JSON", data: { "address"
messages, one input and one output
2) web service implementation
1. binding element -- N more detailed operation
2. Service -- specify the server address of the web service
2,
The client call is as follows:
The XML description we generated last time is at this address:
Http: // 10.5.82.195/hellows? WSDL
1. Use the cxf tool to generate client code.
In the bin directory of cxf, there is our generation to
/ Changeawareclassloader)Previously initiated loading for a different type with name "Javax/xml/namespace/qname"Also jar package with WebLogic conflict, this conflict is Stax Stax-api, deleteConflict 4:Java.lang.LinkageError:loader constraint Violation:when Resolving interface method "Org.w3c.dom.Node.setUserData ( ljava/lang/string; Ljava/lang/object; Lorg/w3c/dom/userdatahandler;) Ljava/lang/object; "The class loader (instance of weblogic/utils/classloaders/ Changeawareclassloader) of the curr
Why design interceptors?1. In order to dynamically manipulate the request and response data during the WebService request process, CXF designed the InterceptorInterceptor Classification:1. Divide by Location: Server-side interceptors, client interceptors.2. According to the direction of the message: Into the interceptor, out of the interceptor.3. By definition: System interceptors, custom interceptors.Client Add log Blocker PackageCom.client.intercept
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.