Looking for some guidance on Axis1 version 1.4 help building a WS Client that can interact with a MTOM WebService. I am building the client using the Service and Call objects The input to the service is a String and a Base64 encoded element - looks like this <arg0> <name>TEST</name> <binaryData>base64 stuff here</binaryData> </arg0> I have successfully called the service with null binaryData but I get the following error when I pass actual data. The output is the String sent back in a SOAP Fault <soap:Text xml:lang ="en">Unmarshalling Error : null </soap:Text> In this example I have a class HelloWorldMtom (JavaBean) with a String and a DataHandler attributes that I use as input.
HelloWorldMtom hwMtom = new HelloWorldMtom(); hwMtom.setName(name); hwMtom.setBinaryData(dh); Here is the client code: Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(ADDRESS); call.setOperationName(new QName(HELLO_NAMESPACE, "sayHello")); call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS); call.setProperty(Call.ATTACHMENT_ENCAPSULATION_FORMAT, Call.ATTACHMENT_ENCAPSULATION_FORMAT_MTOM); call.setProperty(Call.SEND_TYPE_ATTR, Boolean.FALSE); call.setReturnType(org.apache.axis.Constants.XSD_STRING); call.setOperationStyle(Style.WRAPPED); call.setOperationUse(Use.LITERAL); QName qnameHelloMtom = new QName(HELLO_NAMESPACE, "helloMtom"); call.registerTypeMapping(hwMtom.getClass(), qnameHelloMtom, new HelloWorldMtomSerializerFactory(), new BeanDeserializerFactory(hwMtom.getClass(), qnameHelloMtom)); call.addParameter("arg0", qnameHelloMtom, ParameterMode.IN); String ret = (String) call.invoke( new Object[] { hwMtom } ); I built a custom Serializer as follows: public class HelloWorldMtomSerializer implements Serializer { public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException { if (value!=null){ HelloWorldMtom data = (HelloWorldMtom)value; context.startElement(new QName("arg0"), null); context.serialize(new QName("name"), null, data.getName(), null, Boolean.TRUE, Boolean.FALSE); if (data.getBinaryData()!=null){ Serializer jafs = new JAFDataHandlerSerializer(); jafs.serialize(new QName("binaryData"), null, data.getBinaryData(), context); } else { context.serialize(new QName("binaryData"), null, null, null, Boolean.TRUE, Boolean.FALSE); } context.endElement(); } } public String getMechanismType() { return Constants.AXIS_SAX; } public Element writeSchema(Class javaType, Types types) throws Exception { return null; } } Am I on the right track? Thanks for any help with this. Note: A CXF and an Axis2 WS client have already been successfully built against this WS (I am testing interop with different Java SOAP stacks) Mike Barlotta Associate Booz | Allen | Hamilton