--- Rick Reumann <[EMAIL PROTECTED]> wrote:
> On 6/14/07, robert lazarski
> <[EMAIL PROTECTED]> wrote:
> >
> > I'm not sure that your example is a good
> comparison, as the .net example
> > uses a string and the adb example uses a file.
>
> I'm confused why it's not a good comparison?. The
> .NET one is taking a
> byte[] as a param (which is what I would have
> expected to be produced
> for the Axis2 stubs as well). The Axis2 one created
> the DataHandler -
> this is why I used a File.. not that I wanted to use
> a File - I wanted
> to just use a String - but it seemed sort of silly
> to have to make a
> File out of a String just to pass it to the
> Datasource to then pass to
> the DataHandler.
>
See ManagedMemoryDataSource which you can use with a
stream. You can use it to pass information as
anything. You can even use ByteArrayInputStream along
with String.getBytes. new ManagedMemoryDataSource( new
ByteArrayInputStream(someString.getBytes()),
someString.length(), "application/octet-stream") ...
At least this class was available in AXIS1.4. You can
also just as easily make a:
public class StringDataSource implements
javax.activation.DataSource{
private String data = "";
public StringDataSource(String data){
this.data = data;
if(this.data==null){
this.data = "";
}
}
public InputStream getInputStream(){
return new ByteArrayInputStream(data.getBytes());
}
public OutputStream getOutputStream(){
return null;
}
public String getName(){
return "";
}
public String getContentType(){
return "application/octet-stream";
}
}
should be roughly all you would need. Then you can
basically do what you want really easy and more
lightweight than the ManagedMemoryDataSource as it
won't be so light weight for what you want to do.
Anyways, the above code should be enough to get you
roughly started. DataSource is very flexible.
Wade
==================
Wade Chandler
Software Engineer and Developer
Netbeans Community and Dream Team Member:
http://wiki.netbeans.org/wiki/view/NetBeansDreamTeam
Check out Netbeans at:
http://www.netbeans.org
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]