Sending image as attachment

I have generated endpoint from WSDL with IBM RAD 7.0.
I'm sending jpg image as attachment:
public class Send {
client-luokkia.
     public static void main(String[] args) {
          try {
               AttachmentServiceLocator asl = new AttachmentServiceLocator();
               AttachmentTip tip = asl.getAttachmentTip();
               System.out.println("send image");
               sendImage(tip, "file:///C:/temp/12a.jpg");
          } catch (Throwable t) {
               t.printStackTrace();
     static void sendImage(AttachmentTip tip, String fileName)
               throws RemoteException {
          try {
               Toolkit toolkit = Toolkit.getDefaultToolkit();
               Image image = toolkit.createImage(fileName);
               image.flush();
               tip.sendImage(image);
               System.out.println("image sent");
          } catch (Exception e) {
               System.out.println("error " + e.getLocalizedMessage());
}I get this erro from client:
17.4.2007 14:06:18 com.ibm.ws.webservices.engine.attachments.ImageDataSource <init>
SEVERE: WSWS3227E:  Error: Exception:
java.lang.IllegalArgumentException: Width (-1) and height (-1) cannot be <= 0
     at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1031)
     at java.awt.image.BufferedImage.<init>(BufferedImage.java:347)
     at com.ibm.ws.webservices.engine.components.image.MerlinIO.privilegedSaveImage(MerlinIO.java:139)
     at com.ibm.ws.webservices.engine.components.image.MerlinIO.access$000(MerlinIO.java:95)
     at com.ibm.ws.webservices.engine.components.image.MerlinIO$1.run(MerlinIO.java:108)
     at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63)
     at com.ibm.ws.webservices.engine.components.image.MerlinIO.saveImage(MerlinIO.java:106)
     at com.ibm.ws.webservices.engine.attachments.ImageDataSource.<init>(ImageDataSource.java:107)
     at com.ibm.ws.webservices.engine.attachments.ImageDataSource.<init>(ImageDataSource.java:98)
     at com.ibm.ws.webservices.engine.encoding.ser.ImageDataHandlerSerializer.serialize(ImageDataHandlerSerializer.java:121)
     at com.ibm.ws.webservices.engine.encoding.SerializationContextImpl.serializeActual(SerializationContextImpl.java:823)
     at com.ibm.ws.webservices.engine.encoding.SerializationContextImpl.serialize(SerializationContextImpl.java:547)
     at com.ibm.ws.webservices.engine.xmlsoap.ext.ParamValue.serializeItem(ParamValue.java:419)
     at com.ibm.ws.webservices.engine.xmlsoap.ext.ParamValue.serialize(ParamValue.java:340)
     at com.ibm.ws.webservices.engine.xmlsoap.ext.RequestResponse.outputImpl(RequestResponse.java:602)
     at com.ibm.ws.webservices.engine.xmlsoap.ext.RequestResponseAlternateContent.serialize(RequestResponseAlternateContent.java:117)
     at com.ibm.ws.webservices.engine.xmlsoap.SOAPElement.outputImpl(SOAPElement.java:1961)
     at com.ibm.ws.webservices.engine.xmlsoap.SOAPElement.outputContentsImpl(SOAPElement.java:2042)
     at com.ibm.ws.webservices.engine.xmlsoap.SOAPElement.outputImpl(SOAPElement.java:2017)
     at com.ibm.ws.webservices.engine.xmlsoap.SOAPEnvelope.outputImpl(SOAPEnvelope.java:355)
     at com.ibm.ws.webservices.engine.xmlsoap.SOAPElement.output(SOAPElement.java:1937)
     at com.ibm.ws.webservices.engine.SOAPPart.writeTo(SOAPPart.java:897)
     at com.ibm.ws.webservices.engine.SOAPPart.writeTo(SOAPPart.java:816)
     at com.ibm.ws.webservices.engine.SOAPPart._getWebServicesInputSource(SOAPPart.java:950)
     at com.ibm.ws.webservices.engine.SOAPPart.getAsWebServicesInputSource(SOAPPart.java:574)
     at com.ibm.ws.webservices.engine.Message.getContentType(Message.java:498)
     at com.ibm.ws.webservices.engine.transport.http.HTTPSender.invoke(HTTPSender.java:491)
     at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:227)
     at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:227)
     at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:227)
     at com.ibm.ws.webservices.engine.WebServicesEngine.invoke(WebServicesEngine.java:332)
     at com.ibm.ws.webservices.engine.client.Connection.invokeEngine(Connection.java:738)
     at com.ibm.ws.webservices.engine.client.Connection.invoke(Connection.java:659)
     at com.ibm.ws.webservices.engine.client.Connection.invoke(Connection.java:617)
     at com.ibm.ws.webservices.engine.client.Connection.invoke(Connection.java:452)
     at com.ibm.ws.webservices.engine.client.Stub$Invoke.invoke(Stub.java:908)
     at org.example.www.AttachmentBindingStub.sendImage(AttachmentBindingStub.java:86)
     at fi.kela.testi.Send.sendImage(Send.java:38)
     at fi.kela.testi.Send.main(Send.java:26)What this mean? Does it mean that image is somehow null or what?

               sendImage(tip, "file:///C:/temp/12a.jpg");...
               Image image = toolkit.createImage(fileName);
Are you sure you can give Toolkit.createImage(String fileName) an URL? Perhaps you should call it with "c:/temp/12a.jpg" instead.

Similar Messages

  • Axis and Mime to send Images with Web Services

    Hi, I have been reading a lot of information about MIME and how I have to send images or attachaments with Web Services, and I am a little lost. I would to find a simple example to use MIME with AXIS 1.4 . Do anybody know where I can find some example to use attachements with AXIS???
    Thank you very much in advance

    Hi,
    When you are using JAX-WS, there is a tool wsimport, with which you are going to generate the artifacts required to implement the web service.
    When you pass the WSDL as a parameter to the wsimport tool, it will be create the required beans also(JAXB Objects).
    So need of any other external implementation of JAXB when you are working with JAXWS
    Thanks,

  • Need help saving image to SQL as BLOB, then sending as email attachment

    Hi folks,
    These forums have gotten me most of the way through this particular project, but I'm finally stumped...
    First, I'll describe exactly what I'm trying to do: the user chooses an image file client side and the server-side code then converts it to binary data and saves it to SQL. Then as a separate step, an email will be sent out with that image file loaded from the DB as an attachment.
    So I've actually got most of this working. I'm using the O'Reilly MultipartParser class to pull the file input stream from the Request and insert it into SQL BLOB column ("image" datatype). I can successfully send Text attachments by simply converting the binary data back to a string and then using a subclass of DataSource (ByteArrayDataSource) to feed it to the mail object.
    After getting the text documents to work, I then moved on to trying to send images.
    I tried to send images using essentially the same technique as sending text. The image file gets saved to SQL the same way and I then convert the binary data back to a string an attach it. The only difference is that I set the content-type to "image/gif".
    I didn't really expect this to work, however, I am able to "Preview" very simple Gifs (in XP) that I've attached. I cannot "Open" them, though, and I cannot even "Preview" more complicated Gifs.
    So on to my real questions. I didn't really expect that you could simply output binary image data into Text format and simply slap on a ".gif" and expect it to work. Am I right about that? XP's "preview" option seems to read it okay, but I really need to be able to "open" these files.
    So basically I need to know what to DO with that binary data in SQL in order to successfully attach it as a true image file. Is this an encoding issue? MIME type?
    I didn't want to paste all the code but I'll paste the snippet that deals with the attachment section. If you'd like to see any other parts, please just let me know...
    MyBlobObject v_blob = new MyBlobObject(m_cp);  // the getBlobStr() method of this object simply grabs the data from SQL as a String
    DataSource source = new ByteArrayDataSource(v_blob.getBlobStr(),"application/octet-stream");
    BodyPart messageBodyPart = new MimeBodyPart();
    messageBodyPart.setDataHandler(new DataHandler(source));
    messageBodyPart.setHeader("content-type","image/gif");
    messageBodyPart.setFileName(v_fileName);
    ...Another interesting thing I'm seeing is that when I view the small Gif as text, I see this:
    GIF89a � !� , D ;
    While the file I'm getting from SQL as an attachment looks like this:
    GIF89a ? !? , D ;
    Obviously, the question marks are unknown, but I'm not quite sure why. I outputted the char values as integers and found that the first question mark is 65408 and the second one's value is 65529. Obviously something is getting changed somewhere in the process, but I'm not quite sure how and where.
    anyway, thanks in advance for any advice!

    Nevermind! Of course, I figured it all out after writing that long post.
    I had tried using a byte array instead of the String in the ByteArrayDataSource and it hadn't worked. However once I cleaned up the code a bit I got it working.
    This links has it all...
    http://www.magelang.com/faq/view.jsp?EID=498439
    thanks anyway!

  • How to send image file through mail without   any attachment

    Plz tell  me how to send image file through mail without any attachment  ( i mean not converting  that image into pdf or any format )  i want to send that text or image  through mail .

    Hi Sandeep,
    I think you can setup the type of email in Shared office Settings in transaction S016.
    There is an option called <Preset document classes>
    You choose this pushbutton to branch to the maintenance screen for the document classes that are directly displayed to users in the Business Workplace for selection when they use the Create function. The name under which the documents are displayed can also be maintained.
    http://help.sap.com/saphelp_nw70/helpdata/en/6c/69c30f418d11d1896e0000e8322d00/content.htm
    Haven't tried it though.
    Regards,
    Siddhesh

  • Some recipients receive my images attached to emails, some find they are embedded and difficult to impossible to separate. Just found out that if I remove my attached signature, the problem goes away. How to send images   signature reliably?

    Some recipients receive my images attached to emails, some find they are embedded and difficult to impossible to separate. Just found out that if I remove my attached signature, the problem goes away. How to send images plus signature reliably?

    When you attach things, make sure to check the box that says [√] Send Windows-Friendly attachments

  • Sending Image attachment Using Mail 7.3 and OS X 10.9.3.

    For some reason sending an email with an image attached and when I select the large image size drop down menu it does not change the actual size of the image attachment. Instead it stays the same as the medium image size. In fact the message size remains the same. However I can chafe to small, medium, and actual size but not large! Can anybody help?
    Thanks in advance,
    Michael

    That's what I thought you might have meant, but wasn't quite sure. I think in this case that Mail simply can't make a "large" and "medium" image different sizes. I don't know what Mail's mechanism is for doing this, but I often find the same thing occurring with images I attach. Sometimes there is no choice that works. The image size is just what it was when attached.
    I wish I had a better answer for you than, "it is what it is." But I don't think there's a problem you can solve. Mail is functioning as it "normally" functions, at least from my experience.

  • I send images attached. Others rcv them embedded

    I have to send image files of ads out to a lot of newspapers and clients. I've always sent them as .jpg attachments. Last week they all started saying they were were receiving them as unusable embedded. They want me to resend as attached jpgs. Since that's what I did in the first place, I don't know what to do different.
    If I change them to pdfs, they get them ok, but that is inconvenient for our workflow. How can I again send jpgs?

    Your OS detail provided indicates you are running 10.4.4. Any reason you have not updates to 10.4.8?
    Are you using RTF or Plain Text for message composition and are you including a Signature?
    If you are using RTF for message composition (which is really HTML with Tiger Mail), try using Plain Text instead which should resolve it. More than likely these recipients are using Windows Outlook as their email client which depending on the version used has problems with Tiger Mail's RTF.

  • How to send images using SOAP adapter

    hi All,
    I want to send images using the SOAP adapter . ( Sender and Receiver )
    Can anybody help out with this requirement
    Regards,
    Loveena

    Hi,
    Following links may help U
    /people/siva.maranani/blog/2005/09/03/invoke-webservices-using-sapxi
    http://help.sap.com/saphelp_nw04/helpdata/en/3c/b4a6490a08cd41a8c91759c3d2f401/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/29/5bd93f130f9215e10000000a155106/frameset.htm
    to know the basics about soap adapter u cn check out this link
    /people/padmankumar.sahoo/blog/2005/02/15/an-overview-of-soap
    to get in detail about the attachments chk out this link
    hi i am unable to attach an attachment in File to mail scenario
    Regards
    Pullarao

  • After updating to ios 6.1.3 I cant send images through imessage

    Hello

    That’s strange that my description in my first post is not showing up
    I have noticed that after I updated my iOS on my iPhone 5 to 6.1.3 the iMessage can no longer send images to other iDevices
    Sending regular text works but once an image is attached the message informs me that it has not been delivered and a red exclamation mark appears
    I tried to send images from multiple networks
    LTE
    3G
    3 different WiFi networks
    All of these fail
    I also reset my device from a backup and reset my network settings with no luck
    I really hope that this gets fixed soon because I do use imessage to send photos to my friends that have their own iDevices

  • When I send image attachments through Mail they are received as very small and squashed. How can I change this?

    I have a problem sending image attachements (e.g., jpeg, png files etc) with the Mail utility from my MacBook Pro.  When people receive my email the attached image shows up not as an attached file that can be saved or downloaded, but as just a very small, squashed up version of the image imbedded in the email message itself.
    I usually add these attachments by simply dragging and dropping the desired file into the window of the email text. Is this the wrong way to do it?
    thanks
    Jerry

    Is this the wrong way to do it?
    The safest way to send images is to create a compressed file and send that.
    Click the image you want to send, go to File in the menu bar and select Compress... You end up with a file with a .zip at the end. Attach that to your email. Then trash the .zip file.
    The person at the other end only has to double click the .zip attachment.
    You can compress are single image or a folder of them.

  • Sending image in mail

    Hi,
    I have a requirement to send image in mail.
    I got a code from a post which is as following :
    import javax.mail.* ;
    import javax.mail.internet.* ;
    import java.util.Properties;
    class SimpleMail1 {
        public static void main(String[] args) throws Exception{
            System.out.println("Sending mail...");
            Properties props = new Properties();
            props.setProperty("mail.transport.protocol", "smtp");
            props.setProperty("mail.host", "smtp.mymailserver.com");
            props.setProperty("mail.user", "myuser");
            props.setProperty("mail.password", "mypwd");
    Session mailSession = Session.getDefaultInstance(props, null);
            mailSession.setDebug(true);
            Transport transport = mailSession.getTransport();
    MimeMessage message = new MimeMessage(mailSession);
            message.setSubject("HTML  mail with images");
    // write sender's and recpient's email address
       message.setContent
              (" img src=image_path" + "html/text");;    
            transport.connect();
            transport.sendMessage(message,
                message.getRecipients(Message.RecipientType.TO));
            transport.close();
    Here, the image is being taken from an internet link whereas I am working on Linux server.
    If I place a file on some location on the server, how to get the file from this location in this code?
    Regards,
    Nikhil

    Cary,
    I got your email overnight.
    The 5 attachments are full size JPEG files, and the overall size of the message is 4.5 MB. Three of them have been compressed more than the other two, which you can see looking at the file sizes shown in the attached screenshot I sent back to you, but all of them decompress into full size photos of good size.
    You may have muddied the water slightly, by Forwarding rather than sending a new message as you did originally. That can easily be checked if you open the message as originally sent, click on Message in the menubar and choose Send Again -- then change the To address to mine.
    However, I think there is another issue causing the message to be sent in Rich Text Format, which causes some conversion of text to HTML, which then is problematic to some email clients some recipients use on Windows computers, notably Outlook and Outlook Express. Specifically, the file name of each photo appearing beneath and between each attachment can cause this, as could multiple fonts (but you did have that). To stop the file name printing, which is coming from iPhoto's preparation of the message, change the selection in the Email dialogue in iPhoto to deselect Include Title and Include Comments.
    Then be sure to send all such messages in Plain Text, and be sure to use Windows Friendly if not already.
    Ernie

  • How to send image as a part of body with java mail

    How to send image (.GIF) file in mail body & not as an attachement using java mail API

    You need to create a multipart/related message.
    You'll probably find examples in this forum.

  • Mail not sending images

    A friend uses Mail on OS X (not sure which version) and can't send images inline. She's tried copying the image then pasting it within the body of the email message, but when it is received it shows either a question mark or a broken image icon.
    I have tried the same on my Mac (OS 10.4.11) and it works fine. Is there a setting that she needs to have set on her system in order for the images to be sent?
    Thanks.

    Thanks for the reply, Ernie.
    From what she's told me, she is copying image files from her desktop or some folder and pasting them into her emails. She can see the image that she pasted, but the images are not being sent, just the text. She wants to embed the images as opposed to attaching them because some of her recipients don't like opening attachments.
    I have done as she described and was able to succesfully send and receive (I sent them to myself and opened the email in another reader) the emails.
    I had her check her preferences, and in the View section all selections were checked as they are in mine. Is there something else that should be selected within Mail to allow embedded images to be sent?
    Thanks again.
    Ted

  • Function to send fax the attachment of the pur. order when i output control

    Hi friends,
    when i output control purchase order -
    user want to send also the attachment documents when i click on output push button.
    is anyone know how can i do that?
    wich function can send the attachmant to fax?(it could be image, document,excel...etc).
    thanks in advanced,
    Michal.

    Hi,
    Which FAX server software do you use?
    PO output with attachment is standard function in SRM.
    SRM -> PO with attachment via SMTP -> FAX server (attachment conversion) -> FAX protocol -> Vendor
    Regards,
    Masa

  • Can i send images by email as attachments rather than embedded in email

    can i send images by email as attachments rather than embedded in email

    How the email message looks in Mail is fairly irrelevant to how it will look to the recipient.  An image attached to an email message is an attachment regardless of how the client displays it.  Some will display it inline, others as an icon in a list of attached files.  Regardless, it is an attachment and should be capable of being opened, saved to another location, etc.
    Unfortunately, some Windows email clients (*cough* Outlook *cough*) are absolutely crippled when it comes to email standards, and make it difficult for recipients to view or save some attached images.  You can better ensure success with Outlook by using Windows-friendly attachments and only sending plain text email, rather than HTML email.  However, Outlook is still Outlook, and it does not play well with others.
    If you must communicate with people who use Outlook  try uploading your photos to an album on Picasa, Flikr, Shutterfly, etc, and then send people a link instead.  Or convince them to use a real email client, like Thunderbird.

Maybe you are looking for