gpt4 book ai didi

cxf - 序言中的意外 EOF

转载 作者:行者123 更新时间:2023-12-01 06:45:02 28 4
gpt4 key购买 nike

在客户端,我通过以下方式创建了 3 个附件:

public String sendMessage(MMSMessage mmsMessage, String formatCDR, FlowSessionData flowSessionData)
throws IOException, ServiceException, PolicyException {

SendMessage sendMessage = sendMessageService.getSendMessage();
int index = 1;
List<Attachment> atts = new ArrayList<Attachment>();
BufferedImage image = ImageIO.read(new URL(mmsMessage.getImgPath()));
atts.add(createAttachmentPart(mmsMessage.getImgMimeType(), image, index));
if (mmsMessage.getPrerollText() != null) {
atts.add(createAttachmentPart("text/plain", mmsMessage.getPrerollText(), index++));
}
if (mmsMessage.getPostrollText() != null) {
atts.add(createAttachmentPart("text/plain", mmsMessage.getPostrollText(), index++));
}
setServiceParams((BindingProvider) sendMessage, atts, configService.getSendMessageEndpointAddress());
String value = null;
validateURI(configService.getParlayxCallbackEndpointService() + "/" + NOTOFICATION_MMS_INTERFACE);
SimpleReference correlator = new SimpleReference();
correlator.setCorrelator(formatCDR);
correlator.setInterfaceName(NOTOFICATION_MMS_INTERFACE);
correlator.setEndpoint(configService.getParlayxCallbackEndpointService() + "/" + NOTOFICATION_MMS_INTERFACE);
String toNumber = mmsMessage.getSmsServiceActivationNumber().get(0);
if (!toNumber.startsWith(MSGConstants.PHONE_URI_PREFIX)) {
if (!toNumber.startsWith("+")) {
toNumber = "+" + toNumber;
}
toNumber = MSGConstants.PHONE_URI_PREFIX + toNumber;
}
validateURI(toNumber);
List<String> addr = new ArrayList<String>();
addr.add(toNumber);
value = sendMessage.sendMessage(addr, mmsMessage.getSenderAddress(), mmsMessage.getSubject(), null, null,
correlator);
LOGGER.info(value);
return value;
}

private Attachment createAttachmentPart(String mimeType, Object data, int index) {
return new AttachmentImpl(String.valueOf(index), new DataHandler(data, mimeType));
}

private void setServiceParams(BindingProvider serviceInf, Collection<Attachment> attachments, String endPoint) {
Map<String, Object> requestContext = serviceInf.getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPoint);
requestContext.put(BindingProvider.USERNAME_PROPERTY, configService.getParlayxEndPointUserName());
requestContext.put(BindingProvider.PASSWORD_PROPERTY, configService.getParlayxEndPointPassword());
final Client client = ClientProxy.getClient(serviceInf);
final HTTPConduit http = (HTTPConduit) client.getConduit();
final HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setReceiveTimeout(configService.getParlayxEndPointTimeOut());
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setConnectionTimeout(configService.getParlayxEndPointTimeOut());
http.setClient(httpClientPolicy);
if (attachments != null && !attachments.isEmpty()) {
requestContext.put(org.apache.cxf.message.Message.ATTACHMENTS, attachments);
}
}

我收到下面的异常,是什么原因导致的,我该如何解决?

WARNING: Interceptor for {http://www.csapi.org/wsdl/parlayx/multimedia_messaging/send/v2_4/service}SendMessageService#{http://www.csapi.org/wsdl/parlayx/multimedia_messaging/send/v2_4/interface}sendMessage has thrown exception, unwinding now org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader. at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:222) at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:60) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255) at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:755) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2335) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2193) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2037) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:697) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) at $Proxy92.sendMessage(Unknown Source) at com.amobee.common.sms.ParlayxMessagingService.sendMessage(ParlayxMessagingService.java:105) at com.amobee.nc.protocol.msg.MMSResponseBuilder.buildResponseMessage(MMSResponseBuilder.java:96) at com.amobee.nc.protocol.msg.BaseMSGResponseWriter.getResponse(BaseMSGResponseWriter.java:59) at com.amobee.nc.protocol.AbstractResponseWriter.write(AbstractResponseWriter.java:75) at com.amobee.frontend.servlets.AbstractBaseServlet.runCommand(AbstractBaseServlet.java:124) at com.amobee.frontend.servlets.AbstractBaseServlet.doGet(AbstractBaseServlet.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:575) at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog at [row,col {unknown-source}]: [1,0] at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:682) at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2090) at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:1996) at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1100) at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1123) at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:122) ... 40 more



谢谢,丹妮拉

最佳答案

此异常意味着您在 XML 消息中有文件结束符,您应该使用 Base64bit 类型在 Web 服务中使用附件以避免此类错误。

关于cxf - 序言中的意外 EOF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6507986/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com