Byte array in argument ? There's no ObjectFactory with an @XmlElementDecl

Hello everyone,
I'm trying to upload a file through my webservice but when i set up the call to the webservice from my client using
webservices.ChansonTestService service = new webservices.ChansonTestService();
            webservices.ChansonTest port = service.getChansonTestPort();I get the following exception :
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
There's no ObjectFactory with an @XmlElementDecl for the element {http://webservices/}fichier.
        this problem is related to the following location:
                at protected javax.xml.bind.JAXBElement webservices.PutFichier.fichier
                at webservices.PutFichierThis is my webservice method :
@WebMethod(operationName = "putFichier")
    @Oneway
    public void putFichier(@WebParam(name = "fichier")
    byte[] fichier) {
        try {
       File mp3 = new File("/home/schulman/Desktop/dl01.mp3");
       FileOutputStream fo = new FileOutputStream(mp3);
       fo.write(fichier);
       catch (IOException ioe) {
           ioe.printStackTrace();
    }Do i have to set up something else to be able to use byte array as argument ? i thought it was mapped using base64 by default...
I'm using glassfish v2, and i'm open to any suggestion !!
Regards
Edited by: Schulman on Nov 15, 2007 2:38 AM

hi,
first generate the classes by using the jdk 1.6 wsimport command
wsimport -keep <directory> -s <directory> wsdl url.

Similar Messages

  • There's no ObjectFactory with an @XmlElementDecl

    I get the error message below in the server log when I try to call my web service. The Objectification in question is in the war file as part of the application but some reason it cannot find it. I don't fully understand how the Object factories are found and don't know what could be wrong.
    I am running java ee 5.0 release would updating to 5.01 help?
    ========= Error messge from log file ======================
    [#|2006-10-31T17:58:38.472-0800|WARNING|sun-appserver-pe9.0|javax.enterprise.system.stream.err|_ThreadID=12;_ThreadName=Thread-26;_RequestID=942e6742-c101-4919-b2ce-2f4eb4155ff2;|error: There's no ObjectFactory with an @XmlElementDecl for the element {http://www.w3.org/2001/04/xmlenc#}EncryptedData.
    this problem is related to the following location:
    at com.octopus_drm.profiles.base._1.KeyDataType.content (Unknown Source)
    at com.octopus_drm.profiles.base._1.KeyDataType (Unknown Source)
    at com.octopus_drm.profiles.base._1.KeyType.keyData (Unknown Source)
    at com.octopus_drm.profiles.base._1.KeyType (Unknown Source)
    at com.octopus_drm.profiles.base._1.PairedKeyType (Unknown Source)
    at com.octopus_drm.profiles.base._1.ObjectFactory.createPublicKey (Unknown Source)
    at com.octopus_drm.profiles.base._1.ObjectFactory (Unknown Source)
    at com.octopus_drm.profiles.base._1.BundleType.rootLevelObject (Unknown Source)
    at com.octopus_drm.profiles.base._1.BundleType (Unknown Source)
    at com.sony.marlin.services.license.LicenseAcquisitionRequestPayloadType.bundle (Unknown Source)
    at com.sony.marlin.services.license.LicenseAcquisitionRequestPayloadType (Unknown Source)
    |#]

    hi,
    first generate the classes by using the jdk 1.6 wsimport command
    wsimport -keep <directory> -s <directory> wsdl url.

  • How do i covert an image in J2ME into an byte array ?

    Can anyone help to show me the way to convert an image into a byte array ?
    Thanks early reply appreciated.

    Hi! I�m developing an application to be installed in two devices. My problem is that i want to send an image: I can receive it with createImage(InputStream ip), but how can i send it with OutputStream? it needs a byte array (method write), how can i convert an image into a byte array?is there any other solution? like send it as a string...
    Thanks

  • MD5 - Size Of Digested Byte Array

    Hey There.
    After MD5 digesting and then Base64Encoding a string, I would end up with a byte array such as this:
    GH70Q2Ei0cwvQNwrkvDroA==
    It changes with the input, but is always 24 characters in length. I would have thought it to be 32 characters. Any reasons???
    I'm doing the UTF-8 thing. Refer to code in previous post where I'm looking for critique of code.
    Thanks,
    Vic

    I do think about what I'm doing. I know I have to
    encode digested value to get data into db. I'm not
    aware of HEX encoding, only BASE64.If you aware of Base64 and MD5, I suppose you know the digest size produced by MD5 and the fact that Base64 increases the size of encoded data to fixed percentage (which is less then 50%).

  • Loading big files (more than 30MBs)  as byte arrays

    Hello everybody,
    I have an application in which I need to load files as byte arrays, but when I load a file with a size of 30MBs (aprox) or more I get this exception:
    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    The code I'm using to load the files is this:
                   byte[] bb = null;
                   Security.addProvider(new BouncyCastleProvider());
                   try{
                        FileInputStream fis =
                        new FileInputStream(file);
                        bb = new byte[fis.available()];
                        fis.read(bb);
                        fis.close();
                   }catch(IOException e){
                        e.printStackTrace();
         any ideas on this issue?'
    thanks,
    johnny

    You really think you need to load the whole shebang
    in one chunk of memory? And even if you get 30MB to
    fit in, what if your file is 10 times that big - what
    then? You need to redesign it so that it scales well.The reason is that I have to digitally sign the file, and the libraries I'm using (BouncyCastle) receive the file as a byte array, so I need to load the file as that to pass it to the libraries :-(
    What do you think?

  • Problem with byte array arguments in webservice method call

    I am using JWSDP 1.5 to generate client stubs for a webservice hosted on a Windows 2000 platform.
    One of the methods of the webservice contains a byte array argument. When our application calls this method passing the contents of a TIFF file as the byte array, the method is failing. I have discovered that tthe reason for the failure is that the byte array in the SOAP message has been truncated and is missing its terminating tag.
    Is this a known problem in JWSDP 1.5? Is there a fix for it? Does JWSDP 1.6 resolve this problem?
    Any assistance will be much appreciated.
    Regards,
    Leo

    I'd like to add the the webservice being invoked by the generated client stubs is rpc/encoded.

  • Is there a null value that I can put into a byte array?

    I have a byte[] that I'm trying to make smaller, at the moment, in order to do so, i'm writing it byte-by-byte to another byte[] called temp. Both are set to the same size, because I don't know exactly what the initial array will compress to.
    For example, my method will write a single byte that will tell the decompressor to carry out the next instruction 5 times (eg aaaaa = 5a), but after the instruction, I want to set the 4 a's afterwards to an empty value so that I can then iterate through temp, finding out how long to make the output byte[] by counting how many null's there are.
    Eclipse is telling me null is not possible to use, I was just wondering if there is an equivalent I can use?

    That's an idea!
    The only thing is then when I come to iterate through the byte array to write it to my output array, it throws up an error that I'm trying to compare a byte to a byte[]:
              int next = 0;
              byte[] n = new byte[0];
              for (int i = 0; i < temp.length; i++) {
                   if (temp[i] != n) {
                        output[next] = temp;
                        next++;
              return output;

  • Is there a memory limitation to byte arrays?

    Everyone,
    I have a huge(16MB) CMYK source file and I am trying to convert it to a sRGB /JPEG file and then compress it.
    When I try to read that file into a byte array it chokes and throws an OutOfMemoryException. Is there a way around this?
    thanks,
    Barat.

    The data looks something like this:
    CCCCC...MMMMM...YYYYY...KKKKK...
    CCCCC...MMMMM...YYYYY...KKKKK...
    where each letter represents one byte.
    For example, the first cyan byte has cyan information
    for 8 pixels -- each bit represents cyan or no cyan, etc.
    The point is to get this data in a viewable form on screen.
    Have tried increasing the heap to 256
    Of course the problem is in a large array that holds the output information, which is ~130M
    The original file size is 16M but this was expanded to eight times the size for the PixelInterleavedSampleModel
    where one data element (a byte in this case) represents one sample of a pixel
    There must be a better way - any suggestions?

  • Is there such a thing as a byte array

    I have an array of chars in my c code which I need to pass an array to from my Java code. I was just wondering what the equivalent is in Java is there such a thing as a byte[]

    You have declared param as an int and therefore the compiler notice that the assignment to that byte array may result in loss of some bits. To prevent the warning you need to do an explicit cast to byte:
    m_writeBuffer[0] = (byte)(param>>8);
    m_writeBuffer[1] = (byte)(param & 0x00FF);Not that you would have to do the same even if param was declared as byte because java performs all operation on bytes as int.

  • How to add 16 bit message sequential number to the byte array

    hi
    iam trying to implement socket programming over UDP. Iam writing for the server side now.I need to send an image file from server to a client via a gateway so basically ive to do hand-shaking with the gateway first and then ive to send image data in a sequence of small messages with a payload of 1 KB.The data message should also include a header of 16 bit sequential number and a bit to indicate end of file.
    Iam able to complete registration process(Iam not sure yet).I dnt know how to include sequential number and a bit to indicate end of file.
    I would like to have your valuable ideas about how to proceed further
    package udp;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class Sender  {
        protected BufferedReader in = null;
        protected FileInputStream image=null;
        protected static boolean end_of_file=true;
    /** pass arguments hostname,port,filename
    * @param args
    * @throws IOException
       public static void main(String[] args) throws IOException{
            DatagramSocket socket = new DatagramSocket(Integer.parseInt(args[1]));
            boolean more_messages = true;
              String str1=null;
                * gateway registration
                try{
                     //send string to emulator
                    String str="%%%GatewayRegistration SENDER test delay 10 drop 0 dupl 0 bandwidth 1000000";
                    byte[] buff=str.getBytes();
                    InetAddress emulator_address = InetAddress.getByName(args[0]);
                    DatagramPacket packet = new DatagramPacket(buff, buff.length,emulator_address,Integer.parseInt(args[0]));
                    socket.send(packet);
                        // figure out response
                    byte[] buf = new byte[1024];
                    DatagramPacket recpack=new DatagramPacket(buf,buf.length);
                    socket.receive(recpack);
                   // socket.setSoTimeout(10000);
                    String str2=str1.valueOf(new String(recpack.getData()));
                    if(socket.equals(null))
                         System.out.println("no acknowledgement from the emulator");
                        socket.close();
                    else if(str2=="%%%GatewayConfirmation")
                    //     String str1=null;
                         System.out.println("rec message"+str2);
                    else
                         System.out.println("not a valid message from emulator");
                         socket.close();
                catch (IOException e) {
                    e.printStackTrace();
                      end_of_file = false;
         /**create a packet with a payload of 1     KB and header of 16 bit sequential number and a bit to indicate end of file
      while(end_of_file!=false)
          String ack="y";
          String seqnum=
           File file = new File(args[2]);                               
                    InputStream is = new FileInputStream(file);                 
            socket.close();
      private byte[] byteArray(InputStream in) throws IOException {
             byte[] readBytes = new byte[1024]; // make a byte array with a length equal to the number of bytes in the stream
          try{
             in.read(readBytes);  // dump all the bytes in the stream into the array
            catch(IOException e)
                 e.printStackTrace();
            return readBytes;
      

    HI Rolf.k.
    Thank you for the small program it was helpfull.
    You got right about that proberly there  will be conflict with some spurios data, I can already detect that when writing the data to a spreadsheet file.
    I writes the data in such a way, that in each line there will be a date, a timestamp, a tab and a timestamp at the end. That means two columns.
    When i set given samplerate up, that controls the rate of the data outflow from the device, (1,56 Hz - 200 Hz),   the data file that i write to , looks unorderet.
     i get more than one timestamp and severel datavalues in every line and so on down the spreadsheet file.
    Now the question is: Could it be that the function that writes the data to the file,  can't handle the speed of the dataflow in such a way that the time stamp cant follow with the data flowspeed. so i'm trying to set the timestamp to be  with fractions of the seconds by adding the unit (<digit>) in the timestamp icon but its not working. Meaby when i take the fractions off a second within the timestamp i can get every timestamp with its right data value. Am i in deeb water or what do You mean!??
    AAttached Pics part of program and a logfile over data written to file
    regards
    Zamzam
    HFZ
    Attachments:
    DataFlowWR.JPG ‏159 KB
    Datalogfile.JPG ‏386 KB

  • Method to create Player directly from the mp3 bytes array

    I was checking JMF and didn't find any method to play a mp3 informing its byte array
    Wouldn't it be an interesting method ? Ok, URL is much easier, but I am talking about ID3 files that has sequences of mp3 chuncks in the same file... Anyone knows a way to build a Player from mp3' array of bytes ???

    sergio_abreu wrote:
    Err, Sorry but I desagree.I expected as much
    It seems you didn't understand my question well.Quite possibly
    I think the form I wrote was confusing:
    In +"Anyone knows a way to build a Player from mp3' array of bytes ???+"
    I meant: Anyone knows a way to create a Player or MediaPlayer CLASS from DYNAMIC mp3' array of bytes ???That's even less coherent, to be honest
    Have you seen the structure of an ID3 music file (album) ? It's a collection of mp3 chuncks in only one file.ID3 is simply metadata about a work. It is not "chunks of MP3"
    I have already designed a ID3 class (I called "ID3Info" ) in Java that extracts/shows (dump) all the mp3 from the ID3 file.ID3 isn't a file format. Nor can you extract an MP3 from it
    The thing I would need now is to have some methods in Manager Class from which I could choose which bytes of a generic file I want to load as an mp3 song, that's all.This makes zero sense. Like saying "I need a kettle which will turn furniture into weather"
    It would be nice if there were 2 new different methods:
    1) Player createRealizedPlayer( byte[] songBytes, String fileExtension);
    Arguments: the song byte array and the extension, ex. "mp3"And what would this method do? Where does the byte[] come from? What is in the file, that you also need in order to play the song? How is this - assuming it's possible - easier, better, than just playing the file?
    2) Player createRealizedPlayer( java.net.URL genericFileURL, int beginPosition, int endPosition, String fileExtension);
    Arguments: the URL of a file containing varios mp3 chuncks and the begin / end of the bytes to be loaded as a song and a String to describe the type of file ("mp3" for example)See above
    PS: If you find it interesting, I am willing to contribute to enrich even more the Java Media framework. If you think my ideas are not valid, I just ask someone to send me the jmf source code so that I can alter some classes for my tests only.Why do you need JMF source code? I don't think this magical upside-down-ness is going to enhance anything, to be honest

  • Receiving it as a byte array via socket

    Yes, I could know the data end as read() returning -1 and the total byte-count value is in my hand then. But, however, if the byte-count value is N, I want those bytes in a single byte array of size N. What could be the standard, quickest and smartest way of getting the byte array on a socket peer?

    hiwa wrote:
    The readFully() method takes a byte array as an argument. The size of the array can't be decided as the total data size when we begin reading. We don't know it yet then.
    My method would be:
    LOOP(read -> out to a ByteArrayOutputStream) -> call ByteArrayOutputStream.toByteArray()
    However, if there is/are more smarter ones ...What problem are you actually trying to solve here?
    Here's a possible "solution" for you.
    Use a buffer. Then read the buffer and append the contents to a larger buffer. With code like this.
    private byte[] mergeBuffers(byte[] a, byte b[]){
      byte[] newBuffer = new byte[a.length+b.length];
      System.arraycopy(a,0,newBuffer,0,a.length);
      System.arraycopy(b,0,newBuffer,a.length,b.length);
      return newBuffer;
    }so during the read loop as the buffer fills up add the results of the current buffer to your "super"-buffer or whatever you want that has all the data.
    And then when you have finished reading trim the byte array to fit.

  • From MD5-string to byte array

    Hi fellows, I'm writing a simple cracker for MD5. The hash value has to be passed at command line as argument.
    e.g.
    java Cracker 0cc175b9c0f1b6a831c399e269772661In order to decode the hash value I'm using a brute force approach: therefore I compare a series of strings with the hash value by using the method of the class MessageDigest isEqual(byte[] a, byte[] b). So I encode each string and compare the byte array I get with the byte array of the hash value.
    Here it comes the trouble I'm in:
    when I try to get a bytes array of the MD5 hash value passed as argument of the program , I do get something, but it's not something that the isEqual method of MessageDigest can use to compare. As a result any attempt during the execution of brute force fails, even though the key is one of the string being checked.
    Perhaps am I facing a format problem? Any idea?
    Sorry for my english, it's not my first language
    Thanks to whoever will help

    Almost all questions in these forums about brute force attack on MD5 (or SHA1 or SHA256 etc etc etc) are school, college or university projects and of no practical use. This is almost certainly such a project.
    Unless things have changed in the last year, there is no practical brute force attack on MD5 whereby an input can be generated from an arbitrary output even though two inputs with the same output can be fabricated. A dictionary attack is feasible if no salt is used or a known salt is used since one only has to build the dictionary for one salt value. If a different salt is used for each entry being attacked then a dictionary will be need for each salt being used. Of course if one takes the simple precaution of not using anything that is likely to be in a dictionary then the dictionary attack will likely fail.

  • How Do I Load An Animated GIF Into PictureBox Control From Byte Array?

    I'm having a problem with loading an animated GIF int a picturebox control in a C# program after it has been converted to a base64 string, then converted to a byte array, then written to binary, then converted to a base64 string again, then converted to
    a byte array, then loaded into a memory stream and finally into a picturebox control.
    Here's the step-by-step code I've written:
    1. First I open an animated GIF from a file and load it directly into a picturebox control. It animates just fine.
    2. Next I convert the image in the picturebox control (pbTitlePageImage) to a base64 string as shown in the code below:
                    if (pbTitlePageImage.Image != null)
                        string Image2BConverted;
                        using (Bitmap bm = new Bitmap(pbTitlePageImage.Image))
                            using (MemoryStream ms = new MemoryStream())
                                bm.Save(ms, ImageFormat.Jpeg);
                                Image2BConverted = Convert.ToBase64String(ms.ToArray());
                                GameInfo.TitlePageImage = Image2BConverted;
                                ms.Close();
                                GameInfo.TitlePageImagePresent = true;
                                ProjectNeedsSaving = true;
    3. Then I write the base64 string to a binary file using FileStream and BinaryWriter.
    4. Next I get the image from the binary file using FileStream and BinaryReader and assign it to a string variable. It is now a base64 string again.
    5. Next I load the base64 string into a byte array, then I load it into StreamReader and finally into the picturebox control (pbGameImages) as shown in the code below:
    byte[] TitlePageImageBuffer = Convert.FromBase64String(GameInfo.TitlePageImage);
                            MemoryStream memTitlePageImageStream = new MemoryStream(TitlePageImageBuffer, 0, TitlePageImageBuffer.Length);
                            memTitlePageImageStream.Write(TitlePageImageBuffer, 0, TitlePageImageBuffer.Length);
                            memTitlePageImageStream.Position = 0;
                            pbGameImages.Image = Image.FromStream(memTitlePageImageStream, true);
                            memTitlePageImageStream.Close();
                            memTitlePageImageStream = null;
                            TitlePageImageBuffer = null;
    This step-by-step will work with all image file types except animated GIFs (standard GIFs work fine). It looks like it's just taking one frame from the animation and loading it into the picturebox. I need to be able to load the entire animation. Does any of
    the code above cause the animation to be lost? Any ideas?

    There is an ImageAnimator so you may not need to use byte array instead.
    ImageAnimator.Animate Method
    http://msdn.microsoft.com/en-us/library/system.drawing.imageanimator.animate(v=vs.110).aspx
    chanmm
    chanmm

  • How do I read directly from file into byte array

    I am reading an image from a file into a BuffertedImage then writing it out again into an array of bytes which I store and use later on in the program. Currently Im doing this in two stages is there a way to do it it one go to speed things up.
    try
                //Read File Contents into a Buffered Image
                /** BUG 4705399: There was a problem with some jpegs taking ages to load turns out to be
                 * (at least partially) a problem with non-standard colour models, which is why we set the
                 * destination colour model. The side effect should be standard colour model in subsequent reading.
                BufferedImage bi = null;
                ImageReader ir = null;
                ImageInputStream stream =  ImageIO.createImageInputStream(new File(path));
                final Iterator i = ImageIO.getImageReaders(stream);
                if (i.hasNext())
                    ir = (ImageReader) i.next();
                    ir.setInput(stream);
                    ImageReadParam param = ir.getDefaultReadParam();
                    ImageTypeSpecifier typeToUse = null;
                    for (Iterator i2 = ir.getImageTypes(0); i2.hasNext();)
                        ImageTypeSpecifier type = (ImageTypeSpecifier) i2.next();
                        if (type.getColorModel().getColorSpace().isCS_sRGB())
                            typeToUse = type;
                    if (typeToUse != null)
                        param.setDestinationType(typeToUse);
                    bi = ir.read(0, param);
                    //ir.dispose(); seem to reference this in write
                    //stream.close();
                //Write Buffered Image to Byte ArrayOutput Stream
                if (bi != null)
                    //Convert to byte array
                    final ByteArrayOutputStream output = new ByteArrayOutputStream();
                    //Try and find corresponding writer for reader but if not possible
                    //we use JPG (which is always installed) instead.
                    final ImageWriter iw = ImageIO.getImageWriter(ir);
                    if (iw != null)
                        if (ImageIO.write(bi, ir.getFormatName(), new DataOutputStream(output)) == false)
                            MainWindow.logger.warning("Unable to Write Image");
                    else
                        if (ImageIO.write(bi, "JPG", new DataOutputStream(output)) == false)
                            MainWindow.logger.warning("Warning Unable to Write Image as JPEG");
                    //Add to image list
                    final byte[] imageData = output.toByteArray();
                    Images.addImage(imageData);
                  

    If you don't need to manipulate the image in any way I would suggest you just read the image file directly into a byte array (without ImageReader) and then create the BufferedImage from that byte array.

Maybe you are looking for

  • My DVD drive is not working properly

    Hi all, Hope you can help, I have been trying to play previously working DVDs on my iBook this evening, and it will not work. I have put in a music CD and it worked fine. I repaired my permissions, ran macjanitor and restarted the machine (also left

  • Widgets in Ibooks

    Is there a way to get my edge widget to play automatically in ibook author?  Right now, the user has to tap on the widget.

  • Can't insert schema-based xmltype into binary xmltype table

    I'm having issues trying to use binary storage along with the ALLOW ANYSCHEMA clause. I can't use the XMLSchema-instance mechanism for creating my schema-based XMLType instances, so I'm using CreateSchemaBasedXml. When I try to insert the XMLType int

  • Infotype 0210 - W4 Withholding

    We have a situation, where were using the payroll period start date for changes on infotype 210 and noticed on the second pay period, that it actually retro to the first pay. For example our second payroll  date was Jan 22, 2010, period start date wa

  • Negative IR booked against GR twice

    Hello, During the MIRO process xxxx  has selected receipt lines that have already been vouched and processed another invoice against them.  We now have negative IR''s which the system booked against our GR account twice. This is creating an incorrect