Oracle Composite – leftover oramds imports

On designtime we use the oramds to develop our processflows in our bpel processes.

Basically the composite.xml part for a bpel process would look like this :

<component name="saveEmployee" version="1.0">
    <implementation.bpel src="BPEL/saveEmployee.bpel"/>
    <componentType>
      <service name="client_ep" ui:wsdlLocation="oramds:/apps/xsd/myapp/1.0/saveEmployee.wsdl">
        <interface.wsdl interface="http://mynamespace.nl/saveEmployee#wsdl.interface(bewaarB2bEmployeeServicePort)"/>
      </service>   

When you open the bpel in jdeveloper, jdeveloper will automatically add the next import to your .bpel file :

  <import namespace="http://mynamespace.nl/saveEmployee"
          location="oramds:/apps/xsd/myapp/1.0/saveEmployee.wsdl"
          importType="http://schemas.xmlsoap.org/wsdl/" ui:processWSDL="true"/> 

The value from the ui:wsdlLocation-attribute is copied to the import/@location.
The ui:* attribute would suggest it’s only used for ui-related things (like the development in jdeveloper).

When we manually remove the whole import-element from the .bpel file and try a redeployment it will just deploy the composite. On runtime the service will also complete in a valid way so the import in the .bpel file is only used on designtime and not on runtime.

To have one central place for publishing artifacts and make them available for other interested parties (in our case other internal applications), we expose them by using a simple apache http server.

So in this case the uri “oramds:/apps/xsd/myapp/1.0/saveEmployee.wsdl” would also be retrievable at “htp://myapacheserver.nl/xsd/myapp/1.0/saveEmployee.wsdl”.

Since we only use the mds on designtime and use the apache location at runtime in the whole otap we need a simple cfgplan to change the locations in the artifacts.
When we generate a sample cfgplan (rightmouseclick on the composite.xml > Generate config plan), we will notice the .bpel file artifacts won’t get customized
The wsdlAndSchema section lists all the wsdls, schemas and jca files but no bpel files.

<?xml version="1.0" encoding="UTF-8"?>
<SOAConfigPlan xmlns:jca="http://platform.integration.oracle/blocks/adapter/fw/metadata" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:orawsp="http://schemas.oracle.com/ws/2006/01/policy" xmlns:edl="http://schemas.oracle.com/events/edl" xmlns="http://schemas.oracle.com/soa/configplan">
	<composite name="*">
		<import>
			<searchReplace>
				<search>oramds:/apps/xsd</search>
				<replace>htp://myapacheserver.nl/xsd</replace>
			</searchReplace>
		</import>
	</composite>
	<wsdlAndSchema name="*">
		<searchReplace>
			<search>oramds:/apps/xsd</search>
			<replace>htp://myapacheserver.nl/xsd</replace>
		</searchReplace>
	</wsdlAndSchema>
</SOAConfigPlan>

When we look in the logfiles we see some errors coming by.

info.log:[2016-02-25T16:58:01.928+01:00] [xxx-MS1] [WARNING] [] [oracle.fabric.common.wsdl] [tid: 127] [userId: weblogic] [ecid: 40869563-6b99-4a25-81a5-ed030a64e4df-00000001,0:2] [APP: soa-infra] Initial loading of WSDL at oramds://apps/xsd/myapp/1.0/saveEmployee.wsdl failed due to: Error in getting XML input stream: oramds:/apps/xsd/myapp/1.0/saveEmployee.wsdl: oracle.mds.exception.MDSException: MDS-00054: The file to be loaded /apps/xsd/myapp/1.0/saveEmployee.wsdl does not exist.. Will retry the load using the metadata manager associated with the composite..

So although the bpel itself just works it does try to resolve the oramds imports in the .bpel file (since those aren’t customized and still use oramds imports instead of http imports).

To remove the import from the bpel we use the the maven-antrun-plugin and the xmltask in ant to edit the .bpel file at the prepare-package phase.

    <build>
		<plugins>
            <plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>1.7</version>
                <dependencies> 
                    <dependency> 
                        <groupId>com.oopsconsultancy</groupId> 
                        <artifactId>xmltask</artifactId> 
                        <version>1.16</version>                     
                    </dependency> 
                    <dependency>
                        <groupId>xalan</groupId>
                        <artifactId>xalan</artifactId>
                        <version>2.7.1</version>
                    </dependency>                    
                </dependencies>
				<executions>                    
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                         <tasks> 
                           <echo message="Cleaning up bpel artifacts (removing wsdl imports)" />
                            <taskdef name="xmltask"
                                     classname="com.oopsconsultancy.xmltask.ant.XmlTask"
                                     classpathref="maven.plugin.classpath"/>
                            <xmltask todir=".">
                              <fileset dir="." includes="SOA/BPEL/*.bpel"/>
                              <remove path="//*//*[local-name()='import'][@importType='http://schemas.xmlsoap.org/wsdl/']" />
                           </xmltask>
                           </tasks>           
                         </configuration>
                    </execution>    
				</executions>                
			</plugin>    
		</plugins>
	</build>

We added the plugin to a parent pom so it will be active for all composite projects.
Since we also use some embedded java in the processes the xpath match should be on “//*[local-name()=’import’][@importType=’http://schemas.xmlsoap.org/wsdl/’]”.
Imports like

<import importType="http://schemas.oracle.com/bpel/extension/java" location="java.lang.String"></import>

won’t be removed.

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

Comments are closed.