karan sarin

Greenhorn
+ Follow
since Mar 01, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by karan sarin

Hi,
BY n/w saving i mean dir have been mounted to other machine. so no extra effort is req for saving the Xml File. Its more or less a local saving of Xml for me.

Lets c wheather output stream flush and closing helps in solving the problem..
Karan Sarin
18 years ago
Hi,
Program objective is to make an Xml and save it in File System over a n/w. For that i am using the following lines of code :

public boolean xmlToFile(Document document, String pathAndNameWithExtension)
{
if(pathAndNameWithExtension == null)
pathAndNameWithExtension = "file///XMLOutput.xml";
try
{
File file = new File(pathAndNameWithExtension);
file.createNewFile();
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformar = tFactory.newTransformer();
DOMSource domSource = new DOMSource(document);
FileOutputStream fos = new FileOutputStream(file);
StreamResult result = new StreamResult(fos);
transformar.transform(domSource, result);
System.out.println("XML Document written to Path : " + file.getAbsolutePath());
return true;
}
catch(TransformerConfigurationException tce)
{
System.out.println("[ XmlHelper / xmlToFile() ] Exception : " + tce + "\n" + tce.getStackTrace());
return false;
}
catch(Exception te)
{
System.out.println("[ XmlHelper / xmlToFile() ] Exception : " + te + "\n" + te.getStackTrace());
}
return false;
}

Now the Problem is that sometimes [Randomly] some extra characters are added in an Xml and it becomes a malformed Xml. From Logs the conclusion is Xml is Prepared correctly and no exception is thrown but while saving over a network it becomes mal-formed Xml.
is It becaues of worng use of output stream in the above code.
Plz Help
regards
Karan Sarin
18 years ago
hi javaGurus
i am facing the problem in invocation of the web service in .net located on the remote machine.
i am using the WSIF api to do that. the exception i am getting is
Exception in thread "main" org.apache.wsif.WSIFException: Unable to find an available port
at org.apache.wsif.base.WSIFServiceImpl.getPort(Unknown Source)
at org.apache.wsif.base.WSIFServiceImpl.getPort(Unknown Source)
at Client.main(Client.java:30)
i am mentioning the wsdl path as: http://aravindakshan/SVWS/Service1.asmx?WSDL aravinddakshan is the machine name
the Service method is as follows:
//create a service factory
WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
WSIFService service= factory.getService(args[0],null,null,"http://tempuri.org/","SVWSSoap");

//get the port
WSIFPort port= service.getPort();
plz help as there is a deadline to meet and i am very new to the topic
KARAN
20 years ago