unable to attach .xlsx file into the mail

Hi Everyone,

I am trying to get the file as bytes in getFile service, and passing that to the smtp service attachments.
I am using contenttype as: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet and file name as “test.xlsx”.
But I am getting this error:

java.lang.ClassCastException: com.wm.util.Values cannot be cast to java.lang.String
at pub.clientimpl.smtp(clientimpl.java:354)
at sun.reflect.GeneratedMethodAccessor1969.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:441)
at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:649)
at com.wm.app.b2b.server.util.tspace.ReservationProcessor.process(ReservationProcessor.java:39)
at com.wm.ps.serviceMock.ServiceInterceptor.process(ServiceInterceptor.java:375)
at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:49)
at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:243)
at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
at com.wm.app.b2b.server.invoke.PipelineProcessor.process(PipelineProcessor.java:171)
at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:303)
at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:34)
at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:370)
at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:548)
at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:385)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:238)
at com.wm.app.b2b.server.BaseService.invoke(BaseService.java:225)
at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java:247)
at com.wm.lang.flow.FlowState.invokeNode(FlowState.java:520)
at com.wm.lang.flow.FlowState.stepIncremental(FlowState.java:437)
at com.wm.lang.flow.FlowState.invoke(FlowState.java:331)
at wm.server.flowdebugger.stepFlow(flowdebugger.java:992)
at wm.server.flowdebugger.execute(flowdebugger.java:508)
at sun.reflect.GeneratedMethodAccessor801.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:451)
at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:649)
at com.wm.app.b2b.server.util.tspace.ReservationProcessor.process(ReservationProcessor.java:39)
at com.wm.ps.serviceMock.ServiceInterceptor.process(ServiceInterceptor.java:375)
at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:49)
at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:243)
at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
at com.wm.app.b2b.server.invoke.PipelineProcessor.process(PipelineProcessor.java:171)
at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:303)
at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:34)
at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:370)
at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:548)
at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:385)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:238)
at com.wm.app.b2b.server.comm.DefaultServerRequestHandler.handleMessage(DefaultServerRequestHandler.java:119)
at com.wm.app.b2b.server.HTTPMessageHandler.process(HTTPMessageHandler.java:156)
at com.wm.app.b2b.server.HTTPDispatch.handleRequest(HTTPDispatch.java:179)
at com.wm.app.b2b.server.Dispatch.run(Dispatch.java:384)
at com.wm.util.pool.PooledThread.run(PooledThread.java:127)
at java.lang.Thread.run(Thread.java:745)

Can somebody please help me here.

Regards
Jyoti

Hi Jyoti,

when receiving the file as bytes this is represented as a ByteArray.

You will have to convert the ByteArray to String before you can put in the attachments field.

See build in services in the WmPublic package under pub.string for an appropriate service.

Regards,
Holger

Hi Holger,

The issue is resolved now. I was not dropping the output of getFile service which was getting carried forward to the pipeline of the smtp service.
Now, I am able to get the attachments in the mail.
But the problem is, while I am trying to open the .xlsx file from the mail, its giving the “Excel can not open the file” error.
Can you please suggest a solution.

Regards
Jyoti