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

Similar Messages

  • How to animate images coming from web service in iphone sdk.

    this is my code check once and give me reply.
    - (void)parserDidEndDocument:(NSXMLParser *)parser{
        moreListTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 10, 320, 350) style:UITableViewStylePlain];
        moreListTableView.delegate = self;
        moreListTableView.dataSource = self;
        [self.view addSubview:moreListTableView];
        for(i=0; i < [advImagesList count]; i++){
            NSString *data=[[NSString alloc]initWithFormat:[advImagesList objectAtIndex:i]];
            Byte inputData[[data lengthOfBytesUsingEncoding:NSUTF8StringEncoding]];
            [[data dataUsingEncoding:NSUTF8StringEncoding] getBytes:inputData];
            size_t inputDataSize=(size_t)[data length];
            size_t outputDataSize=EstimateBas64DecodedDataSize(inputDataSize);
            Byte outputData[outputDataSize];
            Base64DecodeData(inputData, inputDataSize, outputData, &outputDataSize);
            NSData *theData=[[NSData alloc]initWithBytes:outputData length:outputDataSize];
            imgview=[[UIImageView alloc]initWithImage:[UIImage imageNamed:data]];
            imgview.frame=CGRectMake(0, 317, 320, 50);
            imgview.image=[UIImage imageWithData:theData];
            [self.view addSubview:imgview];
        Timer = [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector(moveRect) userInfo:nil repeats:YES];
    -(void)moveRect
      //  imgview.animationImages=advImagesList;
        [imgview startAnimating];
        [imgview setAnimationDuration:2];

    This is a user forum.  Try developer.apple.com.

  • 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..

  • How do I add image upload to web app edit template?

    How do I add image upload to web app edit template. When creating fields I am selecting image from the field type. But the only way to upload and image is when I create the web app item within the admin. The option to upload an image is not available when the user submit web form opens.
    Wont send any of these questions through this email anymore but really needed assistance.
    Thanks,
    Gordon

    On the Details tab of the Web App setup, under Web App Item Options; have you ticked "Allow File Upload" and specified a Default Upload Folder?

  • How to enable SOAP compression in web services

    Hi, I have created a web services by exposing an EJB using annotations. Trouble now is that the output is an array of Objects which grew to a significant size to cause latency issue. I have saw folks using filters to compress the HTTP response but is unable to find much resources on the web linking up annotated-EJB web services to link up with the filters but most of the examples I see are based on handlers and not EJB-exposed web services, can someone point me to some resources for that type of web services + compression?
    Another thing which caught my attention is the use of the <compress-html-template> tag which needs to be in the web.xml file, but since I am using a "generated" web services as per say, I do not have that web.xml file, how then can I use that feature?
    Thanks in advance.

    Hi Anke,
    all tables that have been created in V9.7 with attribute COMPRESS YES will be compressed statically .
    db2 " select count(*) , rowcompmode from syscat.tables group by rowcompmode "
    After the upgrade to 10.5 all tables created with attribute COMPRESS YES will get rowcompmode='A' but old tables created with V9.7 will stay with rowcompmode='S' .
    You can change tables from  rowcompmode='S' to rowcompmode='A' via  ALTER TABLE . After this all new pages or old pages that are touched will be adaptively compressed. But old pages that are not touched will only be static compressed. To get all pages of an existinbg table adaptive compressed you need to move data. For example with DB6CONV.
    Regards
                   Frank

  • 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

  • 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

  • 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 can I call a SAPME web service from MII such as PlaceFutureHold?

    Dears,
    How can I call a SAPME web service from MII such as PlaceFutureHold?
    By using MII, I would like to develop some logic to check some values which query from SAPME database, if the value is out of spec, it needs to send a emal to inform user ans also hold the SFC.
    Thanks!

    With Web service action block you can view all ME available services
    in I.E
    https://sapme:5000/manufacturing-services/ProductionServiceService?wsdl  you could see your FutureHold service
    To do that in MII, you need Web Service action block. Have you work with MII transaction before?
    (saw your post in MII)

  • 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

  • How to install and consume GroupWise Web Service (SOAP)

    Hello! I'm Razvan, programmer from Romnia, and I am new to GroupWise development.
    I am asking if anyone could help me with a C# Visual Studio 2010 example of how to install and consume GroupWise Web Service (SOAP).
    The documentation from novell site didn't help me, i didn't understant much of it.
    All I need is either a link to a documented GroupWise C# developer step-by-step tutorial, or some code examples.
    Can you please show me some code examples in C# with:
    1)loging in using a username and a password,
    2)retrieving contact list,
    3)retrieving appointment list,
    4)sending a mail,
    5)setting an appointment
    I don't know how to use "groupwise.wsdl" and customise it so that it points to our GroupWise server.
    Please, I really need this because I am working at a project right now which involves GroupWise integration.
    I hope I haven't disturbed anyone with my simple question.
    I know this might be a very simple question given the complexity of the other posts here, but that's why I really hope I will get an answer soon.
    Thank you very much!
    Signature:
    How old is the Orthodox faith?
    How old is the orthodox faith?

    Just a comment.
    The value for the version element should be "1.02"
    not "1.2".
    Preston
    >>> On Tuesday, March 01, 2011 at 8:06 AM,
    TheRomanian<[email protected]> wrote:
    > I have great news! After strong documentation yesterday and today, I've
    > just made a successfull example that actually connects to our GroupWise
    > server.
    >
    > I made it in PHP.
    >
    > I need an ASP.NET + C# application, but now is very simple to convert
    > it. I post the PHP code here for other people who in future might be
    > interested in finding out.
    >
    > So a simple PHP GroupWise Login code using "groupwise.wsdl" web
    > service:
    >
    >
    > require_once('./GWService/GroupwiseService.php');
    > require_once('FB.class.php');
    >
    > $classmap = array(
    > 'Authenication' => 'Authenication',
    > 'PlainText' => 'PlainText',
    > 'loginRequest' => 'loginRequest',
    > 'loginResponse' => 'loginResponse',
    > 'logoutRequest' => 'logoutRequest',
    > 'logoutResponse' => 'logoutResponse',
    > 'UserInfo' => 'UserInfo',
    > );
    >
    > $gwservice = new GroupwiseService(
    > "./WSDL/groupwise.wsdl",
    > array(
    > "location" => "http://11.150.40.78:8756/soap",
    > *Your GroupWise server IP:
    > and PORT*
    > "classmap" => $classmap,
    > "trace" => true)
    > );
    >
    > // do login
    > $pt = new PlainText();
    > $pt‑>username = *"YOUR GROUPWISE USERNAME"*;
    > $pt‑>password = *"YOUR GROUPWISE PASSWORD"*;
    >
    > $lr = new loginRequest();
    > $lr‑>auth = $pt;
    > $lr‑>language = "en";
    > $lr‑>version = "1.2";
    > $lr‑>application = "phpClient";
    >
    > $lres = $gwservice‑>loginRequest($lr);
    > //print_r($lres);
    >
    >
    > I Hope this will help others.
    >
    > ‑‑
    > Signature:
    >
    > How old is the Orthodox Faith?
    > 'How old is the orthodox faith?'
    > (http://www.orthodoxphotos.com/history.shtml)

  • How to add the Note board web part to a page with powershell

    Hi everyone,
    I've been looking around everywhere but haven't seen it explicitly mentioned. 
    Does anyone know how to add the Note Board web part to a Team Site page, e.g. Non-publishing site, Left Zone, First webpart in the zone in powershell?
    Examples like this one http://adicodes.com/adding-web-part-to-page-with-powershell/ only talk about custom web parts uploaded from a local drive.
    The example here looks good - http://spcrew.com/blogs/lists/posts/post.aspx?id=21 but is it for the Page Viewer Web Part. How would you go about getting the correct name for the note board web part and configuring it? 
    Many Thanks,
    Ashley
    function main(){
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    $url = "http://sp2010dev1/sites/test1"
    $OpenWeb = Get-SPWeb $url
    $OpenWeb
    $OpenSite = Get-SPSite $url
    $file = $OpenWeb.GetFile("http://sp2010dev1/sites/test1/SitePages/test1.aspx")
    $WebPartManager = $file.GetLimitedWebPartManager([System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
    Add-PageViewerWebPart "http://sp2010dev1/sites/test1" "http://sp2010dev1/sites/test1/SitePages/test1.aspx" "Body" 0 "SPCrew Site" "sp2010dev"
    $OpenWeb.Dispose()
    function Add-PageViewerWebPart($SiteURL, $pageUrl, $webpartzone, $index, $title, $content)
        $site = new-object Microsoft.SharePoint.SPSite($SiteURL)
        $web=$site.OpenWeb()
        $webpartmanager=$web.GetLimitedWebPartManager($pageUrl, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
        $webpart = new-object Microsoft.SharePoint.WebPartPages.PageViewerWebPart
        $webpart.ChromeType = [System.Web.UI.WebControls.WebParts.PartChromeType]::TitleOnly;
        $webpart.Title = $title
        $webpart.ContentLink = "http://www.spcrew.com";
        $webpartmanager.AddWebPart($webpart, $webpartzone, $index);    
        $web.Close()
        $site.Close()
    function Get-SPSite([string]$url) {
        New-Object Microsoft.SharePoint.SPSite($url)
    function Get-SPWeb([string]$url) {
        $SPSite = Get-SPSite $url
        return $SPSite.OpenWeb()
        $SPSite.Dispose()

    Hi,
    According to your post, my understanding is that you wanted to add the Note board web part to a page with PowerShell.
    The name of the Note Board web part is SocialCommentWebPart.
    I recommend to use the powershell code below:
    $pageUrl="http://sitename/SitePages/test.aspx"
    $SiteURL="http://sitename"
    $site = new-object Microsoft.SharePoint.SPSite($SiteURL)
    $web=$site.OpenWeb()
    $webpartmanager=$web.GetLimitedWebPartManager($pageUrl, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
    $webpart = new-object Microsoft.SharePoint.Portal.WebControls.SocialCommentWebPart
    $webpart.title="Note Board"
    $webpartmanager.AddWebPart($webpart, "MiddleZone", 0);
    $web.Close()
    Then the Note board web part will be added to the page.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

Maybe you are looking for