1
私はcfx 2.5.1とguice 2.0を使用しています。webserviceとcxfおよびguiceとの接触時のエラー500
Iは、WS
@WebService(targetNamespace="http://com.example.firstapp/")
public interface IWSEchoService {
@WebMethod(operationName="echoService")
String echoService(@WebParam(name="id") String id,@WebParam(name="payload") String payload) throws SOAPFault;
@WebMethod(operationName="testAttachment")
DataHandler testAttachment(DataHandler attachment) throws SOAPFault;
}
および実装のためにこのインタフェースを持っても
@WebService(targetNamespace = "http://com.example.firstapp/")
public class WSEchoServiceImpl implements IWSEchoService {
protected Log logger = LogFactory.getLog(this.getClass());
@WebMethod(operationName = "echoService")
public String echoService(String id, String payload) throws SOAPFault {
return id + "|" + payload;
}
@WebMethod(operationName = "testAttachment")
public DataHandler testAttachment(DataHandler attachment) throws SOAPFault {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
FileUtil.copyInputStream(attachment.getInputStream(), baos);
logger.debug(baos.toString());
} catch (IOException ex) {
logger.error(ex);
}
logger.info("Attachment ok! Size: " + baos.size());
return attachment;
}
}
I有し
public class ContextStartup implements ServletContextListener {
private Log logger = LogFactory.getLog(ContextStartup.class);
private CamelContext camelContext;
public void contextInitialized(ServletContextEvent sce) {
try {
camelContext = new GuiceCamelContext(Guice.createInjector(Stage.DEVELOPMENT, new MyModule()));
camelContext.start();
startWS();
} catch (Exception ex) {
logger.error(ex);
}
}
.....
private void startWS() {
String address = "http://localhost:8191/ws/echoService";
Endpoint.publish(address, new WSEchoServiceImpl());
}
private class MyModule extends CamelModuleWithMatchingRoutes {
@Override
protected void configure() {
super.configure();
// bind camel component
}
}
}
最後に私のブラウザで私が呼ぶ
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<listener>
<description>Start and destroy CamelContext</description>
<listener-class>com.example.firstapp.ContextStartup</listener-class>
</listener>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
今のtomcatのweb.xml
http://localhost:8191/ws/echoService?wsdl
または
http://localhost:8191/ws/echoService
私はHTTP 500エラーを持っていますが、コンソールまたはTomcatの中に、私はすべての例外やエラー
を持っていないログ私はまた、このガイドhttp://jax-ws-commons.java.net/guice/を使用しますが、私は
誰か提案がありますか? – user1332226
tomcat /あなたのアプリケーションのログを記録する。 –