title: ObjectFactory factory = new ObjectFactory();
body: <p>I need to pass a data contract to my wcf webservice from java client. The data contract has 2 filed both are string. After creating the proxies the code I am trying is below</p>
  
  <pre><code>FileTransfer fs = new FileTransfer(); // 1 -- This is my service
  IFileTransfer ifs = fs.getBasicHttpBindingIFileTransfer();//2
  ServiceMessage request = new ServiceMessage();//3
  ObjectFactory factory = new ObjectFactory();//4
  JAXBElement&lt;String&gt; createString2 = factory.createString("myimg.txt");//5
  request.setFileName(createString2);//6
  System.out.println(createString2.toString()); //7
  </code></pre>
  
  <p>Here serviceMessage is the datacontract. On typing 'request.' in eclipse I see a setfilename method(filename is one of the datamembers) to add the string I want to pass. But it accepts only JAXBElement type and not string. So in line 4 and 5 I try to convert my string to   JAXBElement and pass it to the the service . But in line 7 I don't read the filename I had set in line 5. Instead line 7 prints something like javax.xml.bind.JAXBElement@24ee50b4.</p>
  
  <p>I am clueless.. Please help</p>