问题描述
- CXF 短信接口 客户端调用
-
就给了一个链接,需要用户密码验证:
参考网络写的客户端调用
通过添加拦截器进行用户密码验证
错误信息:
2015-11-11 13:05:35 org.apache.cxf.common.jaxb.JAXBUtils logGeneratedClassNames
信息: Created classes: declare.message.chinatax.DeleteMessagesRequest, declare.message.chinatax.GetForbiddenPhoneNumbersRequest, declare.message.chinatax.GetForbiddenPhoneNumbersResponse, declare.message.chinatax.GetMessagesRequest, declare.message.chinatax.GetMessagesResponse, declare.message.chinatax.GetSrcIdRangeResponse, declare.message.chinatax.InstallForbiddenPhoneNumbersRequest, declare.message.chinatax.Message, declare.message.chinatax.MessageForbiddenNumber, declare.message.chinatax.MessageReceipt, declare.message.chinatax.MessageReceiptRecord, declare.message.chinatax.MessageReceiveRecord, declare.message.chinatax.MessageToSend, declare.message.chinatax.ObjectFactory, declare.message.chinatax.ReceiptMessagesRequest, declare.message.chinatax.ReceiptMessagesResponse, declare.message.chinatax.ReceiveMessagesRequest, declare.message.chinatax.ReceiveMessagesResponse, declare.message.chinatax.SendMessagesRequest
2015-11-11 13:05:37 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
警告: Interceptor for {http://chinatax.message.declare/}MessageDeclareService#{http://chinatax.message.declare/}sendMessages has thrown exception, unwinding now
java.lang.IllegalArgumentException: Part {http://chinatax.message.declare/}sendMessagesRequest should be of type declare.message.chinatax.SendMessagesRequest, not java.lang.String
at org.apache.cxf.jaxb.io.DataWriterImpl.checkPart(DataWriterImpl.java:284)
at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:212)
at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:122)
at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:572)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:481)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:355)
at com.oking.taskManage.SMS.SMS_Client.sendMessages(SMS_Client.java:25)
at com.oking.taskManage.SMS.SMS_Client.main(SMS_Client.java:47)
java.lang.IllegalArgumentException: Part {http://chinatax.message.declare/}sendMessagesRequest should be of type declare.message.chinatax.SendMessagesRequest, not java.lang.String
at org.apache.cxf.jaxb.io.DataWriterImpl.checkPart(DataWriterImpl.java:284)
at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:212)
at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:122)
at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:572)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:481)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:355)
at com.oking.taskManage.SMS.SMS_Client.sendMessages(SMS_Client.java:25)
at com.oking.taskManage.SMS.SMS_Client.main(SMS_Client.java:47)
解决方案
cxf 客户端调用
cxf 客户端调用两种方式
cxf 客户端调用异常