cxf

Spring整合CXF发布及调用WebService

给你一囗甜甜゛ 提交于 2020-01-02 15:23:47
这几天终于把webService搞定,下面给大家分享一下发布webService和调用webService的方法 添加jar包 (官方下载地址: http://cxf.apache.org/download.html 为了方便扩展我把所有的jar包都加了) 在web.xml中配置spirng以及CXF <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name></display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <!-- spring --> <context-param> <param-name>contextConfigLocation</param

How to throw Soap Fault manually in mule

旧时模样 提交于 2020-01-02 07:27:49
问题 I'm face with a situation where we cannot use schema to validate incoming request (basically schema is there but it accepts any String in request, wsdl designers have their own reasons to do that to accept request from different sources and flexibility). But when the request is received, I validate that the child element of request wrapper is what we expect (using XPath for that). Now if the child element is not what expected, I'd like to throw Soap Fault with Client code and may be include

Stop Apache CXF logging binary data of MultipartBody attachments

本秂侑毒 提交于 2020-01-02 07:10:02
问题 I need to stop CXF from logging the binary data of attachments in a MultipartBody object (which is being thrown out by the AbstractLoggingInterceptor in the Outbound Message). When I add my LoggingInInterceptor , I am setting setShowBinaryData to false, but this doesn't seem to stop binary data within a multipart message from being logged. I am unsure whether I need to create a custom loggingInInterceptor, or whether there is a way of configuring the existing interceptors to truncate any

Turn off java.util.logging for a specific package programmatically

 ̄綄美尐妖づ 提交于 2020-01-02 04:50:52
问题 I am using an SDK that uses Apache CXF internally. Apache CXF uses the java.util.logging package for logging by default. I want to change the logging level from INFO to WARNING or turn it off completely. Can I do this programmatically in the main method of my application? 回答1: There is a way to do this programatically, but it's not intuitive. Changing to SLF4J or Log4J may be better if you end up needing control at a a finer level or over multiple classes The issue is that Loggers are cached

How to deal with input parameter in CXF request handler in general?

不羁的心 提交于 2020-01-01 12:09:34
问题 I have been doing some work with apache CXF(version 2.2.2) JAX-RS. I am trying to introduce data validation layer in CXF request handler before business method be invoked. Fortunately :), I am encountering an issue on input parameter handling in request handler(DataValidationHandler). I can read the JSON Object manually by following code lines in request handler. But it's duplicated with JSONProvider registered in CXF framework. Because JSON object input stream only can be read once,

How to use CXF client in thread safe way

南笙酒味 提交于 2020-01-01 10:04:29
问题 I have created the client stub for below service using apache-cxf 's wsdl2java command. http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL Then I invoke the getWeatherInformation() method as below. Weather weatherService = new Weather(); WeatherSoap weatherSoap = weatherService.getWeatherSoap(); ArrayOfWeatherDescription result = weatherSoap.getWeatherInformation(); I have read that cxf clients are thread safe. But I have a doubt whether it is safe to use the same WeatherSoap instance accross

Enable gzip compression in CXF client

ぐ巨炮叔叔 提交于 2020-01-01 09:18:07
问题 I'm trying to make my client use gzip. I have the GZip Feature enabled in the server. It seems that the client it's not sending the correct header: POST /api/v1/data HTTP/1.1 Content-Type: text/xml; charset=UTF-8 Accept: */* SOAPAction: "" User-Agent: Apache CXF 2.6.2 Cache-Control: no-cache Pragma: no-cache Host: localhost:8001 Connection: keep-alive Content-Length: 539 Here's the code where I create the client: private static final QName SERVICE_NAME = new QName( "http://xxx/", "IData");

How to modify the generated SOAP request?

浪子不回头ぞ 提交于 2020-01-01 08:47:12
问题 I'm at the stage where I created an output interceptor and I get an OuputStream out of the SOAP message. But how could I modify the SOAP envelope right before sending it to the endpoint? I would like to delete some xml elements. 回答1: one way could be to get the document and run it through XSLT transform. You can get at the document in the handleMessage of your interceptor by calling @Override public void handleMessage(SoapMessage message) throws Fault{ SOAPMessage saaj = message.getContent

Catching the SOAP Fault error in custom interceptor (Soap12FaultOutInterceptor)

风格不统一 提交于 2020-01-01 05:49:09
问题 I wrote a custom CXF interceptor to log all the SOAP request and responses into the database and it seems to be working fine with positive test cases and server errors. But when a SOAP Fault occurs it just neglects my interceptor and nothing is logged. Custom CXF interceptors. public class DbLogOutInterceptor extends AbstractSoapInterceptor { public void handleMessage(SoapMessage message) { logger.info("Handling outbound request"); String transaction = MDC.get(mdcKey); logger.info("OutBound

WebService / java.net.SocketTimeoutException: Read timed out

…衆ロ難τιáo~ 提交于 2020-01-01 05:16:11
问题 I am facing an issue in WebService, in details : Caused by: org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222) at org.apache.cxf