English 中文(简体)
JAX-WS JAX-WS 界面3.0框架的网络服务
原标题:JAX-WS Webservice in GUICE 3.0 framework
  • 时间:2012-05-23 14:44:30
  •  标签:
  • jax-ws
  • guice

我们使用GUICE框架作为服务层的一部分。 现在需要建立 JAX-WS 网络服务。 我们用JDK 1. 6 JAX-WS API建立了网络服务。 但现在,我们无法使用GUICE的任何资源,因为我们的网络服务无法管理。

我们用的是Guice 3. 0 我们如何实现这个目标?

Tried the following link http://jax-ws-commons.java.net/guice/, but did not work out and finally got to know that this is compatible only with Guice 2.0 in some forum.

One more approach tried was http://developian.blogspot.in/2008/11/google-guice-and-jax-ws.html, But this internally will start using some of the sun API which are access restricted and hence I dont want to use...

现在什么是最佳办法或任何其他解决办法。

请提供咨询意见。

谢谢 谢谢

最佳回答

您可以输入一个持有密码注射器的 EJB 。 这意味着, 您可以在使用 Java EE 时使用 EJB 。 EJB 应该是单脚柄, 只有单脚柄可以控制注射器。 如果您想要输入某种东西, 这是注射器。 当然, 您第一次通过 Guice. create Injector () 拨打注射器时必须创建注射器 。 当注射器使用注射器注射其他类别时, 输入注射器不会有问题 。 您必须先在网络服务中输入注射器, 您才第一次拨打使用注射器的类别 。

否则您可以在网络服务中使用静态注射器。 也许这不会那么干净, 但会有效 。 这需要您在构建器中创建注射器。 例如, 在抽象的服务类中, 所有网络服务都依赖于。 然后您就可以访问服务中的注射器, 并使用与上文所述相同的操作 。

@Singleton
public class InjectorHolder
{
private Injector injector;

   public GuiceInjectorHolder()
   {
        injector = Guice.createInjector(new Module())
   }
}

    public Injector getInjector()
    {
    return injector;
    }

}

public abstract class AbstractService
{
@EJB
InjectorHolder holder;

public void method()
{
holder.getInjector().getInstance(clazz).doSomething();
}
}
问题回答

Have you tried to create your own Servlet and bind your services in the loadBus() method? The solution is described here: CXF and Google Guice using JAX-RS + JAX-WS





相关问题
Groovy & Jax-ws: @WebMethod annotation ignored

I recently found an example on implementing a We3bService with groovy and jax-ws: the problem is that the @webmethod annotation seems to be ignored. This is the source code of the groovy script: ...

JBoss Web Services Behind IIS Through HTTPs

This is a tangled web that s woven, I suppose, but it really shouldn t be all that hard. Let me see if I can paint the picture: I have written a web service, starting with a WSDL, which is to run in ...

Advantages of using a Dynamic Client with JAX-WS

What are the advantages of using a dynamic client with JAX-WS services as opposed to just using generated client classes? What are the disadvantages? **For my particular case I am using Apache CXF, I ...

wsimport ant task assumptions and how to work around those

I use the ant task from jax-ws - wsimport to generate my dto s. What I m wanting to know is what assumptions does wsimport make? for example, w.r.t to the service endpoint and the location of the ...

Jaxb2Marshaller and primitive types

Is it possible to create a web service operation using primitive or basic Java types when using the Jaxb2Marschaller in spring-ws? For example a method looking like this: @Override @PayloadRoot(...

热门标签