Can I pass an object using xmlrpc in java
I want to pass an object using xmlrpc as this is the only possible way it
seems that I can pass an Integer and a String to a method on the server.
Is it possible to do this using an object? If not is there some other way
of doing it?
I have attempted to do it but am getting this error:
JavaClient: XML-RPC Consumer Fault #java.io.IOException: unsupported Java
type: class Client.Article
This is the code on the client side:
public void addHash()
{
try {
addAuthorName = txtAddAuthorName.getText();
int addArticleNumber =
Integer.parseInt(txtAddArticleNumber.getText());
newArticle = new Article(addAuthorName, addArticleNumber);
Vector<Object> addArticleArglist = new Vector<Object>();
addArticleArglist.addElement(newArticle);
System.out.println(newArticle);
// make the call
String callit = ("GetSize.addHash");
articleID = (Integer) client.execute(callit, addArticleArglist);
} // Use XmlRpcException errors
catch (XmlRpcException exception) {
System.err.println("JavaClient: XML-RPC Consumer Fault #"
+ Integer.toString(exception.code) + ": "
+ exception.getCause() + "" + exception.toString());
} catch (Exception exception) {
System.err.println("JavaClient: XML-RPC Consumer Fault #" +
exception.toString());
}
}
This is the code on the server side however by using System.out.println I
have discovered that for whatever reason none within this method is being
executed:
public void addHash(Article newArticle)
{
theHashtable.addHash(newArticle.getArticleName(),
newArticle.getAuthorID());
}
No comments:
Post a Comment