I've used a sample example service and a client to send a binary attachment to a service from a client from an article i found on the web. All this works fine in a Java environment.
In the same Java Service, the Service maps to a method in the service that accepts a parameter of type OMElement. Im supposed to send a PDF to a .NET service but i dont know how to submit it to a method that is expecting a base64 attachment type. Can someone point me in the right direction regarding the steps required to do this. Thanks. *CLIENT* public class TestClient extends { private static final String EPR = " http://localhost:8080/axis2/services/TestService"; private static final String INPUT_FILE = "C:\\HOLD\\small.pdf"; public static void main(String[] args) throws Exception { System.out.println("In the TestClient Main Method"); System.out.println("EPR: "+EPR); System.out.println("Input File Name: "+INPUT_FILE); TestServiceStub stub = new TestServiceStub(EPR); stub._getServiceClient().getOptions().setProperty( Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(10000); javax.activation.DataHandler dataHandler = new javax.activation.DataHandler(new FileDataSource(INPUT_FILE)); ReceiveMTOM rmtom = new ReceiveMTOM(); OMFactory fac = OMAbstractFactory.getOMFactory(); OMText binaryNode = fac.createOMText(dataHandler,true); OMNamespace omNs = fac.createOMNamespace("http://test.com", "ns0"); OMElement method = fac.createOMElement("receiveMTOM", omNs); method.addChild(binaryNode); rmtom.setElement(method); stub.receiveMTOM(rmtom); System.out.println("done calling service..."); } } *SERVICE:* public class TestService { private static org.apache.log4j.Logger log = Logger .getLogger(TestService.class); private static final String OUTPUT_FILE = "C:\\HOLD\\att.pdf"; public void receiveMTOM(OMElement element) throws Exception { OMText binaryNode = (OMText) (element.getFirstElement ()).getFirstOMChild(); binaryNode.setOptimize(true); DataHandler dh = (DataHandler) binaryNode.getDataHandler(); InputStream is = dh.getInputStream(); byte[] buf = readFully(is); writeOutput(buf); System.out.println("done writing output file."); } }