如何在CXF服务方法中传递包含逗号的字符串 [英] how to pass String including comma in CXF service method

查看:57
本文介绍了如何在CXF服务方法中传递包含逗号的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用骆驼cxf组件来调用网络服务。我正在尝试传递带有逗号(,)的XML字符串。当我尝试传递XML字符串时,它抛出以下错误。

I'm using camel cxf component to call web service. I'm trying to pass XML String, which has a comma (,). when I'm trying to pass XML string it throws below error.

获取错误的参数大小以调用输出
服务,期望大小1,参数大小2。请检查消息正文是否与CXFEndpoint POJO数据格式请求匹配。

这是我的Web服务方法

Here is my web service method

public String sendSMSRequest(
    @WebParam(name = "clientRequestXML", targetNamespace = "http://www.openuri.org/")
    String clientRequestXML);

我在XML String下面传递为clientRequestXML。

I'm passing below XML String as clientRequestXML.

<BODY>
        <SCODE/>
        <SMSSERVICE>
            <SENDSMS_REQ>
                <TO>
                    <CIFNUMBER>73</CIFNUMBER>
                    <MOBILE>null</MOBILE>
                    <LANG>2</LANG>
                    <MESSAGE>Dear SCUST2, your id is 1112</MESSAGE>
                </TO>
            </SENDSMS_REQ>
        </SMSSERVICE>
    </BODY>

请帮助我解决此问题。我想发送带逗号(,)的String

please help me to solve this problem. I want to send String with comma (,)

推荐答案

CxfProducer(采用POJO数据格式)需要一个列表。它解析字符串,并且逗号被解释为列表分隔符。您应该将列表作为请求传递。例如:

CxfProducer (in the POJO data format) expects a List. It parses the String and the comma gets interpreted as a list separator. You should pass the List as a request. For example:

Arrays.asList(clientRequestXML);

这篇关于如何在CXF服务方法中传递包含逗号的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