webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Service to accept data with FTP

  • 1.  Service to accept data with FTP

    Posted Tue April 15, 2003 08:22 AM

    Hello,

    I try to load XML Files to the SAP BC 4.6 using ftp. I created a service to accept the data. As I understood the docu the XML File will be passed to the service as a node. Therefore I declared a node as an input for the service.
    I log in to the port for the ftp - service and change to the directory of the service (ls ns/FTPXML/FTPTestService), then I use the put command to put the file to the service (remote file test003.xml). The service in the folder is called but nothing is passed to the service.
    In the server log the following message appears:
    XMLCoder decode invalid data type: com.wm.lang.xml.Document

    What is wrong?
    Can anybody help me?

    Thanks
    Matthias


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 2.  RE: Service to accept data with FTP

    Posted Tue April 15, 2003 04:43 PM

    Did you set the content-type of the doc to be text:xml? Or does the filename end with .xml?

    You’ll need to do one of these so that the right content handler is invoked to create the node object that is passed to your service.


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 3.  RE: Service to accept data with FTP

    Posted Tue April 15, 2003 06:39 PM

    Hello Rob,

    the file I tried to load up is an XML File with the extension .xml.

    Where can I set the content-type?

    Thanks
    Matthias


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 4.  RE: Service to accept data with FTP

    Posted Tue April 15, 2003 07:25 PM

    The put command allows specifying the content type. The syntax is:

    put localFileName File name; content type: content sub-type

    As an example:

    put myFile remoteFile; text:xml

    But this probably isn’t the problem, if your remote file has an .xml extension. The issue is probably with the service definition itself or the XML doc.

    Can you post the specifics of the inputs and outputs of your service? Can you post the high-level structure of your XML?


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 5.  RE: Service to accept data with FTP

    Posted Wed April 16, 2003 08:58 AM

    Hello,

    If I try to the put command with ;text:xml the Server Log shows the message
    XMLCoder decode invalid data type: wm.server.net.FTPInputStream

    Otherwise the Server Log shows the message
    XMLCoder decode invalid data type: com.wm.lang.xml.Document

    I have trouble to post the xml file, because the browser only shows the values an not the complete text.

    I defined only one Input Pramater in the service Name: XMLDoc, Type: Object
    The serice contains only on step at the moment : SavePipelinetoFile- in the file I can see that there is no input at all.
    If I try to use stringToDocument I recieve the error that the input parameters are null.

    I tried with several different XML Files - the result is the same.

    Thanks
    Matthias


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 6.  RE: Service to accept data with FTP

    Posted Wed April 16, 2003 11:52 AM

    Hi, you should specify as input in your service an object node !!!

    SSII


    #Integration-Server-and-ESB
    #webMethods
    #webmethods-Protocol-and-Transport


  • 7.  RE: Service to accept data with FTP

    Posted Wed April 16, 2003 12:13 PM

    Hello,

    but how?
    I have only the following options of the type:
    String
    String List
    String Table
    Record
    Record List
    Record Reference
    Record Reference List
    Object
    Object List

    Thanks,
    Matthias


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 8.  RE: Service to accept data with FTP

    Posted Wed April 16, 2003 12:24 PM

    Hi,

    You say it : “Object”

    and the name of the object is “node”

    SSII


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 9.  RE: Service to accept data with FTP

    Posted Wed April 16, 2003 04:25 PM

    Hello,

    I renamed the object to node - Result is the same.
    Error Message in Server Log:
    XMLCoder decode invalid data type: com.wm.lang.xml.Document


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 10.  RE: Service to accept data with FTP

    Posted Wed April 16, 2003 04:48 PM

    Have you tried testing your service with Test | Send XML File… in Developer? When you select this menu item, it will prompt you to Select Test Mode. Select Step. Then it will prompt for a filename. Specify any XML file. As you step, you should see the node object on the Results tab.

    stringToDocument is not the right service to call when you have a node. A node is a Java object–more specifically it is an XML parse tree (probably a DOM object). You’ll want to use documentToRecord or maybe queryDocument. These services accept a node as input. Pass the node to documentToRecord and you’ll see your XML doc in record format on the Results tab.

    Let us know what you run into.

    This will help determine if the problem is with IS.


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 11.  RE: Service to accept data with FTP

    Posted Fri May 16, 2003 07:03 PM

    I’ve had a similar problem when debugging my FTP services. It turns out that there’s nothing wrong with the code of my service - it’s a problem with savePipelineToFile. Your incoming document is placed in the pipeline as a Java object, and savePipelineToFile chokes trying to save it. Even worse, after savePipelineToFile finishes it removes the offending object from the pipeline, so it’s no longer available for any remaining services in your code. The solution is to either use something other than savePipelineToFile in your debugging, or to place the savePipelineToFile invoke after you’ve already handled (and dropped from the pipeline) the Java object.


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 12.  RE: Service to accept data with FTP

    Posted Fri May 16, 2003 09:15 PM

    Try the following…

    No inputs are needed for your FTP service. But used the following service pub.xml:xmlNodeToDocument in your flow as the first service. It will convert the incoming FTP stream into document list.

    Manohar


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 13.  RE: Service to accept data with FTP

    Posted Thu January 15, 2004 12:25 PM

    Hi guys,

    I have the same problem, I think:

    I have a service (“receive”) that has input defined as “*ffdata”.
    This receives text docs via ftp, sent by “put <file> <file>; application/x-wmflatfile”
    I want to persist this file. I think the only way the IS will let me do this is via savePipelineToFile.
    I try this but I get the error: "XMLCoder decode invalid… wm.server.net.FTPInputStream

    I tried to write my own file writer passing in a filename and the *ffdata object:
    FileOutputStream f = new FileOutputStream(filename);
    f.write(byte)(<*ffdata object>);
    f.close()
    However, this throws a nullpointerexception. It is almost as if the *ffdata object is not there. However, when I do a getTransportInfo, all the required information is present.

    Does anyone have any further suggestions?

    Thanks,

    ant


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 14.  RE: Service to accept data with FTP

    Posted Thu January 15, 2004 12:45 PM

    further to the previous message, I put logging on level 10 and got the following output at the point where I try to map to my write server:

    “Copy failed: No source data available: to=/document, from=/*ffdata”

    Thanks


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 15.  RE: Service to accept data with FTP

    Posted Thu January 15, 2004 01:59 PM

    Anthony,

    Before we do our savePipelineToFile, we run the following 3 steps:

    1. pub.io:streamToBytes (no input)
    2. pub.string:bytesToString
    3. pub.flatFile:convertToValues (map string into ffData)

    Hope this helps.

    Dave


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 16.  RE: Service to accept data with FTP

    Posted Thu March 04, 2004 07:24 PM

    webMethods Node object is com.wm.lang.xml.Document. I want to convert it to org.w3c.dom.Document object. Is there any way to do that. I wanted to do this because I do not want to convert the webMethods node object to string and parse it again to get org.w3c.dom object. I want to avoid parsing as IO manipulate the xml at different places and want to work on the org.w3c.dom object.


    #Integration-Server-and-ESB
    #webMethods
    #webmethods-Protocol-and-Transport


  • 17.  RE: Service to accept data with FTP

    Posted Fri May 07, 2004 08:50 PM

    Hi,
    In regards to working with the reverse invoke server and ftp, is it possible to get the username & password of a TP who has just ftp’d to a service put a flat file on that server.
    I tried session-info but that only seemed to work if the ftp session was created within the IS.
    Any help is greatly appreciated.
    Thanks


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 18.  RE: Service to accept data with FTP

    Posted Fri May 07, 2004 09:10 PM

    Strange,If you are not using pub.web.stringToDocument service then how come you are getting this error and that too in 6.01.

    OR else if you have migrated the edi from 4.6 to 6.x server then this service might still exists somewhere in the flow?Have you checked it in the TN processing rule service flow?

    HTH,


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 19.  RE: Service to accept data with FTP

    Posted Tue May 11, 2004 03:19 PM

    RMG, it is strange because I am not using the pub.web.stringToDocument. But wm.tn.receive eventually does.
    After I post to this service, I get the error.


    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB
    #webMethods


  • 20.  RE: Service to accept data with FTP

    Posted Tue June 08, 2004 04:33 PM

    hi

    I have an Issue, I have given an XML schema, through which I am generating document type, I have generated documenttype successfully but some of the required fields are missing in Document type.
    if I abserve clearly I have noticed that whereever extension found there the attributes are not publishing
    ex: <xsd:extension>
    <xsd:attribute>
    <xsd:attribute>
    <xsd:attribute>
    <xsd:attribute>
    <xsd:attribute>
    </xsd:extension>

    here all this attributes are not populating in the documenttype

    so pl. suggest me a way to get them in my documenttype

    regards
    ramana


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 21.  RE: Service to accept data with FTP

    Posted Mon March 14, 2005 03:54 PM

    Can anyone tell me what is the exact syntax for calling a service via the ftp port (it is setup in my IS)? I under stand you have to navigate to the specific service on the ftp server (the IS)? I have done so. I want to send something to the wm.tn:receive service. If my xml filename that I want to send is called testXML.xml, what would be an example of such a ftp call?

    I have: put testXML.xml xmlIn.xml; text:xml
    But I get “553 ‘xmlIn.xml;’: cannot write”.

    what is the idea behind the xmlIn.xml file?
    Thanks in advance!


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 22.  RE: Service to accept data with FTP

    Posted Mon March 14, 2005 04:44 PM

    DJ,

    You can create a flat-file wrapper service:

    Input signature: ffdata = object (inputstream)
    Output signature: ffreturn = object (outputstream)

    Flow steps:

    1. ffdata -> pub.io:steamToBytes
    2. pub.string:bytesToString
    3. pub.xml:xmlStringToXMLNode
    4. wm.tn:receive

    Trading Networks does its thing…
    If you have configured your processing rule to launch a service asynchronously (best practice imho), you can just return a message to the ftp client like:
    “Document submitted to Trading Networks”.

    Put response meessage in a string and return it to FTP client in “inputfilename.out”.

    1. pub.string:stringToBytes
    2. pub.io.bytesToStream -> ffreturn

    If you decide to do authentication (set up ACLs) for the flat-file wrapper service (best practice imho), you can call wm.tn.doc.xml:routeXml instead of wm.tn:receive.


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 23.  RE: Service to accept data with FTP

    Posted Mon March 14, 2005 06:29 PM

    DJ,

    Before you put that file to a IS service using ftp port then the syntax is login to that IS port wiht username/password then do a
    cd on packages/ns/yourpackagename/folder/subfolder(if exists)/servicename
    check with pwd and make sure the path is right
    put text:xml

    Finally make sure put is success.

    And rest follow the Mark’s instructions above.

    HTH,
    RMG.


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 24.  RE: Service to accept data with FTP

    Posted Tue March 15, 2005 04:14 PM

    DJ,

    Seems the flowservice input is not getting the XML data that you are ftping.

    Make sure the receiving service input is $xmldata this will extrac the data that you are ftping text.xml and further down when parsing use XMLStringToNode or StringToDocument and XMLNodeToDocument or documentToRecord etc…for parsing the XML.

    For debugging purpose use the pub.flow:getTransportInfo service and this way you can identify what exactly going on in the pipeline.

    HTH,
    RMG.


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 25.  RE: Service to accept data with FTP

    Posted Wed March 16, 2005 08:07 AM

    Hi,
    I still don’t get anything in my Service. My saved pipeline is empty. What is the command for sending (put) to the WM ftp server? What is the definition of the different parameters?

    I did the following:
    put testXML.xml xmlIn.xml ;text:xml

    Where testXML.xml is the file I want to send. What is the idea behind the second parameter (xmlIn.xml).
    The fact that this line appears:
    ftp: 174 bytes sent in 0.01Seconds 17.40Kbytes/sec.
    means I am sending the correct file, but it just doesn’t send it to my pipeline varaible. (I am in the correct directory …folder\servicename…)

    Thanks


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 26.  RE: Service to accept data with FTP

    Posted Wed March 16, 2005 03:15 PM

    DJ,

    When you do cd on the /ns/folder/servicename (make sure it is forward slash) and then use put testXML.xml xmlIntxt;text:xml.

    Then you should see the node in the pipeline.

    HTH,
    RMG


    #webMethods
    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport


  • 27.  RE: Service to accept data with FTP

    Posted Wed March 16, 2005 03:29 PM

    You can also register txt/plain content handler as:

    ServerAPI.registerContentHandler(“text/plain”, new HandlerFactory_txt());

    to allow you to ftp plain txt files:

    cd ns/absolutepathtoyourservice
    put yourfilename

    ~tS


    #webMethods
    #webmethods-Protocol-and-Transport
    #Integration-Server-and-ESB


  • 28.  RE: Service to accept data with FTP

    Posted Wed January 04, 2006 07:46 AM

    Hi,
    I am hitting an XML to a WebService using webMethods Connectors, I am getting the following exceptionthe WebService is supposed to be with the maximum load)
    <error>[ISS.0086.9091] Parameters xmldata, $filestream and $filedata are all missing. One of these must not be null.</error> <errortype>com.wm.app.b2b.server.ServiceException</errortype> <errordump>com.wm.app.b2b.server.ServiceException: [ISS.0086.9091] Parameters xmldata, $filestream and $filedata are all missing. One of these must not be null. at pub.xml.xmlStringToXMLNode(xml.java:523) at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code)) at java.lang.reflect.Method.invoke(Method.java(Compiled Code)) at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java(Compiled Code)) at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java(Compiled Code)) at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java(Compiled Code)) at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java(Compiled Code)) at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java(Compiled Code)) at com.wm.app.b2b.server.ACLManager.process(ACLManager.java(Compiled Code)) at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java(Compiled Code)) at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java(Compiled Code)) at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java(Compiled Code)) at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java(Inlined Compiled Code)) at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java(Inlined Compiled Code)) at com.wm.app.b2b.server.BaseService.invoke(BaseService.java(Compiled Code)) at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java(Compiled Code)) at com.wm.lang.flow.FlowMapInvoke.invokeService(FlowMapInvoke.java(Compiled Code)) at com.wm.lang.flow.FlowMap.invoke(FlowMap.java(Compiled Code)) at com.wm.lang.flow.FlowMap.invoke(FlowMap.java(Compiled Code)) at com.wm.lang.flow.FlowState.invokeNode(FlowState.java(Compiled Code)) at com.wm.lang.flow.FlowState.step(FlowState.java(Compiled Code)) at com.wm.lang.flow.FlowState.invoke(FlowState.java(Compiled Code))

    I am not able to get more information about the soap packet I am getting back, Since I am not able to reproduce the case.Help me if some one is familier with the exception.

    thanks in advance
    Vivekanand


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 29.  RE: Service to accept data with FTP

    Posted Wed January 04, 2006 03:43 PM

    Vivek,

    Please make sure XMLStringToNode is having enough input information to parse the document when you receive the XML from webservice.

    HTH,
    RMG


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB


  • 30.  RE: Service to accept data with FTP

    Posted Fri September 22, 2006 01:49 PM

    Hi, I am facing a similar problem…my input is a .pap file which is basically an ebXML file.My receiving service has node as input and the first 2 steps are streamToBytes and bytesToString. The service encounters a ClassCastException at streamToBytes. The lastError/pipeline/ffdata contains wm.server.net.FTPInputStream. I have a hunch that the input is coming as FTPInputStream (i post data to the service using ftp put)whereas streamToBytes expects java.io.InputStream. The server log shows the error “2006-09-22 13:46:17 CEST [MON.0119.0055E] Error retrieving combo list: com.wm.app.b2b.server.ServiceException: Missing input from pipeline: instanceID”… Can anyone please help ?


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 31.  RE: Service to accept data with FTP

    Posted Fri September 22, 2006 04:38 PM

    Arnab,

    “My receiving service has node as input”
    put XMLNodeToDocument step (replace streamToBytes and bytesToString services).It should work.

    HTH,
    RMG


    #Integration-Server-and-ESB
    #webmethods-Protocol-and-Transport
    #webMethods


  • 32.  RE: Service to accept data with FTP

    Posted Mon September 25, 2006 07:11 PM

    Your service may have declared a node as an input but apparently that is not what it is getting. For a node to be passed to your service, the FTP client must specify the content type as text/xml. It would appear they are not doing that? Calling streamToBytes and bytesToString would be the wrong thing to be doing with a node.

    As you point out, the ffdata variable is present. FTPInputStream is derived from InputStream. Pass ffdata to streamToBytes, not node.

    Of course, if you get the client to specify the content type, then your service will get a node and you can skip the streamToBytes/bytesToString/stringToXmlNode steps–they will have already been done for you.


    #webmethods-Protocol-and-Transport
    #webMethods
    #Integration-Server-and-ESB