Using Java Service to call Canonicalizer

I created a consumer service which will call a service developed in .Net. As part of the process I need to canonilize my XML request. I was hoping I could create a Java service which will do this, but I am not seeing the library. Has anyone already done this, can I use maven at all to import the proper library, or do you know where to best capture the binary jar files.

~\IntegrationServer\instances\default\packages\FibCoaServices\code\source\sbaloan100k\ error: package does not exist


~\IntegrationServer\instances\default\packages\FibCoaServices\code\source\sbaloan100k\ error: cannot find symbol

				Canonicalizer canon = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);

The classes you want to use must be in the Integration server classpath , there are multiple ways to do this, please take a look at Adding Classes to the Server Classpath ( for the exact steps and options.


Thank you for the response. I understand how to add it to the classpath, but what I am asking is has anyone already implemented a Java Service which incorporates Canonicalizer? What libraries are available in webMethods? Also, is this achievable in the flow services using the pub services? So far I have not seen anything and am left to assume I need to write this externally and create a jar file myself.

I understand ,I do not see a direct way of doing this using built-in services, but I would suggest you to refer the built in services for the pub.xml folder , to see if you could use those a combination of those services , would wait for more accurate answers from someone who has done this.

Basically I am trying to run the following through a canonicalizer if possible via flow service but if necessary a java service.

<fiAPI xmlns="" xmlns:xsd="" xmlns:xsi="">
  <fiHeader Version="2.2">
    <Service Name="?" Version="9.0">
            <CipherData xmlns="">
      <TrustRelationship xmlns="">Application</TrustRelationship>
  <Request Echo="false" TypeOfRequest="Login" Version="1.1"></Request>

Resolved my issue

Can you post how you resolved it for the benefit of others? I’m sure many others would have faced this.


1 Like

What I did to resolve the problem was create my own function in java to canonicalize, converted it to a jar file, and installed it on the integration server and added it to the build path in Designer. A little disappointed I couldn’t get it to work in Java Service.

Figured out the issue with using Canonicalize() in my Java Service. I had to drop back to xmlsec-2.0.jar. Not sure why there was a parm conflict but this resolved the issue.

This seems to work:

		// pipeline
		IDataCursor pipelineCursor = pipeline.getCursor();
		String	inputXML = IDataUtil.getString( pipelineCursor, "inputXML" );
		byte[] bytes = inputXML.getBytes();
		ByteArrayOutputStream os = new ByteArrayOutputStream(); 
		Canonicalizer canon = null;
		try {
			canon = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
		} catch (InvalidCanonicalizerException e) {
			// TODO Auto-generated catch block
		byte [] canByte = null;
		try {
			canByte = canon.canonicalize(bytes);
		} catch (CanonicalizationException e) {
			// TODO Auto-generated catch block
		} catch (ParserConfigurationException e) {
			// TODO Auto-generated catch block
		} catch (IOException e) {
			// TODO Auto-generated catch block
		} catch (SAXException e) {
			// TODO Auto-generated catch block
		String newValue = null;
		try {
			newValue = new String (canByte, "Windows-1252");
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
		String outputXML = newValue.replaceAll("(?:>)(\\s*)<", "><");
		// pipeline
		IDataCursor pipelineCursor_1 = pipeline.getCursor();
		IDataUtil.put( pipelineCursor_1, "outputXML", outputXML );
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.