shiva kumar

Greenhorn
+ Follow
since Aug 22, 2006
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 shiva kumar

I am getting the below error when deploying a service in AxisServer.

Could some please help me understand the reason for the error and how this should be fixed ??
The wsdd file is not changed. (Earlier this worked fine. I was able to deploy the service successfully)



Aug 9, 2011 8:37:31 PM org.apache.axis.InternalException <init>
SEVERE: Exception:
org.apache.axis.ConfigurationException: org.xml.sax.SAXException: Fatal Error: URI=null Line=-1: Premature end of file.
org.xml.sax.SAXException: Fatal Error: URI=null Line=-1: Premature end of file.
at org.apache.axis.utils.XMLUtils$ParserErrorHandler.fatalError(XMLUtils.java:723)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:218)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:230)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:250)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:369)
at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:388)
at org.apache.axis.configuration.FileProvider.configureEngine(FileProvider.java:179)
at org.apache.axis.AxisEngine.init(AxisEngine.java:172)
at org.apache.axis.AxisEngine.<init>(AxisEngine.java:156)
at org.apache.axis.server.AxisServer.<init>(AxisServer.java:88)
at org.apache.axis.transport.http.SimpleAxisServer.getAxisServer(SimpleAxisServer.java:210)
at org.apache.axis.transport.http.SimpleAxisWorker.execute(SimpleAxisWorker.java:167)
at org.apache.axis.transport.http.SimpleAxisWorker.run(SimpleAxisWorker.java:155)
at java.lang.Thread.run(Thread.java:595)


