EJB 3.0 injection in a web service

Hello, I have the following situation:
I have a defined remote EJB in an EAR:
@Remote
@Stateless(mappedName = "MyTestService")
public class MyTestService {
  public String doThis() {return "done";}
}In another WAR, which is not part of the EAR and is deployed separately in WebLogic 12 I have a webservice:
@WebService
public class MyTestWebService {
  @EJB(mappedName = "MyTestService")
  private MyTestService testSvc;
  public String serveTheWeb() {
    return testSvc.doThis();
}Is this the right way to make the injection? Is it possible to make the injection at all? I suppose the WAR and the EAR files are deployed in the same container, so I suppose the EJB from the EAR will be available for the web service.
Thanks in advance!
Regards,
vmm

Sorry, that's not helpful at all! Can you tell me if there is something wrong with my code?

Similar Messages

  • Remote EJB invocation error from JAX-WS web service

    Hi,
    I have the following simple test JWS file:
    @WebService(name="HelloServicePortType", serviceName="HelloService", targetNamespace="http://example.org")
    @SOAPBinding(style=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL, parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
    public class HelloServiceJws {
         public String sayHello(String str) {
              try {
                   System.out.println("Accessing HvcHelper from JWS...");
                   Hashtable<String, String> env = new Hashtable<String, String>();
                   env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
                   env.put(Context.PROVIDER_URL, "t3://localhost:7001");
                   Context ctx = new InitialContext(env);
                   Object obj = ctx.lookup("hvc/ejb/stateless/HvcHelper");
                   System.out.println("After lookup() : " + obj);
              } catch (Exception e) {
                   e.printStackTrace();
              return str;
    The code throws the following exception when compiled with jwsc compiler ONLY with type='JAXWS':
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Could not find dynamically generated class: 'com.telus.hvc.ejb.HvcHelper_f18aar_HomeImpl_816_WLStub' ]
         at weblogic.utils.classfile.utils.CodeGenerator.generateClass(CodeGenerator.java:78)
         at weblogic.rmi.internal.StubGenerator.hotCodeGenClass(StubGenerator.java:775)
         at weblogic.rmi.internal.StubGenerator.getStubClass(StubGenerator.java:759)
         at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:786)
         at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:779)
         at weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:74)
         at weblogic.rmi.internal.StubInfo.resolveObject(StubInfo.java:213)
         at weblogic.rmi.internal.StubInfo.readResolve(StubInfo.java:207)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1061)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1762)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
         at weblogic.utils.io.ChunkedObjectInputStream.readObjectFromPreDiabloPeer(ChunkedObjectInputStream.java:221)
         at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:562)
         at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:193)
         at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
         at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:240)
         at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
         at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
         at weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:392)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at com.telus.cm.ws.jws.HelloServiceJws.sayHello(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:89)
         at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:71)
         at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
         at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
         at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
         at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
         at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
         at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
         at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
         at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
         at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:444)
         at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
         at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:134)
         at weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke.run(HttpServletAdapter.java:272)
         at weblogic.wsee.jaxws.HttpServletAdapter.post(HttpServletAdapter.java:185)
         at weblogic.wsee.jaxws.JAXWSServlet.doPost(JAXWSServlet.java:180)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
         at weblogic.wsee.jaxws.JAXWSServlet.service(JAXWSServlet.java:64)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.ClassNotFoundException: com.telus.hvc.ejb.HvcHelper_f18aar_HomeImpl_816_WLStub
         at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
         at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:176)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:35)
         at weblogic.utils.classloaders.FilteringClassLoader.findClass(FilteringClassLoader.java:82)
         at weblogic.wsee.util.JAXWSClassLoaderFactory$1.findClass(JAXWSClassLoaderFactory.java:44)
         at weblogic.utils.classloaders.FilteringClassLoader.loadClass(FilteringClassLoader.java:67)
         at weblogic.utils.classloaders.FilteringClassLoader.loadClass(FilteringClassLoader.java:62)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:247)
         at weblogic.utils.classloaders.GenericClassLoader.defineCodeGenClass(GenericClassLoader.java:507)
         at weblogic.utils.classfile.utils.CodeGenerator.generateClass(CodeGenerator.java:73)
         ... 62 more
    16-Sep-2008 1:01:34 PM com.sun.xml.ws.server.sei.EndpointMethodHandler invoke
    SEVERE: ***** ASSERTION FAILED *****[ Could not find dynamically generated class: 'com.telus.hvc.ejb.HvcHelper_f18aar_HomeImpl_816_WLStub' ]
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ Could not find dynamically generated class: 'com.telus.hvc.ejb.HvcHelper_f18aar_HomeImpl_816_WLStub' ]
         at weblogic.utils.classfile.utils.CodeGenerator.generateClass(CodeGenerator.java:78)
         at weblogic.rmi.internal.StubGenerator.hotCodeGenClass(StubGenerator.java:775)
         at weblogic.rmi.internal.StubGenerator.getStubClass(StubGenerator.java:759)
         at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:786)
         at weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:779)
         at weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:74)
         at weblogic.rmi.internal.StubInfo.resolveObject(StubInfo.java:213)
         at weblogic.rmi.internal.StubInfo.readResolve(StubInfo.java:207)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1061)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1762)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
         at weblogic.utils.io.ChunkedObjectInputStream.readObjectFromPreDiabloPeer(ChunkedObjectInputStream.java:221)
         at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:562)
         at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:193)
         at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
         at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:240)
         at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
         at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
         at weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:392)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at com.telus.cm.ws.jws.HelloServiceJws.sayHello(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:89)
         at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstanceResolver.java:71)
         at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
         at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
         at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
         at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
         at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
         at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
         at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
         at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
         at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:444)
         at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
         at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:134)
         at weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke.run(HttpServletAdapter.java:272)
         at weblogic.wsee.jaxws.HttpServletAdapter.post(HttpServletAdapter.java:185)
         at weblogic.wsee.jaxws.JAXWSServlet.doPost(JAXWSServlet.java:180)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
         at weblogic.wsee.jaxws.JAXWSServlet.service(JAXWSServlet.java:64)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3498)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Caused by: java.lang.ClassNotFoundException: com.telus.hvc.ejb.HvcHelper_f18aar_HomeImpl_816_WLStub
         at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
         at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:54)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:176)
         at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:35)
         at weblogic.utils.classloaders.FilteringClassLoader.findClass(FilteringClassLoader.java:82)
         at weblogic.wsee.util.JAXWSClassLoaderFactory$1.findClass(JAXWSClassLoaderFactory.java:44)
         at weblogic.utils.classloaders.FilteringClassLoader.loadClass(FilteringClassLoader.java:67)
         at weblogic.utils.classloaders.FilteringClassLoader.loadClass(FilteringClassLoader.java:62)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:247)
         at weblogic.utils.classloaders.GenericClassLoader.defineCodeGenClass(GenericClassLoader.java:507)
         at weblogic.utils.classfile.utils.CodeGenerator.generateClass(CodeGenerator.java:73)
         ... 62 more
    Any suggestions?
    Thanks,
    Pavel

    Hi Jason,
    Below is the sample.....You can use this..
    JAXBElement<Task> root = null;
              try {
                   ByteArrayInputStream input = new ByteArrayInputStream(
                             xmlStr.getBytes());
                   JAXBContext jc = JAXBContext.newInstance(Task.class);
                   Unmarshaller u = jc.createUnmarshaller();
                   StreamSource sc = new StreamSource(new StringReader(
                             xmlStr.toString()));
                   root = u.unmarshal(new StreamSource(input), Task.class);
              } catch (Exception e) {
                   e.printStackTrace();
              }

  • EJB 3.0 web services security (WS-Security)

    How do I enable WS-Security on EJB 3.0 based web services? Since only the @WebService annotation is required to expose a EJB 3.0 bean as a web service, how do I configure options that were previously in oracle-webservices.xml under the <security> tag?

    I have been trying to do the same... and it seems to be impossible... (or completly undocumented).
    It seems that OC4J 10.3.x is ... no exactly fully EJB3/J2EE5 compliant...
    Or something like that:
    http://blogs.infosupport.com/berte/archive/2005/09/09/1117.aspx
    IMHO... OC4J 10.3.x is still a preview for OC4J 11...
    OC4J 10.3.x is kind of a J2EE4/5 hybrid... if you start digging in the documentation, you will find out that the only
    way to have WS-Security is going back to J2EE4 http://www.oracle.com/technology/products/jdev/howtos/1013/wssecure/10gwssecurity_howto.html
    (of course, I hope you probe me wrong)
    Message was edited by:
    luxspes

  • Getting the Request Object in the EJB published as a Web Service

    Hi experts,
    I have a Portal Service that call a BAPI in a back-end system with the Connector Framework. I have a Portal Component that calls the Portal Service, passing the Locale (request.getLocale()) and the User (request.getUser()) object. It's work fine!
    I need to call the Portal Service by an EJB that is published as a Web Service. The connection between the EJB and Portal Service is ok, but I don't know how to get the Locale and the User object in the EJB to pass to the Portal Service.
    Is possible to get the request object from the HTTP SOAP Request?
    Thanks,
    Gustavo

    Hey Alice!
    The Feature Hashing module is actually a wrapper around
    Vowpal Wabbit's implementation of the murmurhash. Thus, it takes text in, and produces 2^N new features based on the text, where N is the bitsize specified in the module. These features (and not the original text!) should be used during model training.
    The Learner will then keep track of these features behind the scenes.
    When you publish your web service and these features are recomputed for new input text (same N), they are used as the features for scoring.
    Does that make sense?
    Regards,
    AK

  • Envorcing authentication with session ejb web service?

    I implemented a web service as a session ejb. Some of the methods exposed by this web service require certain privileges. I modified my ejb-jar.xml file and declaratively specified this by using the <method-permission> element.
    I have a Java client. If I pass credentials (e.g., name, password) into the constructor of the stub for the web service interface, the container properly recognizes this information, authenticates the user and either responds to or rejects the request based on if the user is permitted to call the method.
    I have a non-Java client. If I try to do the same thing, it does not work. Peeking underneath the covers, I've discovered that the credentials are never being used.
    Now I did get something to work. If I manually modify the web.xml for the web-services.war that is generated by servicegen to put a security constraint on the URL for the web service using the <security-constraint> element, when I run the non-Java client again, the credentials are used, properly recognized, etc.
    (1) Does anyone know why the security constraint is necessary for the non-Java client but not the Java client?
    (2) Am I doing something wrong? missing something? Is there a different way to do this?
    (3) Since I implemented the web service as a session EJB but it appears the generated web-services.war content needs to be manually modified, is there a way to generate this security constraint? I've tried various things and cannot seem to do this.
    Thanks for feedback!

    Debu,
    Yes, it successfully deployed.
    Here are the messages from the failed run.
    BUILD SUCCESSFUL
    Total time: 33 seconds
    D:\Oracle_ejb3.0\demo\howtoejb30ws>ant run
    Buildfile: build.xml
    common:
    [echo] BuildName: ejb30ws
    [echo] BuildHome: D:\Oracle_ejb3.0\demo\howtoejb30ws
    [echo] BuildFile: D:\Oracle_ejb3.0\demo\howtoejb30ws\build.xml
    [echo] BuildJVM: 1.5
    oracle-env-check:
    java-env-check:
    init:
    [echo] -----> Initializing project properties
    setup:
    [echo] -----> Creating the required sub-directories
    cli-setup:
    [echo] -----> Setting up the application client module
    [oracle:genProxy] null, WSDLException: faultCode=INVALID_WSDL: The document: http://localhost:8888/ejb
    /ejb30ws?wsdl is not a wsdl file or does not have a root element of "definitions" in the "http://schem
    mlsoap.org/wsdl/" namespace or the "http://www.w3.org/2004/08/wsdl" namespace.
    [oracle:genProxy] WSDLException: faultCode=INVALID_WSDL: The document: http://localhost:8888/ejb30ws/e
    ws?wsdl is not a wsdl file or does not have a root element of "definitions" in the "http://schemas.xml
    .org/wsdl/" namespace or the "http://www.w3.org/2004/08/wsdl" namespace.
    BUILD FAILED
    D:\Oracle_ejb3.0\demo\howtoejb30ws\build.xml:316: oracle.j2ee.ws.common.tools.api.WsdlValidationExcept
    null, WSDLException: faultCode=INVALID_WSDL: The document: http://localhost:8888/ejb30ws/ejb30ws?wsdl
    not a wsdl file or does not have a root element of "definitions" in the "http://schemas.xmlsoap.org/ws
    namespace or the "http://www.w3.org/2004/08/wsdl" namespace.
    Total time: 3 seconds
    D:\Oracle_ejb3.0\demo\howtoejb30ws>

  • EJB as Web Service doesnot Return value

    Hi All,
    I have cerated an EJB Wihich fetches the vendor data from MDM database,this EJB I have exposed as a web service.
    This Ejb returns an array of object of java class which contains 7 attributes,
    Like Vendor number,
          City,
          country,
          Name,
          company code,
          purchase organization.
    Now when i debug the EJB it is returning proper values with  all attribute.
    But in the web services response am able to get same number of records but attribute list is less...like I am getting the value of only City ,country and Vendor Number although EJB is returning all the values.
    If any one can help me with the problem.
    Thanks in advance.
    Shruti

    Hai,
    Is that returning java class is having setters and getters, and implementing serializable.
    look like
    public class beanToTest implements Serializable{
         private String vendornumber=null;
         private String city=null;
         private String country=null;
         private String name=null;
         private String companyCode=null;
         private String purchaseOrganization=null;
    @return
         public String getCity() {
              return city;
    @return
         public String getCompanyCode() {
              return companyCode;
    @return
         public String getCountry() {
              return country;
    @return
         public String getName() {
              return name;
    @return
         public String getPurchaseOrganization() {
              return purchaseOrganization;
    @return
         public String getVendornumber() {
              return vendornumber;
    @param string
         public void setCity(String string) {
              city = string;
    @param string
         public void setCompanyCode(String string) {
              companyCode = string;
    @param string
         public void setCountry(String string) {
              country = string;
    @param string
         public void setName(String string) {
              name = string;
    @param string
         public void setPurchaseOrganization(String string) {
              purchaseOrganization = string;
    @param string
         public void setVendornumber(String string) {
              vendornumber = string;
    Regards,
    naga

  • Web services and EJB3 @resource annotation

    This block of code works fine when NetworkViewBean is left as a @Stateless session bean.
    Once I have JDeveloper 10.1.3 production expose it as a web service, I can no longer call the Entity Manager @Resource.
    I always get a java.lang.NullPointerException returned.
    Any ideas?? thanks for your help!
    @WebService(name = "NetworkViewWS", serviceName = "NetworkViewWS")
    public class NetworkViewBean {
    @Resource
    private EntityManager em;
    public NetworkViewBean() { }
    public String getDeviceVendorModel(String name) {
    if (name == null || name.length()== 0) return "Null Input Parameter Specified";
    NetDevice N= null;
    try {
    N= (NetDevice)em.createNamedQuery("findByDeviceName").setParameter(0, name).getSingleResult();
    catch(Exception E) { E.printStackTrace();  return null; }
    return "Vendor= "+ N.getVendor()+ ", Model= "+ N.getModelNumber();

    Hi Joshua,
    The problem is that you are using a regular Java web service and in 10.1.3.0.0 we do not have support for dependency injection in the container in the web container i.e. you cannot use annotations such as EJB, Resource in any classes in the web container.
    You have two options:
    1. Lookup an EJB from regular Java web service (JSR-181)
    or
    2. Make your Web service as a EJB 3.0 web service
    Here what you can do to create an EJB 3.0 web service from JDev
    1. Create an EJB 3.0 Session bean with remote interface
    2. Change your remote interface to a web service end-point change @Remote to @WebService (import javax.jws.WebService)
    3. You do not have to use @WebMethod, we automatically expose all methods in the end-point interface in the web service
    4. You can inject EJB using @EJB
    5. Create a deployment profile for the EJB-jar and deploy the ejb-jar and the EJB will be exposed as a web service. The context-uri for the web service will be /ejb-jarName
    Hope this helps!
    -Debu Panda
    OC4J Product Management
    blog: http://debupanda.com
    -Debu

  • How can I create a web Service from my Web Dynpro Application ?

    Hi,
    Kindly let me know How I could create a "Web Service" with my Web Dynpro DC project.
    Awaiting your responses.
    Regards,
    Mahesh

    Hi Mahesh,
          You can use the web services by creating the Model in web Dynpro
    And if you want to publish your own web service then you have to create a EJB module and publish as a web service.
    Thanks
    Ninad

  • Calling web service from MBean weblogic cannot find type mapping file

    When calling web service from custom MBean i get java.io.IOException.
    java.io.IOException: unable to find the type mapping resource file for:
    net.msl.sfx.ebooking.client.BookingPartiesServiceService
    at weblogic.webservice.core.encoding.DefaultRegistry.<init>(DefaultRegis
    try.java:67)
    at weblogic.webservice.core.rpc.ServiceImpl.<init>(ServiceImpl.java:83)
    at net.msl.sfx.ebooking.client.BookingPartiesServiceService_Impl.<init>(
    BookingPartiesServiceService_Impl.java:22)
    at net.msl.sfx.ebooking.service.EBookingService.getBookingParties(EBooki
    ngService.java:59)
    The types.xml file is placed in same jar file as the classes such as net.msl.sfx.ebooking.client.BookingPartiesServiceService_Impl.
    When calling the same class/method from a EJB, everything works fine and the web service is called.

    i am having the same problem.
    Do you have a solution now?
    Thanks

  • Creating a Web service

    Hi,
    I have a web dynpro application that can access an external database via EJB. I also have a web module (JSP). In the web dynpro application there is a button that calls a webpage from my web module. 
    Supposedly, when I click the button, the values in webpage will be taken from my external database (e.g. the text values of my webpage will come from my database).
    I have been told to create a web service using my EJB and have to import that web service to my web module using a java class. Can someone point me to a tutorial on how to do this?

    Hi mlsaldua,
    please check this code
    public class WsClnt2 {
         static final String userid = "test";
         static final String password = "init2you";
         static String soapRequestMsg = "<ns1:MaterialGetDetail
    xmlns:ns1='urn:sap-com:document:sap:soap:functions:mc-style'><Material>R-1111</Material><Plant>1200</Plant><Valuationarea>1200</Valuationarea></ns1:MaterialGetDetail>"
         static class TheAuthenticator extends Authenticator {
         public PasswordAuthentication getPasswordAuthentication() {
               return (new PasswordAuthentication(userid,
    password.toCharArray()));
         public static void main(String[] args) {
                try{
                       String url =
    http://host:port/sap/bc/srt/rfc/sap/ZWS_MATERIAL_DETAIL?sap-client=800
                           Authenticator.setDefault(new TheAuthenticator());
                           MessageFactory msgf = MessageFactory.newInstance();
                           SOAPMessage msg = msgf.createMessage();
                           SOAPBody body =
    msg.getSOAPPart().getEnvelope().getBody();
                           DocumentBuilderFactory dbf =
    DocumentBuilderFactory.newInstance();
                           dbf.setNamespaceAware(true);
                           DocumentBuilder db = dbf.newDocumentBuilder();
                           ByteArrayInputStream bis=new
    ByteArrayInputStream(soapRequestMsg.getBytes());
                           org.w3c.dom.Document doc = db.parse(bis);
                           body.addDocument(doc);
                           SOAPConnection connection  =
    SOAPConnectionFactory.newInstance().createConnection();
                       SOAPMessage reply = connection.call(msg, url);
                   reply.writeTo(System.out);
                     } catch (Exception e) {
                           // TODO Auto-generated catch block
                           e.printStackTrace();
    <classpath>
       <classpathentry kind="src" path=""/>
       <classpathentry kind="con"
    path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
       <classpathentry kind="lib" path="C:/SAAJ/saaj-api.jar"/>
       <classpathentry kind="lib" path="C:/SAAJ/saaj-impl.jar"/>
       <classpathentry kind="lib" path="C:/bi_sdk/lib/activation.jar"/>
       <classpathentry kind="lib" path="C:/SAAJ/New
    Folder/xercesImpl-1.5.jar"/>
       <classpathentry kind="lib" path="C:/SAAJ/xerces.jar"/>
       <classpathentry kind="lib" path="C:/SAAJ/xmlpublic-2.0.0.jar"/>
       <classpathentry kind="lib" path="C:/SAAJ/jaxb-xalan-1.5.jar"/>
       <classpathentry kind="lib" path="C:/SAAJ/jaxws-api-2.1-1.jar"/>
       <classpathentry kind="lib" path="C:/SAAJ/jaxb-api-1.5.jar"/>
       <classpathentry kind="lib" path="C:/jdk1.5.0_12/jre/lib/rt.jar"/>
       <classpathentry kind="output" path=""/>
    </classpath>
    Thanks  and Regards,
    Mithu

  • SJSAS 8.2 secure and unsecure methods in one web service with ws-security

    Hi
    I'm trying to deploy a web-service (using SJSAS 8.2) using JAXRPC using message security (at the application level).
    I have one simple question:
    I have an EJB that exposes 2 methods as web-services, I specified in the sun-ejb-jar.xml that one of those methods is secure (and said nothing about the other) however when i run my test client I get a "WSS0202: No wsse:Security element in the message" error for both calls (instead of only for the secure call).
    Is this normal? Isn't it possible to have a normal (with no security headers) call to one method and another (with security headers and secure envelope) to another in the same webservice (from the same EJB)?.

    I wasn't clear?
    This is a big dev problem for a major Sun client.
    No one knows or wants to answer?

  • Implementing Web Service with Stateless Session Bean

    I have a web service that I've built using the WorkSpace Studio tools (create a WSDL, generate the Java code from the WSDL, fill in the skeleton methods in the service implementation class). This service is deployed as a web module within an EAR to WebLogic Server 10.0 and is working great as a web service.
    I'd like to be able to also call the operations on this service via an EJB interface (from a different application on the same server). I followed the guidelines for adding EJB annotations to the web service implementation class (from [http://edocs.bea.com/wls/docs100/webserv/jws.html#wp215790]). I added the @Session annotation to the class, implemented javax.ejb.SessionBean, and added the ejbXXX() methods. This all makes perfect sense, and looked like it was going to work. However, WorkSpace Studio now gives me a compile error on the class that says "EJB backed WebServices are not supported."
    A few internet searches for that error didn't return anything relevant.
    It seems like I followed the instructions correctly. Is there a better way to build a service like this that is both a web service endpoint and a stateless session bean?
    Thanks!
    -Eric

    Having separate EJB and web modules certainly makes things easier, but I have non-trivial (i.e. not feasible to copy) application logic that I'd like to expose with both a bean interface (for intra-application usage) and a web service interface (for public consumption).
    I've tried starting with a "web application" WorkSpace Studio project and adding bean annotations. This produces the error I originally described. I also tried starting with an "EJB" WorkSpace Studio project and adding web service annotations. This fails at deployment time with errors about missing web service descriptors (the error is correct - the web-service-related descriptor elements are missing from the deployment descriptors).
    The documentation explicitly presents this as an option (annotating a class with both web service and session bean annotations), but how does one actually make this work?

  • Authorization in web services

    Hi all,
    I'm trying to understand security in web services and i've been
    studiying web services security blue prints in glassfish. But all the
    samples work with authentication and message security (stock
    samples).
    My question is how to implement the authorization part in
    web services, is there some way/sample to authorizing a
    specified role to execute some web service? I'm interested
    in a declarative way.
    I haven't found any way to specify this except in EJB
    security-constraints part. Maybe web services are just the entry
    point and relays authorization and real work to underlaying
    EJBs. Is that the right thing to do?
    thanx

    Please provide me with a reply as this is an urgent situation.
    Thanks in advance,
    Geet

  • Using CE 7.1 ESR with ABAP based web services requires java development?

    Hi All,
    When developing a web service in ABAP, what java development must I do to make the web services available in an ESR that is located on CE 7.1?
    Thanks,
    Regards,
    Mel Calucin
    Bentley Systems, Inc.

    Hi Stefan,
    Someone told me that the difference between CE 7.1 ESR and PI 7.1 ESR is that to register the ABAP web service into CE 7.1 ESR you need to create EJBs and that you don't need to do this for PI 7.1 ESR (since ithe PI 7.1 ESR is ABAP based).  I didn't think that this was the case so I put this question in this forum to confirm this.   I am arguing to put in CE 7.1 because we don't need the PI 7.1 functionality.  This someone told me that we are more of an ABAP shop than a Java shop and that we don't want to develop EJBs whenever we develop ABAP based web services. 
    Thanks.
    Regards,
    Mel Calucin

  • Dynamic Web Service Consumption

    Hi
    I want to know if it is possible to consume a web service dynamically. Or is there any other way to consume web service in JSP without using proxies.
    I have already done consumption using deployable proxies but the way of consuming the web service is hardcoded. We have 3 landscape boxes (development box, maintenance box, production box). The problem is the URL for each WSDL in each box is different. So if we move our code from say dev box to maintenance box we have to edit our code for consumption before moving our codes. I hope there's a way to consume our web service/ WSDL dynamically.
    Thanks.

    Hello Melanie, I wanted to ask you:
    how do you do a deployable proxy in 7.3 ?
    In 7.0 I used to make a "Deployable Proxy Project", and now I don't know how to go.
    I have tried with an "Entreprise App. Project" wich in it has a "EJB project" wich also has an "Web Service Client". I don't know if Im doing it the right way.
    Thanks.

Maybe you are looking for

  • BUG: Power Manager fails to autostart

    Alright, this topic is a continuation of my conversation with Lenovo support on Twitter, as it has been a while and we were unable to resolve this problem. Until recently I had Windows 7 x86 running perfectly normal with a number of ThinkVantage tool

  • Palm V serial to USB

    I have a Palm V, XP Pro, Office outlook 2003.  I am trying to hook up my old cradle which is a serial port to my new computer which has USB ports.  I've read quite a lot of forums regarding this topic however, being technologically inept I'm finding

  • No mapping found for &apos

    Hi I have j2ee web services created using jdeveloper.They work fine when i use the web services end point url and test.But when i call them in a jsp page i get the following error. error No mapping found for 'http://tempuri.org/IVdcWebServices.xsd:vd

  • Authenticating web services -- get Invalid Response Code:(401) Unauthorized

    Hi, ich have implemented a websirve in dynpro java (thanks for all the guys who wrote guides for that), but i still have a problem. i have to set username and password for authorization. i have already tested follwoing code: reqMo.wdSetInvocationModi

  • "Microsoft is taking me on a TEST DRIVE"?????

    Hi, Just got a new MacBook. Got it home and when I try to open a word document or excel document it tells me I'm on a one month "Test Drive" with Microsoft 2004 and then I have to buy an update. I have no idea what the **** is going on. Any help woul