[prev in list] [next in list] [prev in thread] [next in thread]
List: axis-user
Subject: Axis2: Passing Binary Data as Payload, Data Handler
From: "Mark Bullathsinghalage Cooray" <mbcooray () groupwise ! swin ! edu ! au>
Date: 2011-12-13 9:09:32
Message-ID: 4EE7B0FC020000DF0002F9A3 () groupwise ! swin ! edu ! au
[Download RAW message or body]
Hi,
I am accepting a DataHandler object at the server end and Client uses ServiceClient \
and builds the OMElement. The binary file passes without any problem, however the \
DataHandler is empty.
Server Side Code:
public void acceptFile(DataHandler dataHandler) {
try {
File outFile = new File("c:/testDataHandler.xml");
FileOutputStream fileOutputStream = new FileOutputStream(outFile);
dataHandler.writeTo(fileOutputStream);
fileOutputStream.flush();
fileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
ClientSide Code:
// Building Service Client
try {
serviceClient = new ServiceClient();
serviceClient.engageModule("addressing");
Options options = new Options();
options.setTo(new EndpointReference(serviceDescription2
.getEndpointReference()));
options.setAction("urn:reportTest");
options.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_TRUE);
serviceClient.setOptions(options);
} catch (AxisFault exception) {
exception.printStackTrace();
}
// Building Payload
String namespace = serviceDescription.getTargetNamespace();
Vector operations = serviceDescription.getOperations();
String partName = "";
for (int i = 0; i < operations.size(); i++) {
partName = serviceDescription.getPartName(operations.get(i)
.getName());
}
OMElement methodElement = null;
OMText parameterValueElement = null;
OMFactory objectFactory = OMAbstractFactory.getOMFactory();
OMNamespace objectNamespace = objectFactory.createOMNamespace(
namespace, "ns");
methodElement = objectFactory
.createOMElement(partName, objectNamespace);
DataHandler dataHandler = binaryData.getBase64Binary();
parameterValueElement = objectFactory.createOMText(dataHandler, false);
methodElement.addChild(parameterValueElement);
Could you help me with this.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic