how to covert streamTobyte?

Hi All,

Need quick resolution

i am using FTP port to invoke by service.i have created FTP port.
but when i am putting file in /ns/directory by logging into FTP server
& placed file in ns directory as xyz.dat

  1. Set a flow input variable named ffdata.
    2 use pub.io:streamToBytes
    map ffdata to stream bytes to xyzbyte variable
    but while debugging i am getting class cast exception

i don’t know why this exception is coming … any help appreciated

RJ

Are you setting the content-type when doing the FTP put? Refer to the Flat File Schema Developer’s Guide for additional info.

Hi Rob,

I have create FTP port to invoke that service.
just doing this steps to placed in directory.Once file is placed it will invoke my service.

ftp> open ebzwisd1.eadv.na.jnj.com 7802
Connected to ebzwisd1.eadv.na.jnj.com.
220 ebzwisd1.eadv.na.jnj.com:7802 FTP server (webMethods Integration Server version 7.1.2.0) ready.
User (ebzwisd1.eadv.na.jnj.com:(none)): xyz
331 Password required for LYNX_AccessFTP.
Password:
230 User xyz logged in.
ftp> cd /ns/PU009_LYNX_JHJL_Inb_v1/JHJL_Inbound/DPYCHESS_Inbound
250 CWD command successful.
ftp> put gltrans.dat

So input of my service is ffdata

First step of my service is pub.io.stremtobytes
but once ffdata come in service & after executing tht streamtobyte step
it sudden went to catch block.
input is node =com.wm.lang.xml.Node:-1:217918892
Error message= java.lang.ClassCastException
java.lang.ClassCastException: com.wm.data.ISMemDataImpl
at pub.io.streamToBytes(io.java:77)
at sun.reflect.GeneratedMethodAccessor752.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:403)
at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:631)
at com.wm.app.b2b.server.util.tspace.ReservationProcessor.process(ReservationProcessor.java:40)

shall i missing anything

RJ

I believe you have a xml node (input is node =com.wm.lang.xml.Node:-1:217918892) representation in the pipeline instead of having stream object.So make sure you have the stream/ffdata (stream representation) to make streamToBytes service work.

HTH,
RMg

What is present in the pipeline when the service is invoked depends upon the content type. If the polling port does not specify a content type value, then the filename extension MIME mapping will be used. I do not know what .dat would map to.

If you haven’t done so, please read the Flat File Schema Developer’s Guide.

Putting the file work directories within the IS package structure, which it appears you are doing with the /ns/… path, is not a good idea. The work directories should be at least be outside of the IS directory tree and ideally on their own volume.

Hi Rob & RMG,

This Issue still not resolve.
Basically my source team using some scripts to placed file in ftp directory start with /ns/…/… as follows is scripts wch is not working & getting error
550 ÝISS.0071.9014¨ Server Error: com.wm.data.ISMemDataImpl

EZA1736I PUT ‘SXK1.P0.ZKE381.ZKF80A.G3990V00’ SXK381_990 (file name=SXK381_990 )
EZA1701I >>> PORT 10,4,101,139,12,158
200 PORT command successful.
EZA1701I >>> STOR SXK381_990
150 ASCII mode data connection for SXK381_990 (10.4.101.139,3230).
550 ÝISS.0071.9014¨ Server Error: com.wm.data.ISMemDataImpl (error)
EZA1735I Std Return Code = 27550, Error Code = 00002
EZA1701I >>> QUIT
221 Goodbye


but if i simple change scripts & added file extension to above scripts then it work fine don’t know why …?

EZA1736I PUT ‘SXK1.P0.ZKE381.ZKF80A.G3990V00’ SXK381_990.TXT (file name=SXK381_990.TXT )
EZA1701I >>> PORT 10,4,101,139,12,158
200 PORT command successful.
EZA1701I >>> STOR SXK381_990
150 ASCII mode data connection for SXK381_990 (10.4.101.139,3230).
EZA1701I >>> QUIT
221 Goodbye


If line of code using Ftp port .
step 1 pub.io.streamToBytes
object ffdata mapped to stream bytes to in_bytes

appreciate quick reply

thnx
RJ

As mentioned earlier, you either must set the content-type during the FTP put or use a supported filename extension. Refer to the Flat File Schema Developer’s Guide.

Hi Rob,

i got your point that we have to set content handler… thanks again.

Is there any way you can help me for below error. as it’s affecting by business severly

C:\Documents and Settings\rjambh\SAPR2>ftp
ftp> open servername port number
Connected to servername.
220 ebzwisd1.eadv.na.jnj.com:7802 FTP server (webMethods Integration Server version 7.1.2.0) ready.
User (server name:(none)): user name
331 Password required for user name.
Password:
230 User LYNX_AccessFTP logged in.
ftp> cd /ns/…/…/…/…
250 CWD command successful.
ftp> dir
200 PORT command successful.
150 ASCII mode data connection for /bin/ls (172.32.99.108,2141).
total 0
dr-xr-xr-x 3 root root 0 Mar 11 09:55 .
dr-xr-xr-x 3 root root 0 Mar 11 09:55 …
226 ASCII transfer complete.
ftp: 148 bytes received in 0.00Seconds 148000.00Kbytes/sec.
ftp> put xyz
200 PORT command successful.
150 ASCII mode data connection for sxk381_990 (172.32.99.108,2153).
550 [ISS.0071.9014] Server Error: com.wm.data.ISMemDataImpl
ftp: 39870 bytes sent in 0.00Seconds 39870000.00Kbytes/sec.

May i know why i am facing this server issue while placing file.
Is there any setting or permission are missing for ftp user,ftp server or directory…?

appreciate your quick repsonse

RJ

When you posted with the .txt extension it worked. Without any extension, it does not work. So either use the right filename extension or set the content-type in the put. The lack of content-type or a supported filename extension is what is causing the error.

You might also consider using binary mode instead of ascii, though that has nothing to do with the error you’re seeing.

Hi Rob,

Thanks for quick reply but i don’t know some strange thing happen in this case i never put any content handler.
just adjusting some service it workout.

Previously in my code steps are:
1Sequence:Main
2SequenceTry
3pub.io.streamToBytes
ffdata to stream byte to byte
4Map : getting all FTP server dteails
5pub.client.ftp (serviceIn setting ie cmd-put,transfermode- ascii,transfertype-active)
map bytes to content

after just adjusting steps called pub.io.streamToByte as 1 step
1pub.io.streamToBytes
1Sequence:Main
2SequenceTry
3Map : getting all FTP server dteails
4pub.client.ftp

After doing this i am able to placed file without file extension it work fine.

RJ—