Injecting both SessionContext & WebServiceContext in an EJB 3 Web Service

Hi,
Is it valid/legal to inject both of WebServiceContext and SessionContext in an EJB 3 Web Service, e.g.:
@WebService
@Stateless
public class MyService
@Resource private SessionContext sessionContext;
@Resource private WebServiceContext webServiceContext;
}Thanks in advance.

Hello Bhupesh,
A Classpath has to be defined for a server process to avoid the exception "NoClassDefFoundError"
Refer to the below url for more clarity
http://help.sap.com/saphelp_erp2005/helpdata/en/06/24d17099f2f245822fce0ba1ab4065/frameset.htm
Thanks,
Preethika

Similar Messages

  • How to create secure EJB web service in Oc4J using JDeveloper?

    We are going to develop a EJB web service running in OC4J using JDeveloper 10.1.3.3.
    By using the JDeveloper feature, we can simply create the web service by using the "Web Service Endpoint Interface" in the session bean.
    However, unlike the web service created from Java class, I can't find any option to change the security setting of this web service. We tried adding annotation like @DenyAll for testing, but there has no effect and related method can still be called without WS-Security header.
    Now, we can only change the security setting via the web console after deployment (select the web service, then enable security in administration page, and then edit security configuration to change the inbound policies for authentication). It works in our local machine, but it may not work in the production environment as we cannot touch the em console.
    May I know if there has any way to include the security setting inside the project?
    Thanks in advance.

    If I am not wrong, you might be probably talking about this :
    http://docs.oracle.com/cd/B40099_02/books/EAI2/EAI2_WebServices33.html#wp179056
    In order to implement the SOAP header, you would have to :
    (1) Define SOAP header in the wsdl of the service.
    (2) Add a new soap binding in the wsdl, which contains soap header and soap body.
    I think, this should get you going..

  • Problem generating stubs for Java EJB web service deployed in OAS

    I created an EJB web service and I've successfully deployed it in my Oracle App Server. Some of the methods work fine but others produce the ff error:
    org.apache.soap.SOAPException - java.lang.IllegalArgumentException: No Serializer found to serialize [classname] using encoding style [encoding]It seems that the objects specified as parameters in the web service methods exposed are the only ones that had stubs generated for them. Other objects I use, which are usually wrapped inside a Vector, did not have generated stubs.
    Example:
         public String loginUser(UserDTO userDTO) throws RemoteException, NamingException, SQLException;
    public String addItems (Vector vecItems) throws RemoteException, NamingException, SQLException; // where vecItems is a collection of ItemDTO objects     In this scenario, stubs were generated for the UserDTO class, but not for the ItemDTO class. In effect, calling the addItems method resulted to the exception I mentioned above.
    I did a workaround wherein I declared a dummy method which accepted all the types of objects I needed as parameters so all the necessary stubs can be generated, but this fix doesn't feel like it's the proper solution to my problem.
    If anyone can help me, it would be greatly appreciated. Thanks!

    Crossposted:
    Problem generating stubs for Java EJB web service deployed in OAS

  • Consuming EJB Web Service in WD ABAP component

    Hi,
    I have a scenario where I have Portal KM access methods exposed as EJB Web Service. This web service is deployed on J2EE engine.
    And I have to consume this web service from my WD ABAP component controller.
    Any idea how this can be achieved?
    Thanks and regards,
    Amey

    This doesn't really have anything to do with Web Dynpro.  Normal ABAP functionality is used for the consumption of a web service.  In ABAP we create a proxy class based off the WSDL of the web service.  This proxy class can then be called from within Web Dynpro like any other ABAP class.  You can read about consuming a web service in the online help:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/9e/c7a3591dc74a679bbc9716354e42af/frameset.htm

  • How to add image in ejb web service

    Hello Community,
    I am writing web service to create a PDF file using itext API. In PDF file i want to add an image.
    Can someone please tell that , how can i add image(jpeg, png , etc.) to an ejb web service?
    Thanks in advance
    Regards,
    Dishant Chawla

    Hi,
    Please check the below code which i used to add image to the header using iText . Similarly you can add image directly to the document also as a element.
    Adding image as Header:
    httpServletRequest = request.getServletRequest();
    domainURL=httpServletRequest.getScheme()+"://"+httpServletRequest.getServerName();
    imgLogo=domainURL+request.getWebResourcePath()+"/images/XXXX.jpg";
    image =Image.getInstance(imgLogo);
    image.scalePercent(22);// As per you need
    chunk = new Chunk(image, 0, -20);
    HeaderFooter header_pdf = new HeaderFooter(new Phrase(chunk), false); // here i have added image as header
    header_pdf.disableBorderSide(0);
    header_pdf.setAlignment(Element.ALIGN_CENTER);
    header_pdf.setBorder(0);
    document.setHeader(header_pdf);
    (or)
    Adding Image a Element:
    httpServletRequest = request.getServletRequest();
    domainURL=httpServletRequest.getScheme()+"://"+httpServletRequest.getServerName();
    imgLogo=domainURL+request.getWebResourcePath()+"/images/XXXX.jpg";
    image =Image.getInstance(imgLogo);
    image.scalePercent(22);
    document.add(image);
    Java IText: Image | tutorials.jenkov.com
    Regards,
    Srinivasan V

  • EJB Web Service Interface parameters name changed

    Hi, all,
    I create a simple Session EJB 3.0 with Web Service interface in Jdeveloper 10.1.3.4. and I deployed it into the embedded OC4J server.
    The question is I found that the web service operator parameters is changed to "String_1" (actually the parameter in EJB method is String ss). And I found the WSDL file is also String_1.
    How to create the real parameter name in WSDL from EJB Web Service interface? Any help on that?
    Best Regards,
    Bill

    if you do a lookup for the name "java:comp/env/ejb/queryProc" in the servlet, the deployment descriptor of your web-archive must contain an ejb-reference with the ref-name 'ejb/queryProc'.

  • Combine Annotation Driven EJB Web Services with BPEL

    Hi friends,
    We developed two Annotation Driven EJB Web Service and deployed successfully .
    webservice 1 accepts username and password as input and returns true if ldap authentication is successful.
    webservice 2 accepts username and password,and groupname as input and returns true if user is part of ldap group.
    How can we combine these two services in SOA with input (username,password,group) and output (isAuthenticated ,isGroupMember) using BPEL process...
    Regards,
    jdev

    I will create a schema with input as (username,password,group) and Output as (isAuthenticated ,isGroupMember).
    Then based on your requirement you have to create either Sync or Async service.
    From the BPEL process i will call the 2 webservices using webservice call.
    On receiving the result, populate the output variable(isAuthenticated ,isGroupMember) and send as response.
    Thanks,
    Vijay

  • Maintaing state with ejb web services

    Hello,
    I understand there are no straight way to maintain state with ejb web services. Basically I have a stateful session bean and I would like to maintain state across requests. What is the best/cleanest architecture I can use in order to maintain state with web services?
    Any reply appreciated,
    Julien.

    Here's how BEA suggests you do it:
    http://e-docs.bea.com/wls/docs81/webserv/design.html#1058330

  • Error deploy EJB web services

    please help!!!
    Hi! I've problems to deploy an ejb web services.
    I've the following error:
    Error instantiating compiler:
    06/07/19 10:48:51 WARNING: EJBContainer.postInit
    Error generating wrappers for file:/C:/Oracle/oc4j/j2ee/home/applications/EJB-WS-EAR/EJB-WS.jar
    com.evermind.compiler.CompilationException: Error instantiating compiler: webservice artifact generation failed :java.lang.NullPointerException : null
    used by: java.lang.NullPointerException
         at oracle.j2ee.ws.common.mapping.JavaWsdlMappingMetadata.findPortMapping(JavaWsdlMappingMetadata.java:296)
         at oracle.j2ee.ws.common.processor.config.ModelInfo.javaNameOfPort(ModelInfo.java:453)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.processPort(WSDLModeler.java:693)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.processService(WSDLModeler.java:651)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:393)
         at oracle.j2ee.ws.common.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:207)
         at oracle.j2ee.ws.common.processor.config.ModelInfo.buildModel(ModelInfo.java:167)
         at oracle.j2ee.ws.common.processor.Processor.runModeler(Processor.java:72)
         at oracle.j2ee.ws.server.codegen.WsCompile.run(WsCompile.java:448)
         at oracle.j2ee.ws.server.codegen.ServerArtifactGenerator.generateCompilables(ServerArtifactGenerator.java:408)
         ... 15 more
    I'm working with jwsdp 1.5 and Oracle OC4J Standalone v10.1.3
    Do you have any idea?
    Thanks in advance!

    Hello,
    Could you send me you source and ear at: tugdual[dot]grall[at]oracle[dot]com
    Regards
    Tugdual Grall

  • EJB Web Services Exception: missing field/property

    Hello
    I am having trouble creating EJB Web Services.
    When i send the following XML-content:
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <SOAP-ENV:Body>
        <yq1:create xmlns:yq1="http://company.com/project/beans/local/">
          <firstName>q</firstName>
          <lastName>s</lastName>
          <email>d</email>
          <userName>f</userName>
          <password>g</password>
        </yq1:create>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    I receive this response:
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
          <faultcode>SOAP-ENV:Client</faultcode>
          <faultstring>com.sap.engine.services.webservices.espbase.server.additions.exceptions.ProcessException: Deserializing fails. Nested message: JAXB request bean 'com.company.project.beans.local.jaxws.Create@18eadca' is missing field/property with name 'firstName'.</faultstring>
          <detail>
            <yq1:com.sap.engine.services.webservices.espbase.server.additions.exceptions.ProcessException xmlns:yq1="http://sap-j2ee-engine/client-runtime-error">
              <!-- com.sap.engine.services.webservices.espbase.server.additions.exceptions.ProcessException: Deserializing fails. Nested message: JAXB request bean 'com.company.project.beans.local.jaxws.Create@18eadca' is missing field/property with name 'firstName'. -->
            </yq1:com.sap.engine.services.webservices.espbase.server.additions.exceptions.ProcessException>
          </detail>
        </SOAP-ENV:Fault>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    This is the code to my EJB and the interface:
    @WebService(endpointInterface="com.company.project.beans.local.PersonLocal", portName="PersonBeanPort", targetNamespace="http://company.com/project/beans/local/", serviceName="PersonService")
    @Stateless
    public class PersonBean implements PersonLocal {
         @PersistenceContext
         private EntityManager em;
         public void createAsObject(Person person) {
              em.persist(person);
         public void create(String firstName, String lastName, String email, String userName, String password) {
              Person person = new Person(firstName, lastName, email, userName, password);
              createAsObject(person);
    @WebService(targetNamespace="http://company.com/project/beans/local/", name="PersonLocal")
    @Local
    public interface PersonLocal {
         @WebMethod(operationName="createAsObject")
         public void createAsObject(@WebParam(name="person")
         Person person);
         @WebMethod(operationName="create")
         public void create(@WebParam(name="firstName")
         String firstName, @WebParam(name="lastName")
         String lastName, @WebParam(name="email")
         String email, @WebParam(name="userName")
         String userName, @WebParam(name="password")
         String password);
    Do you have any advice on how to resolve this problem?
    Thanks in advance
    Vincent

    Hi,
    in case you want some specific text,you can raise the exception  like this in your function module.
    MESSAGE I001(ZPLATINO)  RAISING EXCEPT1.
    message class: ZPLATINO
    exception        : EXCEPT1
    message no 001,
    message text : CHECK ERROR PUSHKAR1
    and your response will be like.:
    <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
         <soap-env:Body>
              <soap-env:Fault>
                   <faultcode>soap-env:Client</faultcode>
                   <faultstring xml:lang="en">EXCEPT1</faultstring>
                   <detail>
                        <n0:Zpl.Exception xmlns:n0="urn:sap-com:document:sap:soap:functions:mc-style">
                             <Name>EXCEPT1</Name>
                             <Text>CHECK ERROR PUSHKAR1</Text>
                             <Message>
                                  <ID>ZPLATINO</ID>
                                  <Number>001</Number>
                             </Message>
                        </n0:Zpl.Exception>
                   </detail>
              </soap-env:Fault>
         </soap-env:Body>
    </soap-env:Envelope>
    I think this solves your problem.
    points..points..:)
    Message was edited by:
            pushkar anand

  • Need help in EJB Web Services

    I have been programming an EJB Web Service. I programmed the EJB and I have programmed the Client. It works properly when I execute it in the command line.
    However, I would like to access it using a web page. I have tried with a JSP (I posted some messages in the forum before) but I had lots of problems because of the versions. I have tried with a servlet but it doesn't work (I don't know really how to execute it, where to deploy it, what is the address to write in the iExplorer, and so on).
    Please, if somebody can help me I will be very thankful.
    I am new in developing with J2EE and OC4J and I am desperate!
    I need documentation or a complete example for OC4J 9.0.3.
    Thank you very much!
    Paloma

    I have been programming an EJB Web Service. I programmed the EJB and I have programmed the Client. It works properly when I execute it in the command line.
    However, I would like to access it using a web page. I have tried with a JSP (I posted some messages in the forum before) but I had lots of problems because of the versions. I have tried with a servlet but it doesn't work (I don't know really how to execute it, where to deploy it, what is the address to write in the iExplorer, and so on).
    Please, if somebody can help me I will be very thankful.
    I am new in developing with J2EE and OC4J and I am desperate!
    I need documentation or a complete example for OC4J 9.0.3.
    Thank you very much!
    Paloma

  • How to Migrate OC4J EJB Web service to Weblogic

    Hello,
    We have a J2EE app developed under OC4J that needs to be migrated to weblogic 10.x. It uses web services mapped to EJB's with the oracle.j2ee.ws.SessionBeanWebService class, example setup:
    <servlet>
    <servlet-name>CreditCardManager</servlet-name>
    <servlet-class>oracle.j2ee.ws.SessionBeanWebService</servlet-class>
    <init-param>
    <param-name>jndi-name</param-name>
    <param-value>CreditCardManagerBean</param-value>
    </init-param>
    </servlet>
    Can someone point me to any docs on how to create the equivalent objects in Weblogic?
    Thanks,
    Leor

    Microsoft webservices uses HTTP sessions to maintain state. That means that the webservice sends a token to the client to be passed back on subsequent calls.
    Unfortunately, the webservice control in 8.1 doesn't know how to send the session token back to the MS webservice. The webservice control knows how to talk SOAP only. It doesn't know about session tokens. The reason for this is the different protocols available to transmit SOAP. Most of them are not HTTP session aware.
    Workshop webservices uses conversation ID's that are contained within the SOAP header to maintain state. That way, we don't have the dependency on the session state for maintaining state.
    The way to handle Microsoft's stateful webservice implementation is to create a custom webservice control that uses an HTTP client. Query the HTTP client for the session cookie. Store the session token and send it with subsequent calls to the MS webservice.
    Thanks,
    David Gorton
    Workshop Customer Centric Engineering

  • Problem invoking EJB web service from Java

    The project has a BPEL project calling embedded Java class and that Java class is invoking EJB WS(Java based).
    The whole project has been developed in Jdeveloper. There is a dependency set between BPEL project and the EJB project.
    The EJB WS has been deployed in the machine where BPEL server is running.
    When I am running the java(embedded in BPEL project) manually in Jdeveloper then it is callig the EJB WS without any issue.
    But when the BPEL is invoking the same Java and which in turn is invoking the EJB WS then it is giving this error in the BPEL Audit file :
    <runtimeFault xmlns="http://schemas.oracle.com/bpel/extension">
    - <part name="code">
    <code>
    java.lang.NoClassDefFoundError
    </code>
    </part>
    - <part name="summary">
    <summary>
    com/formfactor/it/promis/PromisLinkWSSoapHttpPortClient
    </summary>
    </part>
    - <part name="detail">
    <detail>
    [Ljava.lang.StackTraceElement;@1cde909
    </detail>
    </part>
    </runtimeFault
    Note: com/formfactor/it/promis/PromisLinkWSSoapHttpPortClient is the WS end-point.
    To try out I have put EjbWebServices.jar , which has PromisLinkWSSoapHttpPortClient.class, in <SOA_HOME>/bpel/system/classes . But it did not help.
    Can you please let me know what else has to be done?

    Hi,
    Can anyone help me with this ??
    I guess I am not able to send the authorization credentials via the request to the web service invocation.
    Plz help ! This is a bit urgent..
    Regards,
    Shiva Kiran

  • Wsdl file that is used in bpel (ejb web service)

    hi all,
    i have created a product table in the database and then i created an entity product class from the table,
    after that i created session bean and publish this session bean as a web service.
    During creating session bean --> i chose Business tier00--> session bean --> include Web Service Endpoint Interface-->
    i got the interface ProductSessionWeb Service (java file) but i am wondering why in the class i need to import and do anotation @WebMethod on my own the tool does do this for me.
    After adding anotation @WebMethod for an operation (selectAll) in order to select product table.
    i deployed this web service on oracle application server. it was sucessful and i tested this web service . it returned the product data that i expected.
    1. However, i can not find WSDL file in the directory that i created.
    2. i can only see wsdl file from my address location on (Explorer)
    3. How can i generate WSDL file from this application because i want to use this wsdl file in order to drag this (web service )file using in my bpel process.

    The webservice code and its wsdl is generated when deployed to the application server based on the annotations, method signature, etc. In a top-down/contract-driven approach you would construct the wsdl yourself and then add the implementation. Both methods have their pro's and cons.
    If you want the wsdl locally, you can just open it in the browser and save it to disk. In the BPEL editor you can also point to the URL instead of the filesystem when defining a partnerlink.
    Regards, Ronald

  • EJB Web service date type

    Hi,
    I have a web service implemented by session bean from CMP Entity Beans from table,this works, but a DATE type present in the field of database table not appear in WSDL definition, therefore I can't assign this value at object.
    Any idea?
    Thanks for your answers.
    Juan.

    Hello Juan,
    Could you please give me more information about the release and features you are using?
    - which version of OracleAS ?(10g R2-10.1.2 or 10g R3 - 10.1.3)
    - which kind/version of EJB? 2.0, 2.1 or 3.0
    I would expect to see a java.sql.Date that will be mapped to a xsd:dateTime in the WSDL.
    Regards
    Tugdual Grall

Maybe you are looking for

  • "You Need To Restart Your Computer" Message every time I try to boot up

    I recently installed Mac OS X 10.4 onto my Mac Mini after a licence became available in my home. All was working fine and I updated to 10.4.11 updated safari, flash all that kinda stuff I was missing with 10.3. There was a mega (20.4GB) log file call

  • Help - Using PDF forms in Livecycle & submitting them by e-mail

    Hi I have prepared a form, which is an interactive pdf, although I was experiencing problems that this wasn't being read by any adobe reader's under version 8. I've imported my form into Adobe LiveCycle Designer ES 8.2, which I have no experience of

  • Defaulting Rules using PL/SQL Api - ORA error

    Hi All, Iam using the PLSQL api for OM defaulting rules. Based on the item in the Sales order line, Line type has to be defaulted. I have put debug messages and iam able to see successful execution and the required Line type value is returned. No exc

  • Fixed Asset and G/L reconciliation

    Dear All Can anyone help me with how best to reconcile the fixed asset module with the General Ledger. Is there a guideline or process on what reports are best used and how to do this. Many Thanks PRG

  • Using an external DVD burner with iBook G4

    Hi, I am new to this ibook game so bear with me....I purchased an iBook G4 from ebay and hooked my Lacie external DVD burner up to it as it only has a combo drive. Anytime I try to burn DVDs though it says that it cannot use this disk. When I look in