Hi!
Regarding byte array I see that arrays are currently not supported: else if( o.getClass().isArray()) { // ArrayInfo ai= new ArrayInfo(o); // v= ai.toVariant(); throw new SOAPException(Constants.FAULT_CODE_SERVER, "Currently arrays are unsupported, type received:" + o.getClass().getName()); } One idea would be to send the response object as a serialized Object - the following way: (Whenever someone decides to add bytearray it would be possible to attach it ?!?!) (In the previous solution we were dependant on the UTF-8 encoding) Object ret= null; try{ ret= invoke( threadingModel, progid, methodName, vp); }catch( Exception e) { String msg= Log.msg(Log.ERROR, "msg.comprovider.error.nativeError", e.toString()); throw new SOAPException( Constants.FAULT_CODE_SERVER, msg); } try { Parameter pret= null; if(ret != null) { if (attachSerializedObject && ret instanceof Serializable) { // We are about to return a serializable object and they should be // returned as attachments. Use a DataHandler object. ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutput oo = new ObjectOutputStream(baos); oo.writeObject(ret); oo.flush(); DataSource ds = new ByteArrayDataSource(baos.toByteArray(), "application/octet-stream"); DataHandler dh = new DataHandler(ds); ret = dh; } pret= new Parameter(RPCConstants.ELEM_RETURN , ret.getClass(), ret, null); } } Is this acceptable ????? You activate the attach serialized object by addding the following to your DeplymentDescriptor <isd:option key="attachSerializedObject" value="true" /> On the client side you do as follows: Parameter ret = resp.getReturnValue(); try { Object obj = ret.getValue(); if (obj instanceof DataHandler) { try { DataHandler dh = (DataHandler) obj; DataSource ds = dh.getDataSource(); InputStream is = ds.getInputStream(); ObjectInput oi = new ObjectInputStream(is); Object attachedObject = oi.readObject(); .... Do your stuff ..... /Leif -----Original Message----- From: Scott Nichol [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 13:46 To: [EMAIL PROTECTED] Subject: Re: Again: Attachments through COMProvider Lief, Thank you for being both patient and persistent! My one question about this is that the option you add applies to Strings, which are returned from COM objects as Unicode. This would not allow binary files to be returned unless the COM object does some encoding on the file, such as Base64. Would we be able to implement this for another data type (array of byte?) that would support arbitrary files? Scott Nichol ----- Original Message ----- From: "Leif Nilsson TACMa" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 03, 2002 3:24 AM Subject: Again: Attachments through COMProvider Hi! Since no one seems to object I suggest this change to be added. /Leif > -----Original Message----- > From: Leif Nilsson TACMa > Sent: Monday, October 28, 2002 19:10 > To: '[EMAIL PROTECTED]' > Subject: Attachments through COMProvider > > Hi! > > We send XML-files through Apache Soap. > There is a COM-server accessed via Apaches COMProvider. > The best way to send files as discussed is through attachments. > The only way I have figured out to do this via the ComProvider is to alter > the > org.apache.soap.providers.com.RPCProvider.java code. > > I'm sure there is a better way but I will explain what I have done. > I have added an option for the COmProvider DeploymentDescriptor > (attachString), which if present and set to true will cause > Strings returned from COM-servers to be packaged in a DataHandler object > using UTF-8 coding. > > Any suggestions for how to do this better / cleaner ? > Cf. attached java code. > <<Original RPCProvider.java>> <<RPCProvider.java>> > > Leif Nilsson > Software Engineer > > TAC AB > Jägershillgatan 18 > SE-213 75 Malmö, Sweden > Direct +46 40 38 69 56 > Fax +46 40 21 82 87 > Mobile +46 46 299 89 56 > www.tac-global.com > > This email is intended only for the use of the individual or entity to > whom it is addressed. It may contain information that is privileged, > confidential or otherwise protected from disclosure under applicable law. > If you have received this transmission in error, please delete it > immediately and notify me by mailing me. > > ------------------------------------------------------------------------ -------- > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
RPCProvider.java
Description: Binary data
Original RPCProvider.java
Description: Binary data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>