Hi,
so far I’ve loaded the xmlsec-1.5.6.jar to C:\SoftwareAG\IntegrationServer\lib\jars and then tried to use the c14n method in a java service, however the compile of the service fails with the error
C:\SoftwareAG\IntegrationServer\packages\c14n\code\source\c14n.java:62: cannot find symbol symbol : constructor ByteArrayInputStream(java.lang.Object) location: class java.io.ByteArrayInputStream Document doc = documentBuilder.parse(new ByteArrayInputStream(node));
My java code:
import com.wm.data.*;
import com.wm.app.b2b.server.ServiceException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.xml.security.c14n.CanonicalizationException;
import org.apache.xml.security.c14n.Canonicalizer;
import org.apache.xml.security.c14n.InvalidCanonicalizerException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
public final class canonDirect_SVC
{
public static final void canonDirect(IData pipeline) throws ServiceException {
org.apache.xml.security.Init.init();
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
dfactory.setNamespaceAware(true);
dfactory.setValidating(true);
DocumentBuilder documentBuilder = null;
try {
documentBuilder = dfactory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// this is to throw away all validation warnings
documentBuilder.setErrorHandler(new org.apache.xml.security.utils.IgnoreAllErrorHandler());
String myString = "<start>Hello</start>";
ByteArrayInputStream stream = new ByteArrayInputStream(myString.getBytes());
Document doc = null;
try {
doc = documentBuilder.parse(stream);
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
…
Any idea what I could be missing here ?
#webMethods#Integration-Server-and-ESB