I'm pretty certain that to write to files on the server, you're going to need to run a server-side script.
e.g. if you want to save the users input on a WML form then use a regular wml form submission to a server script which creates the file. The language you'll need sometimes varies from web host to web host, but it'll probably be ASP (for Windows hosts) or Perl (for Unix hosts).
>can i call a java code from a wml script?
Where is the java code you want to run? An installed app on the phone? A server-side JSP page?