Send Images using Dynamic Proxies

Hi!
I try to send java.awt.Images over the wire.
My first attempt was to modify the static
stub example from the tutorial ('hello').
I added a new method to the interface
and the implementation with Image as its
return value. It worked fine.
However, then I tried to modify the dynamic
proxy example from the tutorial ('proxy').
I added the same method, but it didn't work.
My method (getImage) seems to return a
javax.activation.DataHandler object instead
of Image, because a ClassCastException occured
at runtime.
I modifed the method's return value to
Object, but still returned an Image.
The return value was indeed DataHandler.
The DataHandler's getContent method returned
the Image I sent!
Where's my mistake?
Roland Spindler

The WSDL is generated automatically:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="MyHello" targetNamespace="http://com.test/wsdl/MyHello" xmlns:tns="http://com.test/wsdl/MyHello" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://java.sun.com/jax-rpc-ri/internal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<schema targetNamespace="http://java.sun.com/jax-rpc-ri/internal" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://java.sun.com/jax-rpc-ri/internal" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<simpleType name="image">
<restriction base="base64Binary"/></simpleType></schema></types>
<message name="HelloIF_sayHello">
<part name="String_1" type="xsd:string"/></message>
<message name="HelloIF_sayHelloResponse">
<part name="result" type="xsd:string"/></message>
<message name="HelloIF_getImage"/>
<message name="HelloIF_getImageResponse">
<part name="result" type="ns2:image"/></message>
<portType name="HelloIF">
<operation name="sayHello" parameterOrder="String_1">
<input message="tns:HelloIF_sayHello"/>
<output message="tns:HelloIF_sayHelloResponse"/></operation>
<operation name="getImage" parameterOrder="">
<input message="tns:HelloIF_getImage"/>
<output message="tns:HelloIF_getImageResponse"/></operation></portType>
<binding name="HelloIFBinding" type="tns:HelloIF">
<operation name="sayHello">
<input>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="http://com.test/wsdl/MyHello"/></input>
<output>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="http://com.test/wsdl/MyHello"/></output>
<soap:operation soapAction=""/></operation>
<operation name="getImage">
<input>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="http://com.test/wsdl/MyHello"/></input>
<output>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="http://com.test/wsdl/MyHello"/></output>
<soap:operation soapAction=""/></operation>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/></binding>
<service name="MyHello">
<port name="HelloIFPort" binding="tns:HelloIFBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/></port></service></definitions>

