- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个预先存在的 Web 服务“连接”(SOAP),如果可能,我想在不使用 Swing 框架的情况下调用。我遵循了使用 cxf/wsdl2java 工具生成我的 java 文件的 contact first development。
我希望从 java 对象中提取用户名和密码并将其放置在 SOAP 对象中,然后发送到我的本地主机 Web 服务。
将 Connect 对象作为正文发送到“direct:start”时,出现异常...
Caused by: java.lang.IllegalArgumentException: Get the wrong parameter size to invoke the out service, Expect size 2, Parameter size 1. Please check if the message body matches the CXFEndpoint POJO Dataformat request.
public class TestConnectCXF extends CamelTestSupport
{
@Override
protected RouteBuilder createRouteBuilder() throws Exception
{
return new RouteBuilder()
{
String cxfAddressLine = "cxf:http://localhost:8081/nuxeo/webservices/privateadservice?wsdlURL=wsdl/privateadservice.wsdl" //
+ "&dataFormat=POJO" //
+ "&serviceClass=com.sandbox.camelfeed.PrivateAdServiceInterface" //
+ "&serviceName={http://ws.sandboxtest.com/}PrivateAdService" //
+ "&synchronous=true" //
+ "&loggingFeatureEnabled=true" //
+ "&portName={http://ws.sandboxtest.com/}PrivateAdServiceInterfacePort";
@Override
public void configure() throws Exception
{
from("direct:start").to(cxfAddressLine).to("mock:end");
}
};
}
@Test
public void testConnectViaPojo() throws InterruptedException
{
Connect connectToServer = new Connect();
connectToServer.setUserName("FakeUser");
connectToServer.setPassword("scrubbed");
template.sendBody("direct:start", connectToServer);
Thread.sleep(1000);
}
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "connect", propOrder = {
"userName",
"password"
})
public class Connect {
protected String userName;
protected String password;
public String getUserName() {
return userName;
}
public void setUserName(String value) {
this.userName = value;
}
public String getPassword() {
return password;
}
public void setPassword(String value) {
this.password = value;
}
}
@WebService(targetNamespace = "http://ws.sandboxtest.com/", name = "PrivateAdServiceInterface")
@XmlSeeAlso({ObjectFactory.class})
public interface PrivateAdServiceInterface {
// Omitted Code relating to other web calls
@WebResult(name = "return", targetNamespace = "")
@RequestWrapper(localName = "connect", targetNamespace = "http://ws.sandboxtest.com/", className = "com.sandbox.camelfeed.Connect")
@WebMethod
@ResponseWrapper(localName = "connectResponse", targetNamespace = "http://ws.sandboxtest.com/", className = "com.sandbox.camelfeed.ConnectResponse")
public java.lang.String connect(
@WebParam(name = "userName", targetNamespace = "")
java.lang.String userName,
@WebParam(name = "password", targetNamespace = "")
java.lang.String password
) throws ClientException_Exception;
}
@XmlRegistry
public class ObjectFactory {
{
// Omitted other web calls information
private final static QName _Connect_QNAME = new QName("http://ws.sandboxtest.com/", "connect");
@XmlElementDecl(namespace = "http://ws.sandboxtest.com/", name = "connect")
public JAXBElement<Connect> createConnect(Connect value) {
return new JAXBElement<Connect>(_Connect_QNAME, Connect.class, null, value);
}
}
最佳答案
根据我的经验,在 Camel 中有一些事情,比如调用 SOAP Web 服务或进行 REST 调用,在自定义处理器中比使用像 CXF、HTTP 或 HTTP4 这样的组件更容易完成。
我通常使用 Spring,因此我倾向于使用 Spring REST 模板或 JaxWsPortProxyFactoryBean(用于 Web 服务调用)进行出站调用。
下面是一个使用 JAX-WS 调用的示例:
public class WebServiceProcessorBean {
@Autowired
private JAXWSProxy theProxy;
public void callWebservice(Exchange exchange) {
Response response = theProxy.call();
//Do something with the response and Exchange.
}
}
<bean id="theProxyService" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
<property name="serviceInterface" value="XXX"/>
<property name="wsdlDocumentUrl" value="http://xxxxx.wsdl"/>
<property name="namespaceUri" value="xxxx"/>
<property name="serviceName" value="xxxx"/>
<property name="portName" value="xxxxx"/>
</bean>
.beanRef("theProxyService", "callWebservice")
关于soap - 使用 Java DSL 的 Camel CXF POJO 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13133167/
我们有一个系统,其行为由许多 XML 文件定义。(大约 50 个不同的 XML 文件,每个文件管理子系统的行为。) 出于遗留原因,XML 文件采用自定义格式,旨在方便系统中的各种组件使用。 自定义格式
我发送的 json 请求是: Given url applicationURL And path 'applications' And header Authorization = subscribe
默认情况下,生成的 XText 工件会从我的 DSL 生成代码到默认 socket (默认为 src-gen 文件夹)。我知道您可以在 fsa.generateFile("myfile.txt", "
我的论文主题一般是关于领域特定语言的,我想专注于外部或内部 DSL 的设计或实现,但我什至无法思考或开始,因为我在理解 DSL 的概念方面遇到了问题.. 我已经阅读并收集了很多关于这个问题的论文和调查
我有一个 Xtext 项目和几个示例 DSL 文件。我可以使用“示例 Ecore 模型编辑器”打开这些文件并验证它是否符合 Xtext 生成的元模型。但是,由于 DSL 文件未被识别为 Ecore,我
当我学习一些 DSL 时,我意识到 Rebol 中的 Parse 方言可以是一个很好的词法分析器和解析器。 the Parse tutorial 有一个很好的例子: expr: [ter
我正在考虑使用亚马逊云服务(EC2、S3 等)进行托管。我一直在查看可以指定用于配置各种实例的 JSON 元数据,我担心它的复杂性。是否有一个 dsl 可以生成有效的 JSON 元数据并且更重要的是验
我可能会因为这个而被否决,但无论如何我都会试试运气。 我真的找不到 Elastic Search 查询 DSL 的完整形式“DSL”的任何链接,甚至在 Elastic Search 网站上也找不到 h
这个问题可能是复合的,让我扩展一下: 是否存在设计器( stub /框架/元设计器)来创建基于 .NET 对象公共(public) bool 属性的 AND/OR 规则?保存为任何 DSL/Boo/.
与 anko 一样你可以这样写回调函数: alert { title = "" message = "" yesButton { toast("Yes")
我有一个像下面这样的原始聚合脚本,但是很难将其转换为elasticsearch dsl。 我已阅读该文档并找到描述,说我们可以使用.bucket()、. metric()和.pipeline()方法来
如何将这个 gradle groovy 片段转换为 gradle kotlin dsl 而不是非常冗长? test { systemProperties System.getPropertie
这个问题是 ANY operator with jOOQ 的衍生问题和 Are arrays optimized in jOOQ & PostgreSQL? . 我有一个Field field和Lis
我创建了内部 DSL,并且会重载 DefaultGroovyMethods 中的 any() 方法。 class RulesProcessor { } Any live cell with fewer
我正在尝试使用 Gradle 使用 Kotlin 和 Java 11 构建一个简单的 JavaFX 11 程序,按照说明 here .但是,此页面使用 Gradle 的 Groovy DSL,而我正在
如何将这个 gradle groovy 片段转换为 gradle kotlin dsl 而不是非常冗长? test { systemProperties System.getPropertie
我是 Camel 的新手,我仍在学习它,根据我的理解,你可以在 Spring DSL 中做与 Java DSL 相同的事情。我想知道如何将一种转换为另一种?我经常看到 Java 中的例子,但想要 最佳
我正在尝试通过 Groovy 代码为 Jenkins Job DSL 插件创建 ListView 。运行后, View 已创建,但不会添加任何作业。以下代码段之前的代码创建了构建和部署作业,并且在调用
对于 Jenkins 作业 DSL,我试图为作业选择特定的 ssh 代理(插件)键(在包装器上下文中使用 sshAgent 关键字)。我们安装了 Jenkins ssh 代理插件并设置了几个 key
我必须为非程序员(我们公司的客户)创建一个 DSL,它需要提供一些更高级别的语言功能(循环、条件表达式、变量...... - 所以它不仅仅是一个“简单”的 DSL)。 使用 DSL 应该很容易;人们应
我是一名优秀的程序员,十分优秀!