You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Sandeep <sa...@binghamton.edu> on 2004/06/14 23:09:23 UTC
Sending a String
Hello,
I have deployed a web-service which accepts a string argument from my client
and saves it to the local file system. This string is actually a class file
which I plan to load it at the server on the fly.
In doing so, I receive an error as org.xml.sax.SAXParseException: An invalid
XML character (Unicode: 0x0) was found in the element content of the
document.
Bode snippet on the client is:
File f = new File("Test.class");
byte[] buffer = new byte[(int)f.length()];
BufferedInputStream inFromDisk = new BufferedInputStream(
new
FileInputStream(f));
inFromDisk.read(buffer,0,(int)f.length());
String check = new String(buffer);
//check is my string object containing the Test.class file
....
Options options = new Options(args);
String endpointURL = options.getURL();
args = options.getRemainingArgs();
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
call.setOperationName( new QName("MyService", "serviceMethod") );
call.addParameter( "arg1", XMLType.XSD_STRING, ParameterMode.IN);
//call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING );
call.invoke( new Object[] { check } ); //sending my string object
...
I believe that in order to send the byte codes as a parameter, I need to
apply encoding before I call the invoke method. Not being sure, I wanted to
explore any other way around by putting this Q on the group.
Any suggestions will be appreciated?
Thanks,
Sandeep Advani
Grid Research Lab, Binghamton University