Skip to content

Instantly share code, notes, and snippets.

@Asitha
Last active July 8, 2021 06:44
Show Gist options
  • Save Asitha/c185878fdc0460c9d8cd to your computer and use it in GitHub Desktop.
Save Asitha/c185878fdc0460c9d8cd to your computer and use it in GitHub Desktop.
<script language="js"><![CDATA[
importPackage(Packages.org.apache.synapse.config);
mc.getConfiguration().getRegistry().newResource("conf:/wsdl/myWSDL",false);
mc.getConfiguration().getRegistry().updateResource(
"conf:/wsdl/myWSDL", mc.getProperty("MyProperty").toString());
]]></script>
@srinivaskancharla
Copy link

srinivaskancharla commented Jul 7, 2021

I am getting below error for this code, when I use this in kubernetes container
Error when adding a new resource org.apache.synapse.SynapseException: Couldn't create resource: keycloakkey-kid

<script language="js"><![CDATA[
		    	importPackage(Packages.org.apache.synapse.config);
		    	mc.getConfiguration().getRegistry().newResource("conf:/keycloak/keycloakkey-kid",false);
		    	mc.getConfiguration().getRegistry().updateResource("conf:/keycloak/keycloakkey-kid", mc.getProperty("keycloakkey-kid"));
		    	mc.getConfiguration().getRegistry().newResource("conf:/keycloak/keycloakkey-x5c",false);
		    	mc.getConfiguration().getRegistry().updateResource("conf:/keycloak/keycloakkey-x5c", mc.getProperty("keycloakkey-x5c"));
		    	mc.getConfiguration().getRegistry().newResource("conf:/keycloak/keycloakkey-timestamp",false);
		    	mc.getConfiguration().getRegistry().updateResource("conf:/keycloak/keycloakkey-timestamp", mc.getProperty("current-system-time"));
				]]>
		  	</script>

And for getting the property:

 <property expression="get-property('registry', 'conf:/keycloak/keycloakkey-kid')" name="keycloakkey-kid"/>
  <property expression="get-property('registry', 'conf:/keycloak/keycloakkey-x5c')" name="keycloakkey-x5c"/>

Could you review and comment why its failing for me.

@Asitha
Copy link
Author

Asitha commented Jul 7, 2021

What is the product you are using this with?

@srinivaskancharla
Copy link

srinivaskancharla commented Jul 7, 2021

What is the product you are using this with?

WSO2MI 4.0.0 + custom carbonApps(cars) + custom jars with Java 1.8.0_292 on Kubernetes.
This was working code piece with wso2esb 4.9.0.zip(non containerzed), we migrated to WSO2MI with container/kubernetes deployment.

Appreciate your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment