请问我在soap服务端的函数中可以返回一个JDOM的Document对象吗?
我在服务器端的类:
import org.jdom.*;
import org.jdom.output.*;
import org.jdom.Attribute.*;
import org.jdom.input.*;
import java.io.*;
public class MyService
{
public Document serviceMethod (String arg)throws Exception
{
SAXBuilder sb = new SAXBuilder();
Document doc = sb.build(new FileInputStream("exampleA.xml"));
return doc;
}
}
client端的类:
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;
import org.jdom.*;
import org.jdom.output.*;
import org.jdom.Attribute.*;
import org.jdom.input.*;
import java.io.*;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
public class Client
{
public static void main(String [] args) throws Exception
{
try {
String endpointURL ;
//endpointURL="http://localhost:1234/axis/services/MyService";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress("http://localhost:1234/axis/services/MyService");
call.setOperationName( "serviceMethod" );
//call.setReturnType( org.apache.axis.encoding.XMLType.XSD_STRING );
Document doc = (Document) call.invoke( new Object[] { "textToSend" } );
String indent = " ";
boolean newLines = true;
XMLOutputter outp = new XMLOutputter(indent,newLines,"GBK");
outp.output(doc, new FileOutputStream("exampleB.xml"));
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
运行client端的程序后,报告(500)Internal Server Error
请问我该怎么才能返回一个Document类呢?
如果不能返回一个DOCUMENT类的话,那我到底应该怎么来传送一个XML文件或者是一个XML对象呢?