Service to accept data with FTP

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

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.

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

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?

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

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

SSII

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

Hi,

You say it : “Object”

and the name of the object is “node”

SSII

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

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.

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.

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

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

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

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 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.

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

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,

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.

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