求助:TOMEE下EJB3 中 创建和调用WebService的问题
小弟刚入门,现在学到服务,遇到问题了我仿照openejb的代码写了个简单的Session Bean:
接口:
@WebService
public inte易做图ce IDog(targetNamespace = "http://sullix.com/wsdl")
{
public String say();
}
实现:
@Stateless
@WebService(
portName = "pname",
serviceName = "sname",
targetNamespace = "http://sullix.com/wsdl",
endpointInte易做图ce = "sullix.IDog")
public class Dog implements IDog
{
public String say()
{
return "Hello!";
}
}
我把这两个文件编译打包成JAR放到TOMEE1.5的lib和apps下
然后再ROOT/index.jsp里面写了下面的代码:
Service.create(
new URL("http://127.0.0.1:8080/Dog?wsdl"),
new QName("http://sullix.com/wsdl", "sname"));
然后JSP页面就出来一些异常,下面是异常信息的摘要:
(小弟觉得可能是URL写错了,但是到底该怎么写,求教啊。。。)
org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 24
21:
22: //out.print("<br/>"+dog.say()+"<br/>");
23:
24: Service.create(
25: new URL("http://127.0.0.1:8080/Dog?wdsl"),
26: new QName("http://sullix.com/wsdl", "sname"));
27:
com.sun.xml.internal.ws.wsdl.parser.InaccessibleWSDLException: 2 counts of InaccessibleWSDLException.
java.io.IOException: Got http://127.0.0.1:8080/Dog while opening stream from http://127.0.0.1:8080/Dog
java.io.IOException: Got http://127.0.0.1:8080/Dog?wsdl while opening stream from http://127.0.0.1:8080/Dog?wsdl
com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:183)
com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:155)
com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:120)
com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:260)
com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:223)
com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:171)
com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:96)
javax.xml.ws.Service.<init>(Service.java:77)
javax.xml.ws.Service.create(Service.java:707)
org.apache.jsp.index_jsp._jspService(index_jsp.java:92)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
--------------------编程问答-------------------- 顶一个,能解决问题的都送分!
补充:Java , Web 开发