问题
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.
Get the wrong parameter size to invoke the out s ervice, Expect size 1, Parameter size 2. Please check if the message body matches the CXFEndpoint POJO Dataformat request.
Here is my web service method
public String sendSMSRequest(
@WebParam(name = "clientRequestXML", targetNamespace = "http://www.openuri.org/")
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>
please help me to solve this problem. I want to send String with comma (,)
回答1:
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);
来源:https://stackoverflow.com/questions/25420522/how-to-pass-string-including-comma-in-cxf-service-method