cxf

How to put SAML token directly into JAX-WS service without calling STSClient

我只是一个虾纸丫 提交于 2020-03-03 23:29:32
问题 Last year I made JAX-WS client for a web service in this link This webservice use a STS service to get SAML token and use it to access main webservice. I use wsdl2java of apache cxf to generate JAX-WS client for this webservice. Everything was just fine. Recently they have updated their STS service endpoint. This new STS service endpoint. Which has different signature and digest algorithm. It has some extra element in request body. I tried to modify current code so that it support new STS

How to put SAML token directly into JAX-WS service without calling STSClient

大兔子大兔子 提交于 2020-03-03 23:28:54
问题 Last year I made JAX-WS client for a web service in this link This webservice use a STS service to get SAML token and use it to access main webservice. I use wsdl2java of apache cxf to generate JAX-WS client for this webservice. Everything was just fine. Recently they have updated their STS service endpoint. This new STS service endpoint. Which has different signature and digest algorithm. It has some extra element in request body. I tried to modify current code so that it support new STS

CXF生成webservice客户端 发生undefined element declaration

血红的双手。 提交于 2020-02-28 14:23:15
CXF生成webservice客户端 发生undefined element declaration 's:schema' 今天在使用CXF的wsdl2java 根据wsdl文件生成客户端调用时出现以下错误: 因为也是临时接触CXF,所以一时不知是什么问题,在网上搜了半天,都是说要替换什么内容之类的,但也没说为什么,而且基本都是转载国外某人的一个文章,所以决心了解下为什么? 根据错误提示似乎是找不到s:schema,查看了一下.net生成的wsdl文件,在文件头部有s:schema命名空间的定义: xmlns:s= http://www.w3.org/2001/XMLSchema 但同时也发现CXF生成的wsdl文件也用到了类似的元素,只不过定义的命名空间名称略有差异:xmlns:xs= http://www.w3.org/2001/XMLSchema 因此基本可以排除找不到s:schema元素的问题原因肯定不是XML本身定义的问题了。 紧接着又看了下wsdl的引入是否会存在版本问题,在对比了JAVA和.NET的WSDL文件后,感觉版本也应该是一致的。因此wsdl的版本原因也可以排除。 http://schemas.xmlsoap.org/wsdl/ (java) http://schemas.xmlsoap.org/wsdl/soap/ (.net) 经过思考,决定从

CXF添加自定义拦截器

与世无争的帅哥 提交于 2020-02-24 22:43:01
前面我们说到CXF添加内置的拦截器,今天的话,我们来讲下如何添加自定义拦截器; 我们的实例是客户端访问服务端webservice接口要加权限认证。 我们思路先说下。我们可以通过在SOAP消息的Header头信息中添加自定义信息,然后发送到服务端端,服务器端通过获取 Header头消息,然后进行认证;这里的添加消息,和获取消息认证,我们都是通过自定义拦截器来实现; OK下面我们来实现下: 首先是服务器端: 我们自定义拦截器:MyInterceptor 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 package com.java1234.interceptor; import java.util.List; import org.apache.cxf.binding.soap.SoapMessage; import org.apache.cxf.headers.Header; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.phase

Spring整合CXF之添加拦截器

让人想犯罪 __ 提交于 2020-02-24 22:39:40
今天主要来讲解下如何在Spring整合CXF环境下,添加拦截器; 这里我们给下官方的参考文档: http://cxf.apache.org/docs/jax-ws-configuration.html 结合官方文档,我们在前面的实例基础上,加代码: 首先我们把前面的自定义拦截器 MyInterceptor 贴进来。 然后我们打开spring配置文件,applicationContext.xml 根据官方文档:我们通过jaxws:inInterceptors jaxws:outInterceptors 这两个标签来添加in拦截器和out拦截器 我们修改下jaxws:endpoint 节点: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 <!-- 定义服务提供者 --> < jaxws:endpoint implementor = "#helloWorld" address = "/HelloWorld" > <!-- 添加in拦截器 --> < jaxws:inInterceptors > < bean class = "org.apache.cxf.interceptor.LoggingInInterceptor" /> < bean class = "com.java1234.interceptor.MyInterceptor" /> </ jaxws

CXF JAX-RS is causing BusException

浪尽此生 提交于 2020-02-24 12:12:27
问题 After adding a RESTFul service using Apache CXF to my Spring (and Wicket) project I get the following exception: org.apache.cxf.BusException: No binding factory for namespace http://apache.org/cxf/binding/jaxrs registered. I have included the row below in my Spring configuration and thought this would actually solve my problem. But it did not. import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" Any feedback regarding how to solve this problem or ideas in what areas to

When a list has only one element, CXF return the object instead a js array

只愿长相守 提交于 2020-02-24 04:23:02
问题 I'm using CXF to create restful services. One of the services return a list of string. When I have more than one item in the list, the CXF returns an array of strings, but when I have only one element, it returns the String instead an array with a json: With one Item: {"ImageResponse":{"images":"hello"}} With two Items: {"ImageResponse":{"images":["hello","hi"]}} Is there a way to always return a list, even when the list has only one item? My Response class: @XmlRootElement public class

When a list has only one element, CXF return the object instead a js array

我怕爱的太早我们不能终老 提交于 2020-02-24 04:21:32
问题 I'm using CXF to create restful services. One of the services return a list of string. When I have more than one item in the list, the CXF returns an array of strings, but when I have only one element, it returns the String instead an array with a json: With one Item: {"ImageResponse":{"images":"hello"}} With two Items: {"ImageResponse":{"images":["hello","hi"]}} Is there a way to always return a list, even when the list has only one item? My Response class: @XmlRootElement public class

WebService开发

天大地大妈咪最大 提交于 2020-02-10 15:40:57
ApacheCXF 框架介绍 关于 Apache CXF Apache CXF = Celtix + XFire,ApacheCXF 的前身叫 Apache CeltiXfire,现在已经正式 更名为 Apache CXF 了,以下简称为 CXF。CXF 继承了 Celtix 和XFire 两大开源项目的精 华,提供了对 JAX-WS 全面的支持,并且提供了多种 Binding 、DataBinding、 Transport 以及各种 Format 的支持,并且可以根据实际项目的需要,采用代码优先 (Code First)或者 WSDL 优先(WSDL First)来轻松地实现 Web Services 的发布和使 用。目前它仍只是 Apache 的一个孵化项目。 Apache CXF 是一个开源的 Services 框架,CXF 帮助您利用 Frontend 编程 API 来构建和 开发 Services ,像 JAX-WS 。这些 Services 可以支持多种协议,比如:SOAP、 XML/HTTP、RESTfulHTTP 或者 CORBA ,并且可以在多种传输协议上运行,比如: HTTP、JMS 或者 JBI,CXF 大大简化了 Services 的创建,同时它继承了 XFire 传统,一 样可以天然地和 Spring 进行无缝集成。 功能特性 CXF 包含了大量的功能特性

Unable to set SOAP Header while calling Web Service through Camel using dataFormat as POJO

岁酱吖の 提交于 2020-02-08 07:38:43
问题 I am using Camel in our project and requesting WebServices, the dataFormat is POJO. I was able to request when my SOAP message did not contain SOAP headers, but when it had Headers, I was unable to set those. I looked at the documentation but was not able to understand and have several questions. I want to create a message like the below: <soapenv:Envelope`enter code here` xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http:/