Thanks,
Abc
10 years ago
Guys I am also getting the similar error. SubsIn is actually a parameter (a java class)
But I get the error {http://xml.apache.org/axis/}stackTrace:No such operation 'SubsIn'.

I could see many post with "RPCProvider.getOperationDesc(RPCProvider.java:312)" this issue.
But no answers given. Could some please let know how this could be fixed ?

Thanks

{http://xml.apache.org/axis/}stackTrace:No such operation 'SubsIn'
at org.apache.axis.providers.java.RPCProvider.getOperationDesc(RPCProvider.java:312)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:88)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.SimpleAxisWorker.execute(SimpleAxisWorker.java:428)
at org.apache.axis.transport.http.SimpleAxisWorker.run(SimpleAxisWorker.java:155)
at java.lang.Thread.run(Thread.java:595)
10 years ago
Hi lajos,
You should go for the first one (the attribute version).

Reason: name and password are attributes of a user.

Only if you are not able to represent in the first method you can go for the second method.

You can go for CDATA under following situations.

<Building name="Build1">
<Floor name="Floor1">
<Cabin name="c1"/>
<Cabin name="c2"/>
</Floor>
</Building>

or

<Building name="Build1">
<Floor name="Floor1"/>
<Floor name="Floor2"/>
</Building>

Regards,
Shiva
I have a requirement where i have to put a complete xml file content into a attribute of another xml tag.

i.e

<BookConfig attribute1="should contain data of another xml file"/>

For example the following xml should be in the content of the detail attribute of BookConfig tag...
<books>
<book name="b1"> <price> 50 </price> </book>
<book name="b2"> <price> 20 </price> </book>
</books>

Please help and let me know how this can be done...
Waiting for Reply
Thanks in Advance.
Can any one give me a code sample to encrypt & decrypt an xml file

I tried this code. It works fine. But not supposed to use sun packages.
The URL http://java.sun.com/products/jdk/faq/faq-sun-packages.html says that its risky to use sun packages.


So can anyone help in doing encryption in other way.
Awaiting reply
Thanks in advance.


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.ObjectInputStream;
import java.security.Key;

import javax.crypto.Cipher;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

public class EncryptDecrypt
{
private String characterEncoding;
private Cipher encryptCipher;
private Cipher decryptCipher;
private BASE64Encoder base64Encoder = new BASE64Encoder();
private BASE64Decoder base64Decoder = new BASE64Decoder();

private static Key getKey() throws Exception {
Key key = null;
ObjectInputStream in=null;
try {
in = new ObjectInputStream(new FileInputStream("d:\\key1"));
key = (Key)in.readObject();
} catch (FileNotFoundException e) {
throw new Exception("File not found"+ e.getMessage());
}finally {
if(in != null) {
try { in.close(); }catch(Exception ex){ }
}
}
return key;
}

public EncryptDecrypt(String characterEncoding) throws Exception{
Key key = getKey();
this.characterEncoding = characterEncoding;
this.encryptCipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
this.encryptCipher.init(javax.crypto.Cipher.ENCRYPT_MODE, key);
this.decryptCipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
this.decryptCipher.init(javax.crypto.Cipher.DECRYPT_MODE, key);
}

synchronized public String encrypt(String text) throws Exception{
byte[] textBytes = text.getBytes(characterEncoding);
byte[] encryptedTextBytes = this.encryptCipher.doFinal(textBytes);
String encodedEncryptedText = this.base64Encoder.encode(encryptedTextBytes);
return encodedEncryptedText;
}

synchronized public String decrypt(String encodedEncryptedText) throws Exception{
byte[] encryptedTextBytes = this.base64Decoder.decodeBuffer(encodedEncryptedText);
byte[] textBytes = this.decryptCipher.doFinal(encryptedTextBytes);
String recoveredText = new String(textBytes, characterEncoding);
return recoveredText;
}

public static String getString(FileReader fr) throws Exception{
StringBuffer text = new StringBuffer();
String lineSep = System.getProperty("line.separator");
String nextLine="";
BufferedReader in = new BufferedReader(fr);
try{
while ((nextLine = in.readLine()) != null){
text.append(nextLine);
text.append(lineSep);
}
return text.toString();
} catch (Exception e) {
System.out.println("Error Occured in getString method:");
e.printStackTrace();
}finally{
in.close();
}
return null;
}

public static void main(String[] args){
try{

EncryptDecrypt encryptAgent = new EncryptDecrypt("ASCII");
String stxt = EncryptDecrypt.getString(new FileReader("d:\\enc\\one.xml"));
String encodedEncryptedText = encryptAgent.encrypt(stxt);
FileWriter fw = new FileWriter("d:\\enc\\one.xml");
fw.write(encodedEncryptedText);
fw.close();
System.out.println("done encryption");

String encryptedText = EncryptDecrypt.getString(new FileReader("d:\\enc\\two.xml"));
String recoveredText = encryptAgent.decrypt(encryptedText);
System.out.println("\n\nRecovered Text ..........[" + recoveredText + "]");
FileWriter fw1 = new FileWriter("d:\\enc\\three.xml");
fw1.write(recoveredText);
fw1.close();
System.out.println("done decryption");
}
catch (Exception e){
System.out.println("Error Occured:");
e.printStackTrace(System.out);
}
}
}
[ August 23, 2006: Message edited by: shiva kumar ]
15 years ago
Can any one give me a code sample to encrypt & decrypt an xml file

I tried this code. It works fine. But not supposed to use sun packages.
The URL http://java.sun.com/products/jdk/faq/faq-sun-packages.html says that its risky to use sun packages.

So can anyone help in doing encryption in other way.
Thanks in advance.
15 years ago
I want to encrypt & decrypt an XML file. The following is the code I tried.

I have used a file one.xml
It is encrypted & two.xml is created
two.xml is decrypted & creates three.xml which should be like one.xml
But Iam getting many junk characters in three.xml and also many Alphabets are replaced by junk characters.

The content of the file one.xml file was:

Sometimes Iam also getting the following error
javax.crypto.BadPaddingException: Given final block not properly padded
Exception in thread "main" java.lang.NullPointerException
at java.lang.String.<init>(Unknown Source)
at Enc.doCipher(Enc.java:121)
at Enc.decrypt(Enc.java:91)
at Enc.main(Enc.java:68)

Waiting for reply. Please reply ASAP.
Thanks in Advance.


Code:


[Edited to include code tags - Paul Sturrock]
[ August 22, 2006: Message edited by: Paul Sturrock ]
15 years ago