java - How to attach documents to a SOAP with XOP using Spring? -
i had wsdl mtom , handle properly: there documentation available. ended with. not testing done on it, except saw working.
byte[] document = ... ; datasource datasource = new bytearraydatasource(document, "application/octet-stream"); datahandler datahandler = new datahandler(datasource); response.setdocument(datahandler); now infrastructure people changed our xsd use xop because okay attachments in request, not in response our actual use case. changed our xsd , added xop.xsd.
<xs:schema xmlns:xs='http://www.w3.org/2001/xmlschema' xmlns:tns='http://www.w3.org/2004/08/xop/include' targetnamespace='http://www.w3.org/2004/08/xop/include' > <xs:element name='include' type='tns:include' /> <xs:complextype name='include' > <xs:sequence> <xs:any namespace='##other' minoccurs='0' maxoccurs='unbounded' /> </xs:sequence> <xs:attribute name='href' type='xs:anyuri' use='required' /> <xs:anyattribute namespace='##other' /> </xs:complextype> </xs:schema> with new structure, method setdocument defined following: setdocument(include).
the generated include class following:
@xmlaccessortype(xmlaccesstype.field) @xmltype(name = "include", namespace = "http://www.w3.org/2004/08/xop/include", proporder = { "any" }) public class include implements org.jvnet.jaxb2_commons.lang.tostring { @xmlanyelement(lax = true) protected list<object> any; @xmlattribute(name = "href", required = true) @xmlschematype(name = "anyuri") protected string href; @xmlanyattribute private map<qname, string> otherattributes = new hashmap<qname, string>(); public list<object> getany() { if (any == null) { = new arraylist<object>(); } return this.any; } public string gethref() { return href; } public void sethref(string value) { this.href = value; } public map<qname, string> getotherattributes() { return otherattributes; } // other irrelevant methods tostring. } my question is: how , add document in include object? (the document byte array seen in first code snippet)
Comments
Post a Comment