ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ File Transfer Edition » start file transfer by putting message in the command queue

Post new topic  Reply to topic
 start file transfer by putting message in the command queue « View previous topic :: View next topic » 
Author Message
boristep
PostPosted: Thu Apr 03, 2014 9:34 am    Post subject: start file transfer by putting message in the command queue Reply with quote

Novice

Joined: 02 Jan 2013
Posts: 11

According to InfoCenter it's possible start a file transfer by putting a file transfer message on the command queue of the source agent. For example SYSTEM.FTE.COMMAND.AGENT01
There is a sample program:

public class MQSample {

// code identifier
static final String sccsid = "@(#) samples/wmqjava/MQSample.java, jmscc.samples, k701, k701-110-130204 1.8.1.1 09/08/17 07:42:55";

// define the name of the QueueManager
private static final String qManager = "QMA";
// and define the name of the Queue
private static final String qName = "SYSTEM.FTE.COMMAND.AGENTA";


public static void main(String args[]) {
try {
// Create a connection to the QueueManager
System.out.println("Connecting to queue manager: " + qManager);
MQQueueManager qMgr = new MQQueueManager(qManager);

// Set up the options on the queue we wish to open

int openOptions = MQConstants.MQOO_OUTPUT;
// Now specify the queue that we wish to open and the open options
System.out.println("Accessing queue: " + qName);
MQQueue queue = qMgr.accessQueue(qName, openOptions);

// Define a simple WebSphere MQ Message ...
MQMessage msg = new MQMessage();
// ... and write some text in UTF8 format

String s = new String(" <?xml version=\"1.0\" encoding=\"UTF-8\"?><request version=\"4.00\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"FileTransfer.xsd\">\n"+
"<managedTransfer>\n"+
"<originator>\n"+
"<hostName>10.0.0.6</hostName>\n"+
"<userID>BorisT</userID>\n"+
"</originator>\n"+
"<sourceAgent QMgr=\"QMA\" agent=\"AGENTA\"/>\n"+
"<destinationAgent QMgr=\"QMB\" agent=\"AGENTB\"/>\n"+
"<transferSet>\n"+
"<item checksumMethod=\"MD5\" mode=\"binary\">\n"+
"<source disposition=\"leave\" recursive=\"false\">\n"+
"<file>c:\\tmp\\icon.gif</file>\n"+
"</source>\n"+
"<destination exist=\"overwrite\" type=\"directory\">\n"+
"<file>C:\\TEST</file>\n"+
"</destination>\n"+
"</item>\n"+
"</transferSet>\n"+
"</managedTransfer>\n"+
"</request>");
System.out.println("The message is: " + s);
msg.writeUTF(s);

// Specify the default put message options
MQPutMessageOptions pmo = new MQPutMessageOptions();

// Put the message to the queue
System.out.println("Sending a message...");
queue.put(msg, pmo);


The file transfer fails because malformed XML, I suppose that is 2 byte of the message length at the beginning of the message.

What is a solution?
Back to top
View user's profile Send private message
tomleend
PostPosted: Sat Apr 05, 2014 1:27 am    Post subject: Reply with quote

Acolyte

Joined: 24 Jan 2014
Posts: 51

Hi boristep,

I haven't tried compiling or running or code snippet but the first thing I'd suggest is removing the new line characters you have included in your XML string and see if that helps.
Back to top
View user's profile Send private message
boristep
PostPosted: Sat Apr 05, 2014 9:09 pm    Post subject: Reply with quote

Novice

Joined: 02 Jan 2013
Posts: 11

It does not help

The message is: Content is not allowed in prolog

My understanding it says that something wrong in the beginning of the message
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Apr 06, 2014 11:12 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

Did you set the MQMD Format and CCSID fields to the right values before putting the message?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
RogerLacroix
PostPosted: Tue Apr 08, 2014 11:51 am    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3252
Location: London, ON Canada

boristep wrote:
The message is: Content is not allowed in prolog

XML Prolog is optional and appears before the root element.

Code:
String s = new String(" <?xml version=\"1.0\" encoding=\"UTF-8\"?><request version=\"4.00\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"FileTransfer.xsd\">\n"+


You have a space before <?xml, so change it to:

Code:
String s = new String("<?xml version=\"1.0\" encoding=\"UTF-8\"?><request version=\"4.00\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"FileTransfer.xsd\">\n"+


Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
boristep
PostPosted: Tue Apr 08, 2014 9:55 pm    Post subject: Reply with quote

Novice

Joined: 02 Jan 2013
Posts: 11

thanks a lot RogerLacroix

this was the problem
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ File Transfer Edition » start file transfer by putting message in the command queue
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.