Similar Messages

  • 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

  • Sending mails using dynamic actions

    Hi
    How we can send mails using dynamic actions.
    Regards
    Santhosh

    Hi,
    Sending mails is possible by using the feature M0001. This is to be coded in the dynamic action depending on the requirement with function code "M".
    Hope this would help you to explore further. Incase of any specific query you can post back.
    Regards
    Tharak

  • How to send images using Tuxedo 6.5

    What would be the best way to send images( bmp, jpeg, gif) using Tuxedo 6.5? Ideally,
    I would like to keep the image with the data, ie., have the image as a field in
    the FML32 buffer. I can't see anyway of doing this... Create a new buffer type??
    Thanks
    Rich

    Rich,
    How about storing the binary image in an FML field of type CARRAY?
    Be aware of the performance impact of very large buffers - >75% of MSGMNB (I
    think) and they're transferred by file i/o -
    Regards,
    Peter.
    Rich Wojcik wrote:
    What would be the best way to send images( bmp, jpeg, gif) using Tuxedo 6.5? Ideally,
    I would like to keep the image with the data, ie., have the image as a field in
    the FML32 buffer. I can't see anyway of doing this... Create a new buffer type??
    Thanks
    Rich

  • Why there is no function to send images using Bluetooth ?

    Well I was very much annoyed with my iphone when there were necessities of sending important images using bluetooth and transferring files, Well they should make something similar to it, Is there any solution well i think there might no .....
                                                                                         happy republic day 2015 and happy holi 2015

    Bluetooth and WiFi Settings are moving to a top-level Setting in iOS 6.
    You could just leave Bluetooth turned on. When not in use it has a negligible effect on battery life.

  • Send mail using Dynamic actions

    Hello experts,
    How to send  a mail using Dynamic Actions??
    Requirement : Lets say one employee is hired on 26th Aug, so after 10 days he will be confirmed. so on 8th day need to send a mail to concerned person reminding the confirmation date.
    so how do i do that using dynamic actions??
    Thanks in advance.
    Saurabh

    Hi,
    In dynamic actions there is an option for calling sub-routine from any program or subroutine pool. So u can make subroutine for sending mail according to ur requirement. An call on th same from dynamic actions.
    if u want sample code for this, pls let me know.
    <removed_by_moderator>
    Regards,
    Ranjith
    Edited by: Julius Bussche on Aug 26, 2008 3:25 PM

  • J2me send image using php as server

    hii all,can you help me give me a souce code for send image in j2me to server(i'm using php)????????? cause i need for my final projects
    thanks

    The reason i want to use gmail because i can't use smtp university's mail server( looking to the apple server error log is say something about IsSMTP(); function. today, i had discussion with them(ICT dept) and they can't solve it as there's no apple server used before/now and no one familiar with it. they give me other alternative by using a "secret server", a subdomain name were given with no smtp authentication. no username or password were used, not even using any ssl or tsl security. they give me this last solution when i install joomla on the other windows server and try to use university smtp server with email account. error saying cannot connect to smtp server. i did try also using joomla on my apple server still with the error. so what i understand now is that its related to university global networking security/policy setting(correct me if i'm wrong). so for the SL server, its should be super easy to setup if you are yourself configuring the internet direct to your ISP. thanks very much to Camelt for quick answered. So i should not facing any problem with apple server if i bought and connect it direct to my ISP, right Camelot?

  • Error while sending images using iMessage in iPad Mini iOS 6.0.1

    Hi,
    When i am trying to send images through iMessage, its not getting deivetred. But i am able recieve images. I am also able to send and recieve est messages.Please help !!!!

    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
     Cheers, Tom

  • I have a iMac destop 10.6.2 and use the AOL Mail web site with your Firefox Browser. It has worked great for years. I update the firefox to 6.1 and now I cannot send images using the Firefox browser. With Safari browser it works fine.

    I use AOL mail - http://www.aol.com/ with my Firefox 6.1 browser. Before updating aol mail worked great with firefox for years. Now when I try to send ( upload) messages with a file or images I always get the reading " there was a technical problem and I should try again". Messages with NO files or images go through just fine. I have cleared the Firefox history, the cache and cookies and the problem remained the same. The question is does this problem have something to do with the latest update ? AOL are still only familar with the 3.6 Firefox versions. Thanks

    Well I guess I was too optimistic. Since last posting I have had three hang events, one during reboot. When the login dialog box came up I clicked on it and it hung.
    However I do have a new data point. I have enabled the remote login (sshd). I have discovered that when the system hangs like I described above, I can still log in via SSH from my Windows system. The shell appears normal, but when I tried a "killall Safari" command the OS crashed hard. After a hard reset, the system hung during the login process. Again I could login remotely, and that time I executed a "sudo reboot" via the remote session. That cleared the display to all-blue but did not successfully reboot.
    Can anyone suggest what to try via the remote login to help diagnose what is happening? I am familiar with typical Linux architecture but the differences in Mac OS X are leaving me a bit disoriented.

  • Urgent help:send image over network using rmi

    hi all,
    i have few question about send image using rmi.
    1) should i use ByteArrayOutputStream to convert image into byte array before i send over network or just use fileinputstream to convert image into byte array like what i have done as below?
    public class RemoteServerImpl  extends UnicastRemoteObject implements RemoteServer
      public RemoteServerImpl() throws RemoteException
      public byte[] getimage() throws RemoteException
        try{
           // capture the whole screen
           BufferedImage screencapture = new Robot().createScreenCapture(new     Rectangle(Toolkit.getDefaultToolkit().getScreenSize()) );
           // Save as JPEG
           File file = new File("screencapture.jpg");
           ImageIO.write(screencapture, "jpg", file);
            byte[] fileByteContent = null;
           fileByteContent = getImageStream("screencapture.jpg");
           return fileByteContent;
        catch(IOException ex)
      public byte[] getImageStream(String fname) // local method
        String fileName = fname;
        FileInputStream fileInputStream = null;
        byte[] fileByteContent = null;
          try
            int count = 0;
            fileInputStream = new FileInputStream(fileName);  // Obtains input bytes from a file.
            fileByteContent = new byte[fileInputStream.available()]; // Assign size to byte array.
            while (fileInputStream.available()>0)   // Correcting file content bytes, and put them into the byte array.
               fileByteContent[count]=(byte)fileInputStream.read();
               count++;
           catch (IOException fnfe)
         return fileByteContent;           
    }2)if what i done is wrong,can somebody give me guide?else if correct ,then how can i rebuild the image from the byte array and put it in a JLable?i now must use FileOuputStream but how?can anyone answer me or simple code?
    thanks in advance..

    Hi! well a had the same problem sending an image trough RMI.. To solve this i just read the image file into a byte Array and send the array to the client, and then the client creates an imegeIcon from the byte Array containing the image.. Below is the example function ton read the file to a byte Array (on the server) and the function to convert it to a an imageIcon (on the client).
    //      Returns the contents of the file in a byte array.
        public static byte[] getBytesFromFile(File file) throws IOException {
            InputStream is = new FileInputStream(file);
            // Get the size of the file
            long length = file.length();
            // You cannot create an array using a long type.
            // It needs to be an int type.
            // Before converting to an int type, check
            // to ensure that file is not larger than Integer.MAX_VALUE.
            if (length > Integer.MAX_VALUE) {
                // File is too large
            // Create the byte array to hold the data
            byte[] bytes = new byte[(int)length];
            // Read in the bytes
            int offset = 0;
            int numRead = 0;
            while (offset < bytes.length
                   && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
                offset += numRead;
            // Ensure all the bytes have been read in
            if (offset < bytes.length) {
                throw new IOException("Could not completely read file "+file.getName());
            // Close the input stream and return bytes
            is.close();
            return bytes;
        }to use this function simply use something like this
    public byte[] getImage(){
    byte[] imageData;
              File file = new File("pic.jpg");
              // Change pic.jpg for the name of your file (duh)
              try{
                   imageData = getBytesFromFile(file);
                   // Send to client via RMI
                            return imageData;
              }catch(IOException ioe){
                           // Handle exception
                           return null; // or whatever you want..
    }and then on the client you could call a function like this
    public ImageIcon getImageFromServer(){
         try{
              // get the image from the RMI server
              byte[] imgBytes = myServerObject.getImage();
              // Create an imageIcon from the Array of bytes
              ImageIcon ii = new ImageIcon(imgBytes);
              return ii;
         }catch(Exception e){
              // Handle some error..
              // If yo get here probably something went wrong with the server
              // like File Not Found or something like that..
              e.printStackTrace();
              return null;
    }Hope it helps you..

  • Dynamic Proxies - being forced to recompile client if server changes

    all,
    I am using WLS 6.1 sp 2.
    I have a bean deployed on a particular instance of Weblogic.
    This bean is being accessed by a bean from a different instance.
    The calling applications ear contains a jar containing the Interface classes, Helper Classes, Stub classes (included since I have read server does not allow dynamic download of stubs), XML (I guess from 6.1 onwards weblogic uses dynamic proxies).
    The problem is that every time my server implementation changes just replacing and redploying the client jar doesn't work. I have to recompile my calling application with the new client jar.
    Regards
    Ashish

    ejp wrote:
    What's that test for? That method only returns null if you write a null. Are you doing that? or are you expecting a null at EOS? You won't get that, you will get an EOFException.The tutorial that I read from said that if the server closes before the client that the client will read a null before it can close. So it throws a EOFException instead of a null at the EOS? How should I modify it then so that it checks for end of file yet still reads the input?
    ejp wrote:
    That should work unless there is something else you haven't shown us. Only other things that I can think of is that both the server and the client are on thier own threads because it is a multi-client server, that is not my actual code from my program (I just removed the parts that won't effect whats going on and are fluff), and that this would be the second time that I am sending that Object to the client. Once when my program starts and then the next in the code example I gave you. But thats pretty much it. I pass other Objects fine between the server and clients, I am just having trouble with this guy. Also, this Object implements Serializable and all Objects contained within it also do as well.
    Edited by: ShadowAssassain on Jul 24, 2008 7:43 AM

  • Dynamic Proxies vs. Generated Code

    I've seen reference a couple times here about stub serialization issues in
    WebLogic implementations that use dynamic proxies for the stubs. It sounds
    like recent WebLogic versions have switched back to generated code. Is this
    the case?
    If so, I thought dynamic proxies were Serializable. So long as your
    InvocationHandler is serializable, isn't this the case?
    Thanks,
    Bob

    "Bob Lee" <[email protected]> writes:
    I've seen reference a couple times here about stub serialization issues in
    WebLogic implementations that use dynamic proxies for the stubs. It sounds
    like recent WebLogic versions have switched back to generated code. Is this
    the case?WLS 7.0 now uses generated code, but it is bytecode generated by the
    server or client on the fly (not as a result of rmic).
    If so, I thought dynamic proxies were Serializable. So long as your
    InvocationHandler is serializable, isn't this the case?Not necessarily and indeed in order to preserve wire compatibility we
    can't. Note that we switched back to generated code for performance
    reasons. Generated code is faster than dynamic proxies.
    andy

  • Dynamic proxies and RMI

    Hi -
    We are having a problem with JDK 1.3.1. We are trying to use dynamic proxies on an object that is bound to an RMI registry.
    We find that the proxy works when the object is called from within the same JVM.
    When RMI method invocations come in from outside the JVM, the dynamic proxy does not get called.
    This seems like a bug. Is it? Is it going to be fixed?
    I suppose a way around it for now is to have the RMI implementation simply delegate to another object that has a dynamic proxy attached to it, but that seems ugly.
    Thanks
    Peter Mularien
    Deploy Solutions, Inc.

    The problem is, that the java runtime environment currently does not supply stubs for dynamic proxy classes. As far as I know this will not be addressed in 1.4. So you cannot create remote objects as dynamic proxies for now.

  • Sending email using DirectEmail including inline images?

    I need Director to send an email with images using the
    DirectEmail Xtra. The email format is HTML. When I’ve done
    this in the past I’ve always linked the images via a URL from
    my own server. This time around the images must be embedded into
    the email. I know this can be done, MS Outlook does it with
    stationary. My research so far indicates that the images need to be
    attached (DirectEmail can do that), then the image source tags need
    to be changed to the matching attachment ID … I can easily
    parse the email body and change the tags but where do I find the
    attachment ID? Also, if I do this will Outlook still flag the email
    as containing attachments? (it shouldn’t and doesn’t
    when you send as stationary) If anyone has done this and gotten it
    to work I would love to know. It doesn’t matter if it only
    works in Outlook, the email recipients are a limited group, they
    all have Outlook.
    Here’s a sample of an image tag after it has been sent
    as stationary:
    <img width=40 height=172 id="_x0000_i1025"
    src=cid:[email protected]>

    Opps, sorry ... DirectEmail xtra converts the images to
    inline on the fly if emailMode = 1, which it has to be for HTML
    anyway ... that's just too cool.

  • How to Send Notification to Manager of the Employee using Dynamic Action..

    Hi All,
    I am sending a notification using the Dynamic Action for an Infotype.. I am able to send mail using distribution list but I have a requirement to send the notification to employee manager. I am able to determine the Line Manager ID calling the subroutine in the dynamic action. But I am not sure how to send the notification to the manager.
    If the email's are maintained in distribution list if I specify the text id in the feature M0001 and distribution list the notifications are sent. I am not sure how to pass the line manager id to get the same notification..
    I have seen the option REC1 but infotype 0001 in not having the line manager id..

    Used the Function Module RH_GET_LEADING_POSITION.
    Thanks..

Maybe you are looking for

  • Wrong apple ID comes up with App store, even though in settings it the right ID. Any ideas how to stop his ?

    My apple ID is the correct one however whn I go into app store it still comes up with my old account and I can't get the password as its a very old email account which is now deactivated. I can't find a way to change the email for the apple ID when i

  • IOS6 maps: adjusting angle in 3D doesn't work

    ... it just doesn't work 99% of the time ... I've seen it work once or twice, otherwise, draging two fingers up and down has the same effect like draging just one finger over the screen, i.e. flying over the map horizontally. Any idea? ps: iPhone 4s

  • Edit the 'New Task' iView

    Hello! I want to know if there's a way to edit the 'New Task' iView from the Universal Worklist iview (com.sap.netweaver.bc.uwl.ui.UWL). I want to put a specific USER in the field 'Assigned to' and make it fixed, where the user could not change it. I

  • Generate URL with oas,oapc and ti

    Hi all, I am trying to generate a url with oas oapc and ti and pass to javascript for navigating back to that page. When I don't give these parameters I Get the error as You are trying to access a page that is no longer active.- The referring page ma

  • Updated iPhone5s but headphones not working

    I updated the software on my iPhone5S last night and now it will only play music through standard Apole ear buds. I use Panasonic ones for running. They worked before the update and still work in my ipod but not my iPhone5S. Baffled but I'm guessing