Thursday, October 29, 2009

Embed document in html

embed a HTML document
<object data="data/test.html" type="text/html" width="300" height="200">
alt : <a href="data/test.html">test.html</a>
</object>

embed a pdf document
<object data="data/test.pdf" type="application/pdf" width="300" height="200">
alt : <a href="data/test.pdf">test.pdf</a>
</object>

embed a wav document
<object type="audio/x-wav" data="data/test.wav" width="200" height="20">
<param name="src" value="data/test.wav">
<param name="autoplay" value="false">
<param name="autoStart" value="0">
alt : <a href="data/test.wav">test.wav</a>
</object>

Tuesday, October 20, 2009

Clear clipboad using java script

Call this java script method to clear your clipboard in IE6. Sorry, it doesn't work in Mozilla and other browsers.

function clsClipsBrd(){
clipboardData.clearData();
}

Thursday, October 15, 2009

Create web service clients in java

There is a tool to create web service clients called as "cxf". This is a free tool. You must have the wsdl file to create java clients.

Download URL :- http://cxf.apache.org/download.html
User guide :- http://ws.apache.org/axis/java/user-guide.html
Reference :- http://cxf.apache.org/docs/wsdl-to-java.html

  • Extract cxf zip file and change directory to /din in your terminal
  • use the follwing command to create java clients
wsdl2java HelloWorld.wsdl

Namespace error in JAX-WS

Here is the error, i got when i am going to creat my web service client.

oracle.jdeveloper.webservices.model.WebServiceException: Error creating model from wsdl "http://127.0.0.1/Service.asmx?wsdl": undefined element declaration 's:schema'

I tried many ways to create my client using jdeveloper, but failed.

After that, i used axis web service for client implementation. It works fine in eclipse.

Create XML file in java

This is a simple example of creating standard XML file in java.

DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.newDocument();
Element rootElement = document.createElement("root");

This code segment creates a root element of the XML file.

Now, use this code to create child nodes to XML document.

Element em = document.createElement("element");
em.appendChild(document.createTextNode("data"));
rootElement.appendChild(em);