有大神帮我看看这个webservice接口写的哪里有问题吗?
我是用weblogic 12发布的cxf webservice接口。
我的接口类:
package servhellow;
import javax.jws.WebService;
@WebService
public interface HelloWorld {
String sayHi(String text);
String sayHiXML(String text, int index);
String sayHiNull();
}
实现类:
package servhellow;
import java.util.List;
import javax.jws.WebService;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
@WebService(endpointInterface = "servhellow.HelloWorld")
public class HelloWorldImpl implements HelloWorld {
public String sayHi(String text) {
System.out.println("sayHi called text=" + text);
return "Hello " + text;
}
public String sayHiXML(String text, int index) {
System.out.println("time1=" + System.currentTimeMillis());
System.out.println("sayHiXML called");
System.out.println("text:\n" + text);
try {
Document doc = DocumentHelper.parseText(text);
System.out.println("doc.asXML():\n" + doc.asXML());
Element root = doc.getRootElement();
List list = doc.selectNodes("//root/namelist/name/@sex");
System.out.println("listsize=" + list.size());
for (int i = 0; i<list.size(); i++) {
// Element ele = (Element)list.get(i);
// System.out.println(ele.asXML());
Attribute attr = (Attribute)list.get(i);
System.out.println(attr.asXML() + ", name=" + attr.getName() +
", text=" + attr.getText() + ", value=" + attr.getValue() +
", path=" + attr.getPath());
}
list = doc.selectNodes("//root/namelist/name");
System.out.println("listsize=" + list.size());
for (int i = 0; i<list.size(); i++) {
Element ele = (Element)list.get(i);
System.out.println(ele.asXML() + ", name=" + ele.getName() +
", text=" + ele.getText() + ", value=" + ele.getStringValue() +
", path=" + ele.getPath());
}
Element subroot = root.element("attrlist");
if (subroot == null) {
return "ERROR";
}
list = subroot.elements();
// list = doc.selectNodes("//root/attrlist");
// list = ((Element)list.get(0)).elements();
System.out.println("listsize=" + list.size());
for (int i = 0; i<list.size(); i++) {
Element ele = (Element)list.get(i);
System.out.println(ele.asXML() + ", name=" + ele.getName() +
", text=" + ele.getText() + ", value=" + ele.getStringValue() +