X

Recent Posts

SOA Development

Easy Automation of common Weblogic and FMW Administration commands via WLST Recording

The WebLogic Scripting Tool (WLST) is a command-line scripting environmentthat you can use to create, manage, and monitor WebLogic Server domains. Weblogic Serverprovides you a way to record your configuration edits in the WLS Console asWLST scripts that can then later be edited and used for configurationautomation. Note that for security reasons, it does not allow you to record allcommands. Refer to the WeblogicServer documentation for what is disallowed. Here is a simple run through of how you can use WLST recording and generate scripts for config automation.In this example, we will record the creation of a simple JDBC resource via WLSConsole and edit it post-recording. Step 1: Log intoWLS Admin Console and click on “Preferences” at the top and click on the “WLSTScript Recording” tab. This page gives you details on where the script will be generated post recording, and the name of the file. You can change it to suite your needs. Step 2: Click on “StartRecording” and then proceed to create the data source as shown in the stepslater. This is under the assumption that Automatic Recording is turned off. Inthis case, you can start and stop recording when you have finished atomicrecording tasks. Once you start recording, you can see a message indicatingthat the recording is on. Step 4:Once youhave completed the configuration, you can click on “Preferences” at the top tocome back to the Recording settings page and stop the recording. You can seethat the recording window has captured all configuration changes in Jythonformat. Step 5: Click on “Stoprecording” to generate the file at the desired location. Step 6: Next, youcan update the script to pass them as command line arguments or read them from aproperty file. See below. Step 7: WLST canbe run in a variety of ways. One way is to set the environment using wlserver_10.3/server/bin/setWLSEnv.shand then running java Weblogic.WLST scriptName.py. Refer to the WLSTdocumention for other means to execute WLST [Interactive, Embedded, Antetc].

The WebLogic Scripting Tool (WLST) is a command-line scripting environment that you can use to create, manage, and monitor WebLogic Server domains. Weblogic Serverprovides you a way to record your...

Oracle SOA Suite

When Java Meets SOA

Overview Typical composite applicationsinvolve integration amongst a variety of source and target systems, includingbut not limited to messaging systems such as AQ or MQ Series, Applications suchas e-Business Suite or Siebel, Databases, Custom applications, B2B partnersetc. Oracle SOA Suite 11g providesconnectivity to variety of such sources, and at the same time, enables users tomodel complex business processes orchestrating messages amongst these systemsin an Agile fashion. Java incarnates at several pointswithin most of these integration projects. They could manifest as existing JavaAssets that you may need to converse with – such as EJBs or POJOs, as utilitycomponents that you need to callout to process complex financial algorithms, oras assets that you yourself need to build during the integration to handle businessor system errors. It is imperative to understandthe different options in hand while designing integrations with Java or J2EEcomponents. You will be able to leverage the full potential of each option by exercisingthem where they are a good fit, while understand the pros and cons that comewith it. This weblog entry discussesthese options in greater detail. Also discussed are various options to invokeSOA Suite composites via Java. Integrating with Java or J2EE Components Here are a few options that youmay consider while integrating with Java components. 1. Java Embedding When to use: Java embeddings are extremely useful while building small utilitysnippets inline within BPELprocesses. This includes like regular expression processing, Stringmanipulation, Mathematical computations, invoking Java APIs to perform tasks onthe file system such as run windows tasks or execute batch scripts etc. ProductSupport: Java Embedding is a BPEL feature. Pros: 1) Provides inline access to Composite and component information,and also BPEL variables. 2) Can add entries to BPEL audit trails from within the embedding. 3) Façade APIs available for easy DOM Manipulation. Cons: 1) Since Java embeddings are inline java code, they are inherentlynon-reusable. If you plan to re-use the embedded functionality, java embeddingmay not be a great idea. Notes: 1) Do not use to build complexBusiness Logic 2) Limit the amount of codewithin your embedding to avoid code maintenance and management overheads. 2) If invoking transactionalendpoints, the transaction is propagated into the target endpoint. 3) Do not use Java Embedding toconverse with the target systems of your integration. This will reduce thevisibility within your Enterprise Application and is considered a poor design. 4) Exceptions can be thrown andtreated as BPEL Faults. More Information: Oracle SOA Suite Developer’sGuide http://download.oracle.com/docs/cd/E21764_01/integration.1111/e10224/bp_java.htm#BABFCJDJ 2. Custom BPEL/XSLT XPath Functions When to use: 1) Youcan wrap your Java objects into XSLT or BPEL XPath extension functions when youwish to leverage them within your data assignments, conditions, or XSL Mappings.Most of these use-cases involve Java components that perform mathematicalcomputations, String manipulation etc, just like the Java Embedding does. Product Support XSLT XPath functions can be usedwithin any XSLT within SOA Suite or OSB. Evidently, BPEL XPath functions can bereferred to only within BPEL processes. Pros 1) Stateless Utility Code can beconverted into an XSL XPath function without any additional coding. 2) Promotes code re-use. Cons: 1) Ifyou have existing java components, you may need to build wrapper objects thatimplement a specific BPEL Interface for them to be used as BPEL XPath extensionfunctions. 2) No security features are available when Javacomponents are exposed via XPath functions. Notes 1) Do not use to build complexBusiness Logic. 2) Do not invoke target systemsthat you are integrating from within your XPath functions, since you will losevisibility. This is generally a bad modeling approach. More Information: Oracle SOA Suite Developer’s Guide http://download.oracle.com/docs/cd/E21764_01/integration.1111/e10224/bp_appx_functs.htm#BEIIAHJH 3) JAX-WS or JAX-RPC Web Services exposed usingSOAP/HTTP When to use: One of the most widely useddeployments for Java components. Typically used when you need to expose javaassets as discrete Web Services, especially across firewalls - an importantuse-case for SOAP. Product Support: SOA Suite Pros: 1) The Web Service can be managedand maintained separate from the Business Process or the Integration. 2) Allows for clean contractbased conversations since the Service is based of the WSDL. 3) Can be registered in aRegistry/Repository 4) Can be virtualized using aService Bus. 5) Can be re-implemented in anyplatform or programming language without impacting the calling services. 6) Can be secured, monitored andtuned from the infrastructure level. Cons: 1) Object2XML conversions andSOAP add additional overhead. 2) Not a great choice if you needtransactionality 3) Needs personnel who understandJAX-WS stack to build, develop and maintain the services. 4) Requires client applications thatcan communicate via HTTP. Notes: 1) JAX-WS allows for Asyncconversations too. 4. EJB Services When to use: 1) When you wish tocommunicate with EJBs via a) SDO parameters [WSDL Based], or b) Java Interfaces[no WSDL]. Product Support: SOA Suite Pros: 1) Native Java/RMI calls avoidadditional overhead introduced by SOAP. 2) When EJB Service w/JavaInterface is called from Spring components, avoids O2X conversion costs Notes: 1) Users may need to be well versedwith ORM and persistence technologies. More Information: Oracle SOA Suite Developer’sGuide http://download.oracle.com/docs/cd/E21764_01/integration.1111/e10224/sca_sdo_ejb.htm#BAJBCFGE 5. SpringComponent When to use: 1) When you want to expose your Java Componentsas First Class Citizens in your SOA - allowing it to converse and exchangemessages with other Service components and SCA References. Thus useful when your Service component needsto perform Java Processing as well as need to invoke a Mediator, BPEL, EJB oranother Web Service. 2) Useful if you have existingassets such as Spring/Hibernate Applications that you want to bring into yourSOA. 3) Useful while migrating fromJCAPS to SOA Suite to wrap JCDs into Spring Beans. 4) Also useful while migratingfrom WLI to SOA Suite for Custom Controls. 5) Do not use as a replacementfor other built-in components such as BPEL, Mediator or Adapter Services. Product Support: SOA Suite Pros: 1) Re-use of existing Assets 2) Enables use of Aspect orientedprogramming declaratively within your POJOs. 3) Enables Auditing of yourSpring components via EM [Feature not available yet] 4) Can be secured via OWSMpolicies. 5) Being a native servicecomponent, easily integrates with other SCA Service and bindingcomponents." Notes: 1) Can be exposed as a SOAP/HTTPWeb Service, or as an EJB. 2) The Java classes are packagedwithin the Composite archive itself." More Information: Oracle SOA Suite Developer’sGuide http://download.oracle.com/docs/cd/E21764_01/integration.1111/e10224/sca_spring.htm#BCGCJGDF 6. JavaCallouts When to use: 1) Usefulto implement Prologue and Epilogue style invocations to java code before andafter execution of routing rules in mediator. 2) Usefulto cleanse input/output XML payloads, or perform context specific logging. Product Support This is a Mediator feature. Pros: 1) Ifyou have existing Java Assets that manipulate XML payloads before sending outto partner applications, then you can directly re-use them within your MediatorJava Callouts, as a faster alternative to building new XSLT maps. Cons 1) NoAuditing/Visiblity into the Callouts Notes: 1) Need to implement a specificPre-defined Interface. 2) The Flow trail indicates apreRoutingRule or a postRoutingRule being invoked. More Information: Oracle SOA Suite Developer’sGuide http://download.oracle.com/docs/cd/E21764_01/integration.1111/e10224/med_createrr.htm#BGBDBHBE 7. OSBJava Callouts When to use: 1) Usefulif you need custom validation/transformation/security, or message enrichment inyour Bus pipelines. 2) Useis preferable on inbound side. 3) Usea custom transport instead of a Java Callout on the outbound side. Product Support This is an OSB feature. Notes: 1) Simple interface to invokeJava methods within a JAR resource. 2) Automatic type conversion forparameters and return value. 3) Integrated lifecyclemanagement of SOA and Java (jar) resource. 4) Users can view thePOJO/Parameters from OSB Console/Design-time. 6) Use EJBs as Java Callouttargets when you need better management while accessing XA resources. However,POJOs also allow propagation of transaction and security context. 7) POJO Must be thread-safe. More Information: OSB User Guide: http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/pojo.html 8. OSBEJB Transport When to Use:        1) Primarily to integrate with existing or new EJBassets, and provide transport mediation security, monitoring and alerting featuresetc of OSB. Product Support This is an OSB Feature. Pros:        1) Since EJB Transport provides JAX-RPC mapping, itis useful when you wish to expose EJBs as SOAP/HTTP web service, or RESTendpoints that speak XML. Cons:        1) EJB Transport is an “Outbound-only” feature. You cannot expose a Service as an EJB via thisfeature. 9. OSB JEJB Transport When to use:        1) Very useful for native java integration. Typicaluse-case would be when your client and service are both Java Applications. Product Support This is an OSB feature. Pros:        1) Fully embraces XA and security semantics        2) Supports inbound and outbound interactions, asopposed to the EJB transport, that supports only inbound. Cons:       1) Does not support Java2XML conversions. Notes:       1) Both EJB 3.0 and 2.1 supported. 10. JMS Transport When to use:       1) Use-cases are similar to the OSB JEJB Transport –native java integration. You could typically receive java objects onto the bus froma JMS Topic [JMS MessageType = ObjectMessage] transport and then invoke a JavaCallout that can directly process these objects sans any conversations. Alternatively,you could drop an JMS Object Message onto a JMS Topic using this feature. Product Support This is an OSB feature Invoking SOA Suite from Java Components 1) LocatorAPI For you to use the Locator API,ensure that you have an ADF binding (binding.adf) on your Service Interface. TheLocator API is very similar to what you have seen in SOA Suite 10g. Hashtableprops = new Hashtable(); props.put(Context.PROVIDER_URL,"t3://adc4100101a:7001/soa-infra"); props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); props.put(Context.SECURITY_PRINCIPAL,"weblogic"); props.put(Context.SECURITY_CREDENTIALS,"weblogic1"); Locatorlocator = LocatorFactory.createLocator(props); Composite composite=  locator.lookupComposite("default/SimpleApproval!1.0"); Service service = composite.getService("simpleapprovalclient"); String msg = “<input><msg>Hello World</msg></input>"; NormalizedMessage req = new NormalizedMessageImpl(); req.getPayload().put("payload", msg); NormalizedMessage responseMsg = service.request("execute", msg); Element respPL = (Element) responseMsg.getPayload().get("payload");   More Information: Oracle Fusion MiddlewareInfrastructure Management Java API Reference for Oracle SOA Suite http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e10659/toc.htm 2)  Direct Binding API Originally used for connectivitybetween SOA Suite and OSB. The API also leverages the Locator API, but hasslight differences from the former. The developer’s guide has very goodexamples illustrating how java clients can use Direct Binding API to invoke SOAComposites. See link below. More Information: Oracle SOA Suite 11g Developer’sGuide http://download.oracle.com/docs/cd/E21764_01/integration.1111/e10224/invocapi.htm#CHDBBBBC 3) JavaWeb Services Proxy You can generate a Java WebServices Proxy [JAX WS or JAX-RPC] from within JDeveloper and invoke the SOAComposite using SOAP/HTTP. Note that ifthe SOA Web Service is secured via message level security or TLS, the proxyshould be updated to provide the credentials as appropriate. Refer to JDeveloper documentationfor more information. 4) AdapterInterface Java components may interfacewith SOA composites via file system, database tables, JMS Destinations etc. TheJava client may drop a file into a directory on the file system, or enqueue messagesinto a JMS topic that is being polled by SOA composites (through Adapters) thatcould then pick up the message and continue processing. Other Meeting points for Java and SOA Suite 1. FaultHandlers You can configure to use a JavaAction within your Fault policies. These Java based Fault Handlers need to implementa specific Interface. [Separate ones for BPEL and Mediator].In both cases, youhave access to the in-scope messages/variables for query/update. See section 21.1.1.2 of SOA SuiteDeveloper’s Guide for details on Mediator Java Fault Handler. http://download.oracle.com/docs/cd/E21764_01/integration.1111/e10224/med_faulthandling.htm#BABGFBCB See section 11.4.3 of SOA SuiteDeveloper’s Guide for details of BPEL Java Fault Handler. http://download.oracle.com/docs/cd/E21764_01/integration.1111/e10224/bp_faults.htm#BABJIBJB 2. SensorActions You can configure the Publish targetof a Sensor Action to be a custom Java Class. You need to implement a specificData Publisher interface to be able to register as a sensorAction target. Seesection 17.2.5 of the SOA Suite Developer’s Guide to see how. http://download.oracle.com/docs/cd/E21764_01/integration.1111/e10224/bp_sensors.htm#BABEBIFB 3. CustomWorkflow Clients You can implement the Workflow JavaAPIs to build a custom Worklist client. See Section 30.3 of the SOA SuiteDeveloper’s Guide for more information. http://download.oracle.com/docs/cd/E21764_01/integration.1111/e10224/bp_worklistcust.htm#CIHJAHBJ

Overview Typical composite applications involve integration amongst a variety of source and target systems, including but not limited to messaging systems such as AQ or MQ Series, Applications suchas...

SOA Development

Spring Framework Samples

You can leverage Spring Framework to integrate components that use Java interfaces into SOA composite applications. Oracle SOA Suite uses the spring framework functionality provided by the WebLogic Service Component Architecture (SCA) of Oracle WebLogic Server. In this weblog entry, you can find a few Spring Component samples that you may find useful. Each of the given sample contains a README that provides step-by-step instructions for developing and testing the Composite, along with a complete JDeveloper project that you can deploy and test directly. More samples will be made available soon.Please provide feedback on what specific features you would like to see within upcoming Spring samples. 1) Hello World - A simple composite with a Hello World style Spring Component 2) Spring calling BPEL - Sample illustrating how you can call a BPEL Process from Spring. 3) Spring AOP - Sample illustrating how you can use dynamic proxies to achieve AOP with Spring. 4) Predefined Spring Beans - Sample illustrating how you can use the predefined beans within SOA Suite to process headers, access composite information, or just perform context-aware logging. 5) Global Spring Beans - Sample illustrating how you can expose a simple POJO as a global spring bean that you can access within any SOA composite.

You can leverage Spring Framework to integrate components that use Java interfaces into SOA composite applications. Oracle SOA Suite uses the spring framework functionality provided by the WebLogic...

Oracle SOA Suite

XML Schema 1.1 – What you need to know

Motivation XML Schemas, more popularly known as XSDs, provide us a way to describe structure and content of XML Documents. Managed by W3C's XML Schema WG, a part of the XML Activity Group, XML Schemas evolved out of the shortcomings of its simpler and light-weight non-XML predecessor - DTDs, as well as through discussions and conferences of various interest groups across the community. The first W3C Recommendation of the XML Schema specification was released on 2 May, 2001.  The initial edition provided the users a strong type system, enabled users to model rich and complex structural constraints and value-spaces, recognized and allowed expression of namespaces, and also defined the intended behavior of Schema aware processors. This was followed up with a Second Edition in 2004, which wasn't really a newer version, but a minor errata driven release to the First Edition. While XML Schemas matured, so did other XML based specifications like XSL, XQuery, Web Services, XPath, and several others . The XML Schema WG also ensured that these dependencies feed into the requirements for future versions of the language. The WG also provided an email distribution list that allowed developers and architects alike to exchange ideas, discuss issues and shortcomings, providing an open platform for debating the current and direction of the standard's future.  XML Schema 1.0 provided a platform that allowed architects in W3C and outside to clearly think about what is the next right step towards a "Version 2". In 2005, W3C conducted a workshop on XML Schema 1.0 user experience. This workshop brought together users, developers and vendors into an open dialogue on potential usability issues, inter-op concerns and set the stage for a future version of the specification that addresses these glitches while adding in "must-have" features that were missed in 1.0. The key takeaways from all the following discussions were features related to Extensibility, Versioning and Validation. Apart from these, there were several very specific schema semantics that were long awaiting a change since 1.0 Ed2. These led to the birth of a newer 1.1 version of the specification, which will be discussed in greater detail within this article. Current Status of the Specification The WG has released two Candidate Recommendation drafts of the following documents XML Schema 1.1 Part 1 - Structures XML Schema 1.1 Part 2 - Datatypes The WG also released a non-normative guide to versioning XML Languages using new features of XML Schema 1.1. Guide to Versioning XML Languages using new XML Schema 1.1 features There are few key early implementers of the latest version of the specification namely Apache Xerces and SAXON. Key Changes since 1.0 The changes since version 1.0 till date can be grouped into the following. Validation Rule based Validation - Love Schematron? 1.1 enables users to express cross-field validations and constraints using XPath 2.0. Extensibility and Versioning Wildcard Enhancements Weak wildcard support - XSD 1.0 uses Unique Particle Attribution rule (UPA) to avoid ambiguity associated primarily with the usage of wildcard content. UPA restricts users from defining certain complex content models. XSD 1.1 attempts to address this using Weak wildcards that disambiguate using precedence rules. Negative Wildcards and Multiple Namespaces Open Content <xsd:all> Model Group Changes  - Finally! Vendor Unique Extensions - Enables vendors to ship their own primitive datatypes and facets Conditional Inclusion - Enable creation of extensible schemas. Miscellaneous Enhancements Conditional Type Assignments Inherited Attributes Default Attribute Group - Enable globally shared set of attribute definitions. Substitution Group Enhancements - Multiple element substitution related changes. ID related changes - Enables, amonst others, mutliple ID attributes for elements. Redefine Replaced by Override - Richer overrides, more interoperability. Target Namespace attribute on local elements and attribute declarations New Datatypes and Facets One significant aspect of the standard that has been kept unchanged across revisions and editions is the Namespace URI for the schemas. What this means is that the version 1.1 schemas that you create will have the same XSD Namespace URI as a version 1.0 schema. http://www.w3.org/2001/XMLSchema In addition to this, almost all of the features in 1.0 have been brought into 1.1 in order to ensure backwards compatibility. What this means is that an XML document defined using a 1.0 schema can be validated using a 1.1 schema processor/validator.  This backward compatibility also ensures that the specification can satisfy dependant requirements from other specifications that rely on syntax and semantics of the 1.0 version of the specification. 1. Validations Rule based Validation XML Schema 1.1 introduces a new Schema component named <assert> to facilitate rule based validation, along similar lines of Schematron. User can specify an Boolean XPath expression that will result in the assertions to pass or fail, depending on the evaluation of the expression. Assertion failures are equivalent to a  non-assertion validation failure. Example 1 <xsd:element name="priceRange">   <xsd:complexType>      <xsd:sequence>          <xsd:element name="minPrice" type="xsd:decimal"/>          <xsd:element name="maxPrice" type="xsd:decimal"/>      </xsd:sequence>     <xsd:assert test="minPrice le maxPrice"/> </xsd:complexType> </xsd:element> In the above example, the assertion checks if the decimal value of minPrice element is less than or equal to the maxPrice element. If an instance document fails this assertion, that document is considered invalid w.r.t the Schema, just like a non-assertion validation failure would cause it to be. Syntax and Namespace Scope The asserts are always defined at the end of the type declaration. It can hold a valid XPath 2.0 boolean expression. Being related to XPath 2.0, users can leverage the XPath 2.0 specific functions and operators while building the assertions. The context node used for the expression evaluation is always the element whose type declaration hosts the mentioned assertion. In the above example, the context node would be the priceRange element. Hence all expressions within the assertions will need to be relative to the priceRange element. One key restriction that is imposed on the path expressions that can be modeled in an assertion is that one cannot refer to parent or ancestor nodes of the context node. Only context node, or any of its descendants can be referred to within the path expressions. Neither it's siblings nor it's ancestors are permitted. By this rule, the following assertion is invalid. <assert test="string-length(ancestor::order/id) > 0"/> so is <assert test="string-length(following-sibling::shippingDate)  > 0"/> and so is <assert test="doc('pub/docs/customers.xml')/customerInfo[2]/id='12345'"/> Users can model as many assertions as they want on the type declaration. In that case, the instance document will be considered valid only if none of the assertions for that type declaration have failed. The namespace scope of the path elements in the expression is determined by the value of the xpathDefaultNamespace attribute on the assert element. If the attribute is absent, its value is assumed to be ##local - which translates into null namespace. This attribute can also be declared to hold any URI, or alternatively configured to use the targetNamespace or the default namespace declared for the XML Schema. Example 2 <assert test="tns:price > 0" xmlns:tns="www.oracle.com" xpathDefaultNamespace="www.oracle.com"/> <assert test="price > 0" xpathDefaultNamespace="##targetNamespace"/> <assert test="price > 0" xpathDefaultNamespace="##defaultNamespace"/> <assert test="tns:price > 0" xmlns:tns="www.oracle.com" xpathDefaultNamespace="##targetNamespace"/> <assert test="price > 0" xpathDefaultNamespace="##local"/> <assert test="ns1:value > ns2:netValue" xmlns:ns1="www.oracle.com" xmlns:ns2="www.abc.com"/> The last assert is equivalent to not having the xpathDefaultNamespace attribute at all. Rule based Validation of scalar content As we described above, <assert>s can be used to define rule-based constraints on complex content. In the event that one wishes to model rules for simple content - for instance, against elements of string or decimal datatype, one can use a new facet available for atomic datatypes - named <assertion>. Original Declaration: <element name="evenPriceChangePercent" type="decimal"/> Declaration with assertion: <element name="evenPriceChangePercent" type="evenPriceChangePercentType"/> <simpleType name="priceChangePercentType">   <restriction base="decimal">        <assertion test="$value <= 100 and $value >= 0"/>        <assertion test="$value mod 2 = 0"/>   </restriction> </simpleType> As seen above, this facet provides a default "value" variable that holds the text content of the simple content used for the evaluation. You cannot access any other context nodes within the XPath expression. 2. Extensibility and Versioning Wildcard Related Enhancements Weak Wildcards Wildcards were introduced into XML Schema to build flexibility into schemas that users build. One could build newer schemas that could validate instances that were defined using an older version of the schema [Backward compatibility], or vice versa [Forward compatibility]. XMLSchema 1.0 provided schema constructs like <any/> and <anyAttribute/> for this purpose. These constructs enable elements and attributes that aren't explicitly defined in the schema, to occur in a valid XML instance document, providing way for extensible content models. For instance, Example 3 <element name="Address">   <complexType>      <sequence>           <element name="street" type="string"/>           <element name="city" type="string"/>           <element name="state" type="string"/>           <element name="zip" type="string"/>           <!--allow any element from any namespace to occur -->          <any namespace="##any" minOccurs="0"/>      </sequence>   </complexType> </element> 1.0 allowed for adding these wildcards at any position within your type declaration,as long as there isn't an ambiguity with explicitly declared elements. Look at the example below. Example 4 <element name="Address">   <complexType>      <sequence>           <element name="street" type="string"/>           <element name="city" type="string"/>           <element name="state" type="string"/>           <element name="zip" type="string" minOccurs="0"/>           <!--allow any element from any namespace to occur -->          <any namespace="##any" minOccurs="0"/>      </sequence>   </complexType> </element> With the above schema in mind, consider the following XML document. Example 5 <Address>    <street>1, Courthouse Square</street1>   <city>Hill Valley</city>   <state>CA</state>   <zip>91919</zip> </Address> With this document, it is impossible to state if zip element should be associated with the named element zip, or the wildcard any element. This schema is thus prohibited in XML Schema 1.0. The rule that prohibits this is termed as Unique Particle Attribution (UPA) Rule. With 1.1, the UPA restriction is relaxed - it is no longer forbidden to have the kind of XML Schema mentioned in Example 4. [competition between element and wildcard]. When there is such an ambiguity, the named element definition takes precedence. In this case, since there is an element named "zip" that can resolve the ambiguiity, that one is chosen over the wildcard during resolution. Also considered legal is a competition between two wildcards. However, competition between two elements is still considered a violation of the rule. For example, the following XML schema is still invalid since the processing application will not be able to disambiguate the <direction> element in the XML Instance if their respective siblings were absent. Example 6 <element name="TimeTravel">    <complexType>       <choice>       <sequence>           <element name="direction" type="string"/>            <element name="year" type="integer" minOccurs="0"/>        </sequence>       <sequence>           <element name="direction" type="string"/>            <element name="universeName" type="string" minOccurs="0"/>        </sequence>      </choice>   </complexType> </element> Multiple Namespaces and Negative Wildcards In XML Schema 1.0, you had the capability to specify the namespace URI for a wildcard element. You could either specify A list of one or more specific URIs ##other - which means any URI other than the targetNamespace ##targetNamespace - which is self explanatory ##any - which means any URI ##local - which indicates null namespace. Example 7 <any namespace="##other"/> <any namespace="http://www.delorean.com http://www.fluxcapacitor.com"/> <any namespace="##targetNamespace"/> <anyAttribute namespace="##local"/.> In XML Schema 1.1, you have more ways to control your wildcards. You could in fact state that your wildcards NOT come from a namespace UR or multiple Namespace URIs. In addition to this, you can also constrain the potential qualified name of the wildcard through the new schema constructs. Example 8 <any notQName="tns:Almanac tns:IceHockey"/> <anyAttribute notNamespace="##targetNamespace"/> <any notNamespace="##defaultNamespace"/> <any notNamespace="http://www.fluxcapacitor.org"/> Other constraints you can impose are: Ensure your wildcards do not have the same name as any of it's siblings. Ensure your wildcards do not have the same name as any of the existing global declarations in the schema. Example 9 <any notQName="##definedSibling"/> <any notQName="##defined"/> Take a look at the schema below. Example 10 <element name="Address">    <complexType>       <sequence>            <element name="street" type="string"/>            <element name="city" type="string"/>            <element name="state" type="string"/>            <element name="zip" type="string"/>             <any notQName="##definedSibling" namespace="##local"/>       </sequence>   </complexType> </element> This will fail validation for the following XML instance. <Address>    <street>1, Courthouse Square</street1>   <city>Hill Valley</city>   <state>CA</state>   <zip>91919</zip>   <zip>94321</zip> </Address> Open Content Open Content allows for defining elements to possess child element or attribute content other than the ones explicitly defined in it's content model, and allow them to be available at any position within its content. In 1.0, you needed to explicitly position your <xsd:any/> declarations within your choice or sequence content models. In 1.1, you can declare open content for your elements at one place - within the complexType definition, or at the schema level. On top of this, you can choose to distribute your open content interleaved between your named child elements [interleaved], choose to have them after all of the child elements. [suffixed], or disable inherited openContent behavior. Example 11 - Interleaved Open Content <element name="Address">   <complexType>     <openContent mode="interleave">          <any/>     </openContent>      <sequence>           <element name="street" type="string"/>           <element name="city" type="string"/>           <element name="state" type="string"/>           <element name="zip" type="string" minOccurs="0"/>      </sequence>   </complexType> </element> Valid Instances for the Schema Example 1: <Address>    <street>1, Courthouse Square</street1>    <boo/>   <city>Hill Valley</city>    <foo/>    <bar/>   <state>CA</state>    <zip>91919</zip>    <boo2/> </Address> Example 2: <Address>    <street>1, Courthouse Square</street1>    <boo/>    <foo/>    <bar/>   <city>Hill Valley</city>    <state>CA</state>     <boo2/>   <zip>91919</zip> </Address> Note that the maxOccurs="unbounded" and minOccurs="0" attributes on the <any/> is implicit - which explains how one is able to have multiple wildcard elements in your XML instance document. Example 12: Suffixed Open Content <element name="Address">   <complexType>     <openContent mode="suffix">        <any/>     </openContent>      <sequence>           <element name="street" type="string"/>           <element name="city" type="string"/>           <element name="state" type="string"/>           <element name="zip" type="string" minOccurs="0"/>      </sequence>   </complexType> </element> Valid Instance for the Schema <Address>    <street>1, Courthouse Square</street1>    <city>Hill Valley</city>    <state>CA</state>    <zip>91919</zip>    <boo/>    <foo/>    <bar/>    <boo2/> </Address> The third use-case - mode="none" is typically used when you are importing and extending a complexType from a foreign schema, but do not wish to inherit the openness of the inherited type definition. The wildcard <any/> within the <openContent> section can be combined with the wildcard constraints discussed in the earlier section as well. [e.g. <any notQName="fc:doc"/>] Another variant of of the openContent use-case is the one where user wishes to model adding wildcards within any element content defined in the schema - i.e. a schema-wide openContent. This is supported through a schema construct <defaultOpenContent> declared as a direct child of the <schema> element. See example below. Example 14 (I skipped "13") <schema targetNamespace="..." xmlns="...."> <defaultOpenContent mode="interleave" appliesToEmpty="true">    <any/> </defaultOpenContent> <element name="Order">   .... </element> <element name="Info">    <complexType/>    <attribute name="id" type="string"/> </element> <element name="BillingAddress" type="tns:BillingAddressType"/> <element name="ShippingAddress" type="tns:ShippingAddressType"/>   <complexType name="BillingAddressType">       <sequence>           <element name="street1" type="string"/>           <element name="street2" type="string"/>           <element name="city" type="string"/>           <element name="state" type="string"/>           <element name="zip" type="string" minOccurs="0"/>      </sequence>   </complexType>   <complexType name="ShippingAddressType">       <sequence>           <element name="street" type="string"/>           <element name="city" type="string"/>           <element name="state" type="string"/>           <element name="zip" type="string" minOccurs="0"/>      </sequence>   </complexType> </schema> This schema can be used to generate XML documents where arbitrary elements can occur between the contents of ShippingAddress and BillingAddress. Even the empty element Info can have open content within it attributed to the appliesToEmpty attribute on the <defaultOpenContent> declaration. Valid Instance for the above XSD: <Order>    <Info id="123">         <HelloWorld/>    </Info>   <BillingAddress>       <Welcome6>123</Welcome6>       <street1>1, Courthouse Square</street1>        <street2>Apt 007</street2>        <boo2/>        <city>Hill Valley</city>        <state>CA</state>        <zip>91919</zip>        <foo3/>  </BillingAddress>   <ShippingAddress>       <Welcome>123</Welcome>       <street>1, Courthouse Square</street>         <boo/>        <city>Hill Valley</city>        <state>CA</state>        <zip>91919</zip>        <foo/>  </ShippingAddress> </Order> <xsd:all> Group Changes The "All" Model group was bundled with several restrictions when it was introduced in XML Schema 1.0. 1. The group disallowed multiple occurence elements to be a part of the content model.   The following is illegal in XML Schema 1.0 Example 15 <complexType name="FluxCapacitorType">    <all>        <element name="timeCalibrator" type="string" maxOccurs="unbounded"/>        <element name="needsRecharge" type="boolean" minOccurs="3" maxOccurs="unbounded"/>   </all> </complexType> Elements within <all> groups were supposed to have maxOccurs=1 and a minOccurs of 0 or 1. i.e. elements occur in any order, but each element occurs exactly once, if present. 2. <all> group cannot be nested within another model group. What this means is that you cannot have an <all> nested within a <sequence> or a <choice> model group. Thus the following is illegal in 1.0. Example 16 <complexType name="FluxCapacitorType">   <choice>        <element name="autoFunction" type="AutoFunctionType"/>        <all>             <element name="timeCalibrator" type="string" maxOccurs="unbounded"/>             <element name="needsRecharge" type="boolean" minOccurs="3" maxOccurs="unbounded"/>       </all>    </choice> </complexType> 3. You cannot extend a non-empty BaseType with an <all> content model. The following is illegal in 1.0 Example 17 <complexType name="BaseTimeTravelMachineType">   <all>         <element name="timeComputer" type="string"/>         <element name="carrier" type="CarrierType"/>   </all> </complexType> <complexType name="HighSpeedTimeTravelMachineType">   <complexContent>        <extension base="BaseTimeTravelMachineType">             <all>                    <element name="TravelerProfileReader" type="ProfileReaderType"/>           </all>        </extension>    </complexContent> </complexType> 4. You cannot have wildcards within <all> groups.  The following is illegal in 1.0. Example 18 <complexType name="BaseTimeTravelMachineType">   <all>        <any/>         <element name="timeComputer" type="string"/>         <element name="carrier" type="CarrierType"/>   </all> </complexType> XML Schema 1.1 has legalized all the above models. Vendor Unique Extensions Vendors can now define their own primitive datatypes and facets. For instance, it may provide support for a new primitive datatype called string, with it's own implementation defined facets. These datatypes will be in a vendor defined namespace in order to distinguish them from XSD's predefined datatypes. The treatment of  the vendor defined datatype depends on each vendor - and evidently, it may not be supported by a processor implemented by another vendor. Example 19 <!--new custom integer datatype --> <element name="age" type="xdk:integer"/> <!--new custom 'era' facet --> <simpleType name="TimeType">      <extension base="xdk:oracleDateTime">             <xdk:era="Andromedan"/>       </extension> </simpleType> Conditional Inclusion This feature is primarily used to ensure that XML documents that may be defined down the future using a later version of XML Schema language [say 5.5] can be processed in compatibility mode by a XML Processor that supports a prior version of  XML Schema [starting from 1.1].  For instance, one of the element declarations in a user defined XML Schema may use a new construct that was introduced in XML Schema 5.5. If you need to process this XML Schema using an XML Schema 1.1 compliant processor, you have to have a feature that allows you to pre-process and selectively interpret the constructs that the 1.1 version processor understands. For this purpose, XML Schema 1.1 introduces a new set of attributes in the Schema Versioning Namespace, as listed below. The Schema Versioning Namespace has a URI - http://www.w3.org/2007/XMLSchema-versioning. Within this namespace URI are four attributes. vc:typeAvailable vc:typeUnavailable vc:facetAvailable vc:facetUnavailable vc:minVersion vc:maxVersion Look at the 2 examples below. In the first example, the user intends to define an element named TimeMachine that can be interpreted by an XML Schema Processor that complies with version 1.6, as well as one that supports version 1.1. Example 20 <!--The below declaration is accepted for pre-processing for XML Schema versions 1.1 [inclusive], but less than 1.6. [exclusive] --> <element name="TimeMachine" vc:minVersion="1.1" vc:maxVersion="1.6">    <complexType>          <sequence>            ..... </element> <!--The below declaration is accepted for pre-processing for XML Schema versions 1.6 or later. It may have constructs that are not understood by 1.1 processors. --> <element name="TimeMachine" vc:minVersion="1.6">       <complexPhasedDatatype>           <prioritizedSequence>                 ... </element> In the second example, listed below, the user intends to signal the usage of a vendor defined datatype or facet through the first 4 schema versioning attributes listed above. Example 21 <!--line 1 is for processors that implement the custom datatype, whereas line 2 is used by other processor implementations --> <element name="EmmetBrownsLabHeight" vc:typeAvailable="xdk:feet" type="xdk:feet"/> <element name="EmmetBrownsLabHeight" vc:typeUnavailable="xdk:feet" type="xsd:integer"/> <!--declaration 1 is used by processor that implements the custom minLength facet. The latter declaration is the fallback used by other processors -> <element name="ItemCode" vc:facetAvailable="xdk:minLength">     <simpleType>        <restriction base="string">               <xdk:minLength value="1,2"/>        </restriction>     </simpleType> </element> <element name="ItemCode" vc:facetUnavailable="xdk:minLength" type="string"/> 3. Miscellaneous Enhancements Conditional Type Assignments XML Schema 1.1 allows for dynamic type assignment based on XPath 2.0 boolean condition expressions. See example below. Example 22 <!--inline alternative type definitions --> <element name="TimeTravel" type="TravelType">       <alternative test="@direction='Future'">           <complexType>               <complexContent>               <restriction base="TravelType"                          .... <!--        some past travel related elements go here -->             </complexType>        </alternative>       <alternative test="@direction='Past'">           <complexType>               <complexContent>               <restriction base="TravelType"                          ....    <!--        some future travel related elements go here -->             </complexType>        </alternative>   </element>                           OR <!--Named alternative type definitions --> <element name="TimeTravel" type="TravelType">    <alternative test="@direction='Future' type="FutureTravelType"/>    <alternative test="@direction='Past' type="PastTravelType"/> </element> Few points to note here. You can only access attributes of the context node within the xpath expression. You cannot use child/descendant elements in the expression as you would have seen in the assert statements earlier in the article, nor anything on the ancestor axis. In the above example, direction is an attribute defined within  the complexType TravelType that is used to define the TimeTravel element. The alternative types should be datatypes that are derived from the actual type defined on the element. In the above example, FutureTravelType and PastTravelType are derived from TravelType. Just as you would model the namespaces in asserts, you could use the xpathDefaultNamespace attribute to qualify the xpath expression on the alternatives. Inherited Attributes Inheriting attributes allows access to attributes of ancestor elements within descendant elements. Though inheriting does not allow the attributes to actually appear on the descendant element in the XML instance, they can be effectively used within asserts and type alternatives for the descendant element. An attribute can be declared as inheritable by defining inheritable="true" on the attribute declaration, as illustrated below. Example 23 <element name="TimeTravelType">     <complexType>          <sequence>                <element name="GadgetType">                     <alternative test="@mode='Past' type="PastGadgetType"/>                     <alternative test="@mode='Future' type="FutureGadgetType"/>               </element>              <element name="dimension">                  ....                 <assert test="@length > 200 and @mode='Past'"/>                 <assert test="@length <= 200 and @mode='Future'"/>         </sequence>         <attribute name="mode" inheritable="true"/>     </complexType> </element> Note that defining an inheritable attribute does not prevent schema designer to define attributes with the same name on the descendant element datatypes. In that case, the local declaration prevails. Default Attribute Group Default attribute group defines a set of global attributes that can be accepted by all complexType definitions directly defined in the schema file. [not applicable to imported/included components] Example 24 <schema targetNamespace="...."                    defaultAttributes="myLocalAttrs"                    ....>      <element name="AllTimePieces">                ...      <element>      <element name="MyTimePiece">                    ...       <element>       <element name="HisMuchBetterTimePiece">                 ....          </element>         <attributeGroup name="myLocalAttrs">              <attribute name="tpId" type="ID"/>          </attributeGroup> </schema> <AllTimePieces tpId="NONE">          <MyTimePiece tpId="0">                         ....           </MyTimePiece>           <HisMuchBetterTimePiece tpId="1">                         ...            </HisMuchBetterTimePiece>    </AllTimePieces>  This eliminates the need for redundant reference to the attribute group within all complexType definitions that needed to share the same set of attributes. Substitution Group Enhancements SubstitutionGroups in XML Schema 1.0 allows elements to be substitutable for other elements. To be precise, it allows for replacing an element with another. XML Schema 1.1 enhances this functionality by allowing an element to be substitutable for one or more elements Example 25 <!--SubstitutionGroups in XML Schema 1.0 --> <element name="shipComment" substitutionGroup="po:Comment" type="ShipCommentType"/> <element name="billComment" substitutionGroup="po:Comment" type="BillComentType"/> <!--SubstitutionGroups in XML Schema 1.1 -> <element name="Flute" substitutionGroup="po:MusicalInstrument po:WindInstrument" type="FluteType"/> <element name="MusicalInstrument" type="po:MusicalInstrumentType"/> <element name="WindInstrument" type="po:WindInstrumentType"/> As seen in Example 25, the element Flute can be substituted for either the MusicalInstrument element, or the WindInstrument element, provided FluteType datatype is derived from MusicalInstrumentType and WindInstrumentType. ID related changes XML Schema 1.1 has revised ID semantics to allow elements to possess more than one xsd:ID attribute. XSD 1.0 had forbidden this usage for ensuring compatibility with DTDs. Schemas that intend to be compatible can choose to not use this feature.  It also allows ID attributes to have default and fixed values - again something that was forbidden in 1.0. Example 26 <element name="Fruit">    <complexType>      <sequence>           <element name="taste" type="f:TasteType"/>            ...       </sequence>      <!--Illustrating more than one ID on an element -->      <attribute name="fruitUID" type="ID"/>      <attribute name="flavourUID" type="ID"/>    <!--illustrating default value on an ID type attribute -->     <attribute name="locationCode" type="ID" default="US-CA"/> </element> Redefine Replaced by Override <redefine> construct in XML Schema 1.0 enabled users to extend or restrict element type declarations. What it did not allow was to create a new definition for the same element when redefining it. Example 27 <!--Legal redefine in XML Schema 1.0 --> <schema .....>    <redefine schemaLocation="http://www.greatschemas.org/invoice.xsd">     <complexType name="BillingAddressType"> <!--BillingAddressType is defined in the included schema above, and is being redefined -->             <extension base="gsc:BillingAddressType">                   <sequence>                         <element name="BillingCode" type="string"/>                   </sequence>             </extension>     </complexType>     <!--         Illegal redefine in XML Schema 1.0  where BillingAddressType has been defined in the included schema  above        -->       <complexType name="BillingAddressType">                   <sequence>                         <element name="TotallyDifferentBillingStuff" type="string"/>                   </sequence>             </extension>     </complexType> </redefine> Moreover, XML Schema 1.0 had many conflicting and non-interoperable implementations for <redefine> that 1.1 decided to deprecate the <redefine> functionality and replace it with a richer <override> construct instead. Example 28 <!--Legal override in XML Schema 1.1 showing extension of types--> <schema .....>    <override schemaLocation="http://www.greatschemas.org/invoice.xsd">     <complexType name="BillingAddressType"> <!--BillingAddressType is defined in the included schema above, and is being redefined -->             <extension base="gsc:BillingAddressType">                   <sequence>                         <element name="BillingCode" type="string"/>                   </sequence>             </extension>     </complexType>     <!--         Legal override in XML Schema 1.0  where BillingAddressType has been defined in the included schema  above        -->       <complexType name="BillingAddressType">                   <sequence>                         <element name="TotallyDifferentBillingStuff" type="string"/>                   </sequence>             </extension>     </complexType> </override> Note that <redefine>  has been deprecated, but not removed yet. The WG is still looking for feedback from users on this construct.  It MAY be removed from future versions of the specification. Target Namespace attribute on local elements and attribute declarations XML Schema 1.1 allows users to define targetNamespace on local element and attribute declarations. The namespace URI may be different from the targetNamespace defined on its ancestors or the schema element. Example 29 <schema targetNamespace="http://xmlns.oracle.com/definitions" ..... elementFormDefault="qualifiied">     <element name="Address">            <complexType>                <sequence>                      <element name="street1" targetNamespace="www.alternatens.com/defns"/>                        ....                </sequence>                 <attribute name="id" targetNamespace="http://xmlns.groceries.com/defns"/>              </complexType>          </element> </schema> <schema targetNamespace="http://xmlns.oracle.com/definitions" ..... elementFormDefault="qualifiied">     <import namespace="www.foreign.com/defns" schemaLocation="Alt_Objects.xsd"/>     <element name="Address">            <complexType>             <complexContent>               <extension base="ForeignAddressType">                <sequence>                      <element name="street1" targetNamespace="www.foreign.com/defns"/>                        ....                </sequence>                 <attribute name="id" targetNamespace="www.foreign.com/defns"/>              </complexType>          </element> </schema> 4. New Datatypes and Facets XML Schema 1.1 added several new core datatypes into its existing library. 1. The anyAtomicType datatype This datatype has been newly introduced as the base type for all atomic datatypes in the Schema's datatype library. [i.e. string, float,boolean etc]. It extends from anySimpleType. "In XML Schema, a simple type is either a list type, a union type, or an atomic type; however, these three kinds of simple type are not recognized explicitly in the type hierarchy. For XPath, it was necessary to distinguish atomic types from the other kinds of simple type, so xdt:anyAtomicType was invented to achieve this."                 - Michael Kay, SAXONICA 2. New Numeric Datatypes A new datatype named precisionDecimal has been added to support IEEE-754 floating-point decimal datatypes. precisionDecimals carry a numeric value, an arithmetic precision and a sign. Apart from distinguishing between positive and negative zero, this datatype also holds NaN and positive/negative infinity in it's value space. Example 30 <price>1200.04</price> <price>INF</price> <price>-INF</price> <price>NaN</price> 3. Date/time Datatypes The following new datatypes - dateTimestamp, dayTimeDuration and yearMonthDuration have been added to the library. dateTimestamp extends the existing dateTime datatype with a mandatory explicitTimezone facet. [the timezone portion was optional in the dateTime datatype.] <element name="shipDate" type="dateTimeStamp"/> <shipDate>2010-02-01T12:03:00-08:00</shipDate> <shipDate>2010-02-01T12:03:00Z</shipDate> Both new duration related datatypes extend from the existing duration datatype and does a simple restriction on its lexical space. <!--2 years and 3 months yearMonthDuration --> <sampleYearMonthDuration>P2Y3M</sampleYearMonthDuration> <!--1 day and 6 hours dayTimeDuration--> <sampleDayTimeDuration>P1D6H</sampleDayTimeDuration> 5. Next Steps Several implementations are under development. This includes the upcoming versions of Xerces, and the SAXON processor.  You can contribute to the specification by submitting your comments to the public comments mailing list for the standard - www-xml-schema-comments@w3.org. Here is the archive. 6. Credits Roger Costello's Tutorial is one of the best you can grab to get to the next level of details on the specification. He has done a fabulous job in documenting all major features to fine levels of detail. You can find a link to his tutorial in the next section. 6. References 1. XML Schema 1.1 Part 1: Structures 2. XML Schema 1.1 Part 2: Datatypes 3. Roger Costello's XML Schema Tutorial 4. XML Schema 1.1, Part 1: An introduction to XML Schema 1.1 - IBM 5. XML Schema 1.1, Part 2: An introduction to XML Schema 1.1 - IBM 6. XML Schema 1.1, Part 3: An introduction to XML Schema 1.1 - IBM

Motivation XML Schemas, more popularly known as XSDs, provide us a way to describe structure and content of XML Documents. Managed by W3C's XML Schema WG, a part of the XML Activity Group, XML...

Oracle SOA Suite

Detecting Process Shutdown/Startup Events through ActivationAgents

@10g - This post is motivated by one of my close friends and colleague - who wanted to proactively know when a BPEL process shuts down/re-activates. This typically happens when you have a BPEL Process that has an inbound polling adapter, when the adapter loses connectivity to the source system. Or whatever causes it.One valuable suggestion came in from one of my colleagues - he suggested I write my own ActivationAgent to do the job. Well, it really worked.Here is a sample ActivationAgent that you can use. There are few methods you need to override from BaseActivationAgent, and you are on your way to receiving notifications/what not, whenever the shutdown/startup events occur.In the example below, I am retrieving the emailAddress property [that is specified in your bpel.xml activationAgent section] and use that to send out an email notification on the activation agent initialization. You could choose to do different things. But bottomline is that you can use the below-mentioned API to access the very same properties that you specify in the bpel.xml. package com.adapter.custom.activation;import com.collaxa.cube.activation.BaseActivationAgent;import com.collaxa.cube.engine.ICubeContext;import com.oracle.bpel.client.BPELProcessId;import java.util.Date;import java.util.Properties;public class LifecycleManagerActivationAgent extends BaseActivationAgent { public BPELProcessId getBPELProcessId() { return super.getBPELProcessId(); } private void handleInit() throws Exception { //Write initialization code here System.err.println("Entered initialization code...."); //e.g. String emailAddress = getActivationAgentDescriptor().getPropertyValue(emailAddress); //send an email sendEmail(emailAddress); } private void handleLoad() throws Exception { //Write load code here System.err.println("Entered load code...."); } private void handleUnload() throws Exception { //Write unload code here System.err.println("Entered unload code...."); } private void handleUninit() throws Exception { //Write uninitialization code here System.err.println("Entered uninitialization code...."); } public void init(ICubeContext icubecontext) throws Exception { super.init(icubecontext); System.err.println("Initializing LifecycleManager Activation Agent ....."); handleInit(); } public void unload(ICubeContext icubecontext) throws Exception { super.unload(icubecontext); System.err.println("Unloading LifecycleManager Activation Agent ....."); handleUnload(); } public void uninit(ICubeContext icubecontext) throws Exception{ super.uninit(icubecontext); System.err.println("Uninitializing LifecycleManager Activation Agent ....."); handleUninit(); } public String getName() { return "Lifecyclemanageractivationagent"; } public void onStateChanged(int i, ICubeContext iCubeContext) { } public void onLifeCycleChanged(int i, ICubeContext iCubeContext) { } public void onUndeployed(ICubeContext iCubeContext) { } public void onServerShutdown() { }}Once you compile this code, generate a jar file and ensure you add it to the server startup classpath. The library is ready for use after the server restarts.To use this activationAgent, add an additional activationAgent entry in the bpel.xml for the BPEL Process that you wish to monitor.After you deploy the process, the ActivationAgent object will be called back whenever the events mentioned in the overridden methods are raised. [init(), load(), unload(), uninit()]. Subsequently, your custom code is executed.Sample bpel.xml illustrating activationAgent definition and property definition.<?xml version="1.0" encoding="UTF-8"?><BPELSuitcase timestamp="1291943469921" revision="1.0"> <BPELProcess wsdlPort="{http://xmlns.oracle.com/BPELTest}BPELTestPort" src="BPELTest.bpel" wsdlService="{http://xmlns.oracle.com/BPELTest}BPELTest" id="BPELTest"> <partnerLinkBindings> <partnerLinkBinding name="client"> <property name="wsdlLocation">BPELTest.wsdl</property> </partnerLinkBinding> <partnerLinkBinding name="test"> <property name="wsdlLocation">test.wsdl</property> </partnerLinkBinding> </partnerLinkBindings> <activationAgents> <activationAgent className="oracle.tip.adapter.fw.agent.jca.JCAActivationAgent" partnerLink="test"> <property name="portType">Read_ptt</property> </activationAgent> <activationAgent className="com.oracle.bpel.activation.LifecycleManagerActivationAgent" partnerLink="test"> <property name="emailAddress">ramkumarmenon@toottoot.com</property> </activationAgent> </activationAgents> </BPELProcess></BPELSuitcase>em>

@10g - This post is motivated by one of my close friends and colleague - who wanted to proactively know when a BPEL process shuts down/re-activates. This typically happens when you have a BPEL Process...

Oracle SOA Suite

Monitoring Events in your BPEL Runtime - RSS Feeds?

@10g - It had been a while since I'd tried something different. so here's what I did this week!Whenever our Developers deployed processes to the BPEL runtime, or perhaps when a process gets turned off due to connectivity issues, or maybe someone retired a process, I needed to know. So here's what I did. Step 1: Downloaded Quartz libraries and went through the documentation to understand what it takes to schedule a recurring job. Step 2: Cranked out two components using Oracle JDeveloper. [Within a new Web Project] a) A simple Java Class named FeedUpdater that extends org.quartz.Job. All this class does is to connect to your BPEL Runtime [via opmn:ormi] and fetch all events that occured in the last "n" minutes. events? - If it doesn't ring a bell - its right there on the BPEL Console. If you click on "Administration > Process Log" - what you see are events.The API to retrieve the events is //get the locator reference for the domain you are interested in.Locator l = .... //Predicate to retrieve events for last "n" minutesWhereCondition wc = new WhereCondition(...) //get all those events you needed.BPELProcessEvent[] events = l.listProcessEvents(wc); After you get all these events, write out these into an RSS Feed XML structure and stream it into a file that resides either in your Apache htdocs, or wherever it can be accessed via HTTP.You can read all about RSS 2.0 here. At a high level, here is how it looks like. <?xml version = '1.0' encoding = 'UTF-8'?><rss version="2.0">  <channel>    <title>Live Updates from the Development Environment</title>    <link>http://soadev.myserver.com/feeds/</link>    <description>Live Updates from the Development Environment</description>    <lastBuildDate>Fri, 19 Nov 2010 01:03:00 PST</lastBuildDate>    <language>en-us</language>    <ttl>1</ttl>    <item>      <guid>1290213724692</guid>      <title>Process compiled</title>      <link>http://soadev.myserver.com/BPELConsole/mdm_product/administration.jsp?mode=processLog&amp;processName=&amp;dn=all&amp;eventType=all&amp;eventDate=600&amp;Filter=++Filter++</link>      <pubDate>Fri Nov 19 00:00:37 PST 2010</pubDate>      <description>SendPurchaseOrderRequestService: 3.0 Time : Fri Nov 19 00:00:37                   PST 2010</description>    </item>   ...... </channel> </rss> For writing ut XML content, read through Oracle XML Parser APIs - [search around for oracle.xml.parser.v2] b) Now that my "Job" was done, my job was half done. Next, I wrote up a simple Scheduler Servlet that schedules the above "Job" class to be executed ever "n" minutes. It is very straight forward. Here is the primary section of the code.         try {        Scheduler sched = StdSchedulerFactory.getDefaultScheduler();         //get n and make a trigger that executes every "n" seconds        Trigger trigger = TriggerUtils.makeSecondlyTrigger(n);        trigger.setName("feedTrigger" + System.currentTimeMillis());        trigger.setGroup("feedGroup");                JobDetail job = new JobDetail("SOA_Feed" + System.currentTimeMillis(), "feedGroup", FeedUpdater.class);        sched.scheduleJob(job,trigger);         }catch(Exception ex) {            ex.printStackTrace();            throw new ServletException(ex.getMessage());        } Look up the Quartz API and documentation. It will make this look much simpler. Now that both components were ready, I packaged the Application into a war file and deployed it onto my Application Server. When the servlet initialized, the "n" second schedule was set/initialized. From then on, the servlet kept populating the RSS Feed file. I just ensured that my "Job" code keeps only 30 latest events within it, so that the feed file is small and under control. [a few kbs] Next I opened up the feed xml on my browser - It requested a subscription - and Here I was - watching new deployments/life cycle events all popping up on my browser toolbar every 5 (actually n)  minutes! Well, you could do it on a browser/reader of your choice - or perhaps read them like you read an email on your thunderbird!.

@10g - It had been a while since I'd tried something different. so here's what I did this week!Whenever our Developers deployed processes to the BPEL runtime, or perhaps when a process gets turned off...

Oracle SOA Suite

DBAdapter - java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got CLOB

Observed on BPEL PM 10.1.3.3.We had a set of master-detail tables that had one of the columns as a CLOB, and a process that is polling for new or changed records on these tables.When the process is deployed, the endpoint activation fails complaining "Expected - CLOB".The reason is that when the toplink query is generated, it generates a DISTINCT clause in the select statement, and DISTINCT clause cannot be applied if one of the return columns are CLOBs.The solution - Open up the toplink mappings XML file and update the batch-attribute reading value to "false" from "true".We figured this out from the Troubleshooting and Workarounds section of the Adapters documentation.I am inlining the relvant snippet from the document for convenience.A SELECT returning CLOB values must not use the DISTINCT clause. The simplest way to avoid DISTINCT is to disable batch attribute reading from A to B. Batch reading is a performance enhancement that attempts to simultaneously read all Bs of all previously queried As. This query uses a DISTINCT clause. Use joined reading instead, or neither joined reading nor batch attribute reading.Because both DISTINCT and CLOBs are common, you may see this problem in other scenarios. For example, an expression like the following uses a DISTINCT clause:SELECT DISTINCT dept.* from Department dept, Employee emp WHERE ((dept.ID =emp.DEPTNO) and (emp.name = 'Bob Smith'));

Observed on BPEL PM 10.1.3.3. We had a set of master-detail tables that had one of the columns as a CLOB, and a process that is polling for new or changed records on these tables.When the process is...

Deployment

Deploying static content and java web services to Weblogic 9.2

I had a simple BPEL on Weblogic install - and was looking for a place to host some static XML content on the server. On OC4J, it was simple - just dump the content in the appropriate directories under htdocs, and you are done. In a simple WLS install like the one I have, it doesn't work that way. So I created a simple Web Project, added all my XML contents into it, and deployed the ear file into WLS, just like any J2EE application. Here you go - you can now access all the hosted content at the contextURI that you specified at deployment time!Well, I use JDeveloper 10.1.3.3 - and needed to create and deploy a simple Java Web Service into WLS. I tried using the standard deploy-to-weblogic app server connection - but alas! - I ran into some deployment issues while deploying JWS from JDev 10.1.3.3 to WLS 9.2. The same error repeats if I pick up the ear file and deploy it directly from the WLS admin console.But hey, there was a simple way to get it done.Just use the WLS service generation build scripts - it will do the job just as well.Here is a snippet of the build script that I used to deploy my WS onto WLS.<project name="BuildHelloWorldService" default="ear"> <target name="ear"> <servicegen destEar="ears/HelloWorldService.ear" warName="HelloWorldService.war" contextURI="hello"> <classpath> <pathelement path="${java.class.path}" /> <pathelement location="D:\oraBPEL\bpel\lib\orabpel.jar"/> <pathelement location="D:\oraBPEL\bpel\lib\xmlparserv2.jar"/> </classpath> <service targetNamespace="http://xmlns.hello.com/" serviceURI="/HelloWorldService" generateTypes="True" expandMethods="True" javaClassComponents="com.hello.HelloWorld,com.hello.HelloWorldUtil,com.hello.util.HelloUtil" serviceName="HelloWorldService" style="document"> </service> </servicegen> </target>Note that servicegen is an 8.1 release ant task. WLS 9.2 has updated ant tasks that you can leverage to build services from your java classes. I used it only for my local testing.You can find detailed information on useful ant tasks for service generation, client stub generation and others on the WLS 9.2 documentation page.http://e-docs.bea.com/wls/docs92/webserv/anttasks.html

I had a simple BPEL on Weblogic install - and was looking for a place to host some static XML content on the server. On OC4J, it was simple - just dump the content in the appropriate directories under...

Oracle SOA Suite

Base64 Explained

Base64 is a mechanism to enable representing and transferring binary data over mediums that allow only printable characters.It is most popular form of the “Base Encoding”, the others known in use being Base16 and Base32. The need for Base64 arose from the need to attach binary content to emails like images, videos or arbitrary binary content .  Since SMTP [RFC 5321] only allowed 7-bit US-ASCII characters within the messages,  there was a need to represent these binary octet streams using the seven bit ASCII characters. Here is what RFC 5321 [Simple Mail Transfer protocol] states. “Commands and replies are composed of characters from the ASCII character set [6]. When the transport service provides an 8-bit byte (octet) transmission channel, each 7-bit character is transmitted, right justified, in an octet with the high-order bit cleared to zero. More specifically, the unextended SMTP service provides 7-bit transport only. An originating SMTP client that has not successfully negotiated an appropriate extension with a particular server (see the next paragraph) MUST NOT transmit messages with information in the high-order bit of octets. If such messages are transmitted in violation of this rule, receiving SMTP servers MAY clear the high- order bit or reject the message as invalid.” This led to the evolution and popularity of the Internet Standards like MIME [stands for Multipurpose Internet Mail Extensions]. MIME provided mechanisms to allow things like writing text using characters from a repertoire that require a different character encoding, and more importantly, allow one or more binary attachments to the e-mail. Since the underlying medium supports only plain ASCII text, MIME defined a set of binary-to-text encodings that enable capturing these binary octet streams into printable ASCII characters that can be used with mediums like SMTP. Base64 is one such binary-to-text encoding. For this purpose, MIME defines, among others, a header named Content transfer encoding that indicates whether a binary-to-text encoding has been applied on the message content, and if so, specifies the actual encoding that has been employed. Base64 is one of them. On the other hand, 7 bit ASCII characters contain a set of 94 printable characters and 33 non-printable ones. 64 is the highest power of 2 that can be represented using only printable characters that are mostly common among different character encodings in existence, most importantly, ASCII. What this means is that a hypothetical Base128 encoding will not be limited to the permitted set of printable characters, and hence will be unsuitable for the use-case at hand. The following is the character subset of US-ASCII that is used for Base64. [a-z] – 26 characters            [A-Z] – 26 characters          [0-9] – 10 characters           [+]  - 1 character [filler character] [/]   - 1 character [filler character] [=]  - Used for Padding purposes, as explained later. Since the numerals and alphabets make up for only 62 characters in all, Base64 chose “+” and “/” to fill the gap. The following is an excerpt from RFC 4648 illustrating the Alphabet for Base64. The Encoding Process The process to encode the input stream is fairly straightforward. a) The octet stream is read from left to right. b) Three 8-bit groups within the input stream is concatenated to form a 24-bit group. c) This 24-bit group is further treated as four 6-bit groups that is right justified using zeroes. The grouping into 6 bits is for the simple reason that 6 bits will cover the range of printable characters [0-26-1] d) Each of these 4 groups is then encoded using the above-mentioned chart in table 1. The case when the input bit stream contains less than 24 characters will be explained after the following example. Let’s say we wish to encode the string “ORACLE” using the Base-64 alphabet. Input String O R A C L E . . Binary Representation 010011112 010100102 010000012 010000112 010011002 010001012 . . After regrouping into 6-bit groups. [Binary and decimal equivalents are shown.] 0100112 [1910] 1101012 [5310] 001001 2 [910] 0000012 [110] 0100002 [1610] 1101002 [5210] 1100012 [4910] 000101\2 [510] After mapping the above eight 8-bit bytes using Table 1 T 1 J B Q 0 x F Base64 encoded string : T1JBQ0xF In the above scenario, the input character string contains 48 bits, an exact multiple of 24 that enables exact grouping into 6 bit groups. But in the event that there are less than 24 characters, or if the number of bits in the input stream is not a multiple of 24, padding is used to make up for the remaining bits. The methodology for padding is as follows. Add as many “zero” bits to the right of the 6-bit grouped bit stream so that the total bit length is a multiple of 24. If the modified input data contains any octets that contain only padded zeroes, replace each of those octets with the padding character “=”. This is illustrated in the next example. In the table below, the input string contains 40 bits. Hence 8 more bits need to be padded on the right to make up for 48, an exact multiple of 24. Input String M E N O N   . . . Binary Representation 010011012 010001012 010011102 010011112 010011102 . . . After regrouping into 6-bit groups. [Binary and decimal equivalents are shown.]. The bold zeroes on the right indicates the padded zeroes - 2+6. 0100112 [1910] 0101002 [2010] 010101 2 [2110] 0011102 [1410] 0100112 [1610] 1101002 [5210] 111000 [5610] 000000 = After mapping the above eight 8-bit bytes using Table 1 T U V O Q 0 4 = Base64 Encoded String : TUVOQ04= As evident from the above two examples, Base64 encoded data will always be much larger than the size of the original input stream. It has been estimated that it approximately increases the size by around 137% –i.e. a third more than the original size. Other Applications for Base64 Base64 has been used for other purposes as well, in addition to being used as a mechanism for content encoding within MIME. a) Content obfuscation For instance, it is used for simple obfuscation of data when exchanged between applications. Of course, any base64 encoded string can be reverse engineered to obtain the original set of bytes.Hence it cannot replace any good encryption mechanism.  b) Binary content handling in Web Services Base64 can also be used to send to / receive messages with binary content from Web Services. Note that this is not an efficient mechanism for large payloads due to the the size bloat-up caused by the Base-64 transformation.For such use-cases, it is advisable to send the payload as an attachment using  SOAP with Attachments or Message Transmission Optimization Mechanism [MTOM]. Base64 and XML XML documents can be carriers for binary content as well. Binary data can be base-64 encoded and be specified inline within any XML 1.0 document. Data within XML entities belong to the Unicode repertoire. The following is the production for a character in an XML 1.0 document. Char   ::=   #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ The XML Document, or any entity within the XML document can declare its character encoding as a part of a character encoding declaration. For the entire document, this is usually specified as a part of the XML document declaration. <?xml version=”1.0” encoding=”UTF-8”?> The character encodings supported by an XML processor may vary, but compliance to XML 1.0 requires acceptance of XML documents encoded using Unicode transformation formats[UTF] UTF-8 and UTF-16. XML 1.0 specification states “All XML processors MUST accept the UTF-8 and UTF-16 encodings of Unicode.“ UTF-8 and UTF-16 are character encodings, just like US-ASCII or ISO-8859-1. They associate a numeric code with each character in a character repertoire.  Whereas ASCII works off a limited 128 character repertoire, Unicode is much more comprehensive, covering for all major and most minor written languages of the world.  The two transformation formats provide character encodings for all characters in Unicode. When a processing application receives a UTF encoded XML document containing base64 encoded data, the decoding must be performed on the character data obtained after performing the character encoding processing. This is because these character encodings actually determine how the bytes are ordered [Endianness], and also determine how many bytes represent a single character. Detailed discussion of Unicode and its associated transformation formats is outside the scope of this document. Base64 and XML Schema The XML Schema datatype library defines a core datatype whose value space contains base64 encoded binary data. It is named “base64Binary”. This helps facilitate description of binary element content. Note: The bas64Binary is the datatype used for defining opaque content within your messages in BPEL PM. You would have seen the usage of this datatype while modeling an adapter interaction. Listing 1: WSDL illustrating opaque content definition for binary data Listing 2 : Audit Trail of writing opaque data out For explicitly base64 encoding a document, XML or otherwise, the product provides a Base64Encoder utility. There aren’t any XPath extension functions that enable base64 encoding of documents. The utility can be used from within a Java embedding activity to achieve the desired results. <bpelx:exec name="encodeMessage" language="java" version="1.3" id="BxExe0"> <![CDATA[    try {          com.collaxa.common.util.Base64Encoder encoder = new com.collaxa.common.util.Base64Encoder();          String encodedData = "" + encoder.encode("" + getVariableData("payloadVar"));          setVariableData("payloadVar",encodedData);          }catch(Throwable ex) {           //Handle errors here     } ]]> </bpelx:exec> Interestingly, XML Schema does not provide a way to indicate the media type of the binary data. Jonathan Marsh from the WSDL WG has a note on this. Quoting  JM - “One aspect of XML-based messages are difficult to fully capture in XML Schema is the meaning of base64-encoded binary data. XML Schema does provide facilities to describe that element content is base64-encoded binary (through the xs:base64Binary simple type), but it does not provide simple and user-accessible facilities to indicate the format of that binary data. The WSDL WG in conjunction with the XMLP WG, developed a W3C WG Note describing schema extensions that allow the media type (or a set of related media types) to be described. Using this facility, a WSDL consumer can determine not only that a specific message should contain base64-encoded binary data, but that that binary data represents a particular media type such as image/jpeg.”

Base64 is a mechanism to enable representing and transferring binary data over mediums that allow only printable characters.It is most popular form of the “Base Encoding”, the others known in...

BAM

A tussle with BAM and ASPNET

The first symptom ....Oracle BAM Active data cache fails to start.I went ahead and checked the logs in $ORACLE_BAM_HOME\Logs\ActiveDataCache.log.I see a error trace that looks like2008-12-06 03:02:01,391 [732] ERROR - ActiveDataCache DPAPI was unable to decrypt data. CryptUnprotectData failed. Error -2146893813: Key not valid for use in specified state.2008-12-06 03:02:01,401 [732] WARN - ActiveDataCache Exception occurred in method StartupStack trace: at Oracle.BAM.Common.Security.DataProtector.DPAPI.Decrypt(Byte[] cipherTextBytes, Byte[] entropyBytes, String& description) at Oracle.BAM.Common.Security.DataProtector.DPAPI.Decrypt(String cipherText, String entropy, String& description) at Oracle.BAM.Common.Security.DataProtector.DPAPI.Decrypt(String cipherText) at Oracle.BAM.Common.Security.DataProtector.DataProtector.Decrypt(String strData) at Oracle.BAM.ActiveDataCache.Kernel.StorageEngine.Oracle.ConnectionStringDecrypter.Decrypt(String strEncrypted) at Oracle.BAM.ActiveDataCache.Kernel.StorageEngine.Oracle.OracleDataFactory.GetInstance() at Oracle.BAM.ActiveDataCache.Kernel.StorageEngine.Oracle.OracleStorageEngine.GetDataFactory() at Oracle.BAM.ActiveDataCache.Kernel.StorageEngine.Oracle.OracleStorageEngine.GetServerVersion() at Oracle.BAM.ActiveDataCache.Kernel.StorageEngine.Oracle.OracleStorageEngine.Startup(IDictionary oParameters) at Oracle.BAM.ActiveDataCache.Kernel.Server.DataStoreServer.Startup()ResolutionFortunately, Metalink had a nice note on this one.See Document 467837.1 on metalink.The next showstopperAfter this got fixed, I attempted to load up the Oracle BAM home page - but it would not load up.It stated the following error message."Server Application UnavailableThe web application you are attempting to access on this web server is currently unavailable.Please hit the "Refresh" button in your web browser to retry your request. "I went ahead and took a look at the Event Viewer in my Control Panel --> Administrative Tools.It had a bunch of errors that stated aspnet_wp.exe could not be started. The error code for the failure is 80004005. This error can be caused when the worker process account has insufficient rights to read the .NET Framework files. Please ensure that the .NET Framework is correctly installed and that the ACLs on the installation directory allow access to the configured account.For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.ResolutionFortunately, I was able to find a solution at http://support.microsoft.com/kb/315158.

The first symptom .... Oracle BAM Active data cache fails to start. I went ahead and checked the logs in $ORACLE_BAM_HOME\Logs\ActiveDataCache.log. I see a error trace that looks like 2008-12-06...

Oracle SOA Suite

BPEL Correlation within FlowN

I was struggling a bit today while testing a simple process that does a flowN and does simple BPEL correlation.. Failed to evaluate correlation query. Failed to evaluate the correlationAlias query "/client:FlowNCorrelationDemoEvent/client:id" on the element "oracle.xml.parser.v2.XMLElement@283a35b" Please check your BPEL/WSDL source to make sure that property alias is defined correctly.     at com.collaxa.cube.engine.delivery.CorrelationProperty.setMessagePart(CorrelationProperty.java:85)     at com.collaxa.cube.engine.delivery.DeliveryHelper.createCorrelationSet(DeliveryHelper.java:140)     at com.collaxa.cube.engine.delivery.SOAPProtocolHandler.calculateCorrelations(SOAPProtocolHandler.java:751)     at com.collaxa.cube.engine.delivery.SOAPProtocolHandler.receiveCallback(SOAPProtocolHandler.java:167)     at com.collaxa.cube.engine.delivery.DeliveryService.receiveCallback(DeliveryService.java:462)     at com.collaxa.cube.engine.ejb.impl.CubeDeliveryBean.receiveCallback(CubeDeliveryBean.java:108)     at com.collaxa.cube.engine.ejb.impl.CubeDeliveryBean_yt19iq_ELOImpl.receiveCallback(CubeDeliveryBean_yt19iq_ELOImpl.java:307)     at com.collaxa.cube.engine.delivery.DeliveryHandler.continuePostAnyType(DeliveryHandler.java:429)     at com.collaxa.cube.engine.delivery.DeliveryHandler.continuePost(DeliveryHandler.java:380)     at com.collaxa.cube.engine.delivery.DeliveryHandler.post(DeliveryHandler.java:93)     at com.collaxa.cube.ejb.impl.DeliveryBean.post(DeliveryBean.java:203)     at com.collaxa.cube.ejb.impl.DeliveryBean.post(DeliveryBean.java:158)     at com.collaxa.cube.ejb.impl.DeliveryBean_uhics8_EOImpl.post(DeliveryBean_uhics8_EOImpl.java:279) It seems that the issue was occuring when I was initiating the process that contains a midprocess receive that is based off an operation in the same portType that contains the initiating operation for the service, through the BPEL console. <portType name="FlowNCorrelationDemo">     <operation name="initiate">         <input message="client:FlowNCorrelationDemoRequestMessage"/>     </operation>     <operation name="callback">         <input message="client:FlowNCorrelationDemoEventMessage"/>     </operation> </portType> Things worked just fine when I created another BPEL process and invoked this main BPEL process from the former. You can find the set of BPEL processes, together with a readme file at http://blogs.oracle.com/rammenon/FlowNCorrelationDemo.zip. You can find all the information about the services that I have used in the sample at the above URL. 1. Initiate the client service. The client service invokes the main service with the given payload. 2. Review the flow of main service. It should be waiting for the callbacks from within the flowN. 3. Invoke the ReaderService [the service that calls back the main service] with one callback message. 4. Review the flow of the main service. It should have received one callback.     5. Submit the remaining messages from the ReaderService to complete the entire flow. The main process should complete execution following this.  

I was struggling a bit today while testing a simple process that does a flowN and does simple BPEL correlation.. Failed to evaluate correlation query.Failed to evaluate the correlationAlias...

Oracle SOA Suite

Re-submit BPEL instances from BAM

Here is what I did for re-initiating BPEL instances from BAM. a) While defining the BAM sensor action, passed in the conversation Id of the instance [obtained using the xpath function ora:getConversationId()] b) Developed a Servlet that takes in a conversationId as a request parameter and initiates a new BPEL instance with the same input message. c) Created a table with an Action button that invokes the Servlet [using Open URL action] and passes in the conversationId.. The table contains columns that contain key identifiers for the transaction. [e.g. POId etc] d) At runtime, users select the rows in the table based on the identifiers and click on the action button - this will re-initiate the BPEL instance. Here is a snippet of code that does the trick.         IBPELDomainHandle domain = null;         Locator locator = null;         String convId = request.getParameter("convId");         Properties p = new Properties();         java.net.URL url = ClassLoader.getSystemResource("context.properties");         p.load(url.openStream());         locator = new Locator("default","weblogic",p);         domain = locator.lookupDomain();         WhereCondition wc = new WhereCondition("conv_id=?");         wc.setString(1,convId);         IInvokeMetaData[] invMetadataArr = locator.listInvokeMessages(wc);         IInvokeMetaData invMetadata = invMetadataArr[0];         String messageGuid = invMetadata.getMessageGUID();         domain.recoverInvokeMessages(new String[]{messageGuid});

Here is what I did for re-initiating BPEL instances from BAM. a) While defining the BAM sensor action, passed in the conversation Id of the instance [obtained using the xpath...

Oracle SOA Suite

Using Schematron within BPEL

I have developed a simple utility that validates an input document against a schematron file and returns a validation report that returns the status of validation, together with the list of assertions that failed. The utlity is registered as an XPath function and can be invoked from within the XSL Mapper. Here are the steps for using the utlity. a) Download the jar file from http://blogs.oracle.com/rammenon/SchematronValidator.jar b) Copy the file into $JDEV_HOME/jdev/lib/ext c) Create a new file named “SchematronExtensionFunctions.xml” and  copy the following content within it. <?xml version="1.0" encoding="UTF-8"?> <extension-functions>   <functions xmlns:sch="http://www.oracle.com/XSL/Transform/java/com.oracle.xsl.xpath.sch.SchematronValidator">     <function name="sch:validateDocument" as="node-set">        <param name="schFileName" as="string"/>        <param name="inputDoc" as="node-set"/>      </function>    </functions> </extension-functions>. Save the file onto the local file system. d) Open JDev and navigate to Tools –> Preferences –> XSL Map. e) Select the above file for the “User defined Extension Functions config file” and restart JDeveloper. f) Create a new empty project/BPEL Project. g) Add the following XSD into the project - http://blogs.oracle.com/rammenon/ValidationReport.xsd. This XSD will define the report of errors if any during the schematron validation. h)    Also add the XSD for the document you wish to validate [if you havent added it yet] i) Create a new XSL Map and choose the source as the input XSD in (h) and the target as the validationReport.xsd. j) Choose “validateDocument” from the  “User defined Extension functions” palette page of the component palette and drag it into the center pane. k) Edit the parameters of the xpath function – the first argument is the absolute URL to the “.sch” file. The second argument should be the root element of the source document.    for instance, the generated XSLT for the mapping would look like’ <xsl:copy-of select="sch:validateDocument('file:///localhost:7777/validations/po-validations.sch',/tns:po)"/> Note the “copy-of” instead of “value-of” in the above expresion. When you drag and drop nodes into the center pane, the mapper will generate “value-of” statements. Manually change it to “copy-of”. l) Test the map [note that the graphical view of the mapper might complain stating that ""copy-of" is not supported. You can safely ignore this message, since this warning is only for limitations to graphical rendering of the construct.

I have developed a simple utility that validates an input document against a schematron file and returns a validation report that returns the status of validation, together with the list of assertions...

Oracle SOA Suite

An attempt on 8 Queens Problem

I was trying out a different approach to 8-Queen's problem. I visualized each cell [that has a coordinate from (0,0) to (7,7) as a single number 10x + y. So you would have sort of an octal number set from 0 to 77. Each column would be 0-7, 10-17, 20-27 etc and so on till 70-77.Each row would be 0-70, 1 to 71 etc, in increments of 10. 7 17 27 37 47 57 67 776 16 26 36 46 56 66 765 15 25 35 45 55 65 754 14 24 34 44 54 64 743 13 23 33 43 53 63 732 12 22 32 42 52 62 721 11 21 31 41 51 61 710 10 20 30 40 50 60 70The solution was a recursive function that takes in a current column index [ranging from 0 to 7], and computing the matching lists of size 8, after applying an exclusion rule.The exclusion rule is interesting.For an item with value, lets say 43, the exclusion rule would test the row-wise, columnwise and diagonal collisions through a simple modulo-checking logic. The code is given below. Note that the code has not been subjected to any review, including self-review, though it generates the required 92 distinct permutations as the 8Q solution demands.package equeen;import java.io.FileWriter;import java.util.ArrayList;import java.util.List;import java.util.Stack;public class EightQueens { public boolean computeMatches(int rowIndex, List matchedList) throws Exception{ if(matchedList.size() == 8) { printToFile(matchedList); } boolean matched = false; for(int i = 10*rowIndex ; i 0) { matchedList.remove(matchedList.size() - 1); return true; } else return false; } private boolean computeExclusionRule(int value, List matchedList) { for(int i = 0 ; i < matchedList.size() ; i++) { int prevNumber = Integer.parseInt("" + matchedList.get(i)); int diff = (value - prevNumber); if((diff % 9 == 0 && (prevNumber % 10 > value % 10)) || (diff % 10 == 0) || (diff % 11 == 0 && (prevNumber % 10 < value % 10))) { return true; } } return false; } public static void main(String[] args) throws Exception { EightQueens q = new EightQueens(); List emptyList = new ArrayList(); int ZEROTHCOLUMN_INDEX = 0; long t = System.currentTimeMillis(); q.computeMatches(ZEROTHCOLUMN_INDEX,emptyList); System.err.println("Number of ms for execution - " + (System.currentTimeMillis() - t)); } private static FileWriter fw = null; private static void printToFile(List matchedList) throws Exception { if(fw == null) { fw = new FileWriter("d:\\temp\\results.log"); } String str = ""; for(int i = 0 ; i < matchedList.size() ; i++) { int itemValue = Integer.parseInt("" + matchedList.get(i)); str += getCoords(itemValue) + " "; } fw.write(str + "\r\n"); fw.flush(); } private static String getCoords(int cellValue) { int x = cellValue/10; int y = cellValue % 10; return "(" + x + "," + y + ")"; }}

I was trying out a different approach to 8-Queen's problem. I visualized each cell [that has a coordinate from (0,0) to (7,7) as a single number 10x + y. So you would have sort of an octal number set...

Oracle SOA Suite

Invoking an EJB Session Bean from a BPEL Process

EJB session beans can be invoked from a BPEL process through WSIF. Oracle BPEL PM ships with a WSIF provider for invoking EJBs. For demonstrating this, lets create a new EJB session bean. The session bean shall have one single business method namely "greetUser" that takes in a string argument userName, and returns a string value "Hello &lt;USERNAME>". Step 1: Creating the HelloWorld Session Bean. Create a new BPEL empty process project. Open up the New Gallery and choose to create a new EJB session bean. Choose the option for creating EJB 2.1 session bean. Give the Bean the name"HelloWorld", accept the remaining defaults and finish the wizard. Double click on the EJB in the Applications Navigator to bring up the EJB Module Editor". Specify the new business method in the "Methods" tab. Type in the parameter name and type manually in the text editor CLick ok to accept the changes. Click on the "orion-ejb-jar.xml" in the Applications Navigator. Here you need to provide the JNDI locaiton of the session bean. For this, add a "location" attribute on the &lt;SESSION-DEPLOYMENT>to provide the JNDI "ejb/session/HelloWorld". <?xml version = '1.0' encoding = 'windows-1252'?>  <orion-ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-ejb-jar-10_0.xsd"     schema-major-version="10" schema-minor-version="0">      <enterprise-beans>          <session-deployment name="HelloWorld" location="ejb/session/HelloWorld"/>      </enterprise-beans>  </orion-ejb-jar> Your bean is now ready for deployment. Build the project and deploy to an OC4J container. Step 2: Build the BPEL Process Create a new BPEL Process project. Create a new WSDL document in the project directory and name it HelloWorldEJB.wsdl. Add the bindings section that allow the process to invoke the EJB through WSIF. The salient portion of the bindings section is the jndiProviderURL. For an Application Server install, use the opmn ormi jndi provider URL. For standalone installations,use plain ormi provider URLs. The ejbName in the provider URL is the ejbName value in the ejb-jar.xml that was created as a part of the EJB session bean creation. <?xml version="1.0" ?>   <definitions targetNamespace="http://samples.otn.com/"              xmlns:tns="http://samples.otn.com/"              xmlns:xsd="http://www.w3.org/2001/XMLSchema"              xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/"              xmlns:ejb="http://schemas.xmlsoap.org/wsdl/ejb/"              xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"              xmlns="http://schemas.xmlsoap.org/wsdl/">     <!-- message declns -->     <message name="HelloWorldRequestMessage">       <part name="userName" type="xsd:string"/>     </message>     <message name="HelloWorldResponseMessage">       <part name="message" type="xsd:string"/>     </message>     <!-- port type declns -->     <portType name="HelloWorldPT">       <operation name="greetUser">         <input name="HelloWorldRequest" message="tns:HelloWorldRequestMessage"/>         <output name="HelloWorldResponse"                 message="tns:HelloWorldResponseMessage"/>       </operation>     </portType>     <!-- binding declns -->     <binding name="EJBBinding" type="tns:HelloWorldPT">       <ejb:binding/>       <format:typeMapping encoding="Java" style="Java">         <format:typeMap typeName="xsd:string" formatType="java.lang.String"/>       </format:typeMapping>       <operation name="greetUser">         <ejb:operation methodName="greetUser" parameterOrder="userName"                        interface="remote" returnPart="message"/>         <input name="HelloWorldRequest"/>         <output name="HelloWorldResponse"/>       </operation>     </binding>     <!-- service decln -->     <service name="HelloWorldService">       <port name="EJBPort" binding="tns:EJBBinding">         <!-- Put vendor-specific deployment information here -->         <ejb:address className="helloworldbean.HelloWorldHome"              jndiName="ejb/session/HelloWorld"              initialContextFactory="com.evermind.server.rmi.RMIInitialContextFactory"      jndiProviderURL="opmn:ormi://serverHost:opmnRequestPort:oc4jInstanceName/ejbName"/>       </port>     </service>     <plnk:partnerLinkType name="HelloWorldService">       <plnk:role name="HelloWorldServiceProvider">         <plnk:portType name="tns:HelloWorldPT"/>       </plnk:role>     </plnk:partnerLinkType>   </definitions>   Create a partnerlink for the WSDL that you just created and an invoke activity that can be used to invoke the plnk. Provide the username/password for connecting to the OC4J Instance that hosts the EJB within the bpel.xml deployment descriptor. This is typically the oc4jadmin user. <?xml version = '1.0' encoding = 'UTF-8'?>   <BPELSuitcase>      <BPELProcess id="HelloWorldBPELClient" src=""HelloWorldBPELClient.bpel">  "       <partnerLinkBindings>            <partnerLinkBinding name="client">               <property name="wsdlLocation">HelloWorldBPELClient.wsdl</property>            </partnerLinkBinding>            <partnerLinkBinding name="HelloWorld_plt">               <property name="wsdlLocation">HelloWorldEJB.wsdl</property>               <property name="java.naming.security.principal">oc4jadmin</property>               <property name="java.naming.security.credentials">welcome1</property>            </partnerLinkBinding>         </partnerLinkBindings>      </BPELProcess> </BPELSuitcase> Copy the EJB compiled classes from the EJB project created earlier into the $ORACLE_HOME/bpel/system/classes directory and restart the BPEL runtime. These classes are required for BPEL to get a hold on the home interface of the EJB to create an invoke the business method. Deploy the BPEL Process and see the results for yourself The demo EJB and BPEL Client project can be downloaded from this link.

EJB session beans can be invoked from a BPEL process through WSIF. Oracle BPEL PM ships with a WSIF provider for invoking EJBs. For demonstrating this, lets create a new EJB session bean. The session...

Oracle SOA Suite

Interesting XSLT Recipe - Computing line totals

You might have run into a requirement where you need to compute the total value of all items in a purchase order. Consider the PO XML shown below. <?xml version="1.0" encoding="UTF-8" ?>   <po xmlns="http://www.example.org">      <Items>         <item>            <price>1</price>            <qty>2</qty>         </item>         <item>            <price>3</price>            <qty>4</qty>         </item>         <item>            <price>5</price>            <qty>6</qty>         </item>      </Items>   </po>  You might want to compute the total value of all items in the purchase Order. For computing this, you would need to multiply the price and qty for each item, and add them up. In XSLT 1.0, I guess the way to do this would be to recursively invoke a template that computes the sum total. In XSLT 2.0, this can be done in a very elegant single expression.   <xsl:variable name="itemVar" select="/tns:po/tns:Items/tns:item"/>                   <xsl:template match="/">       <tns:poSummary>         <tns:totalValue><xsl:value-of select="sum(for $i in $itemVar return ($i/tns:price * $i/tns:qty))"/></tns:totalValue>       </tns:poSummary>     </xsl:template>   </xsl:stylesheet>  

You might have run into a requirement where you need to compute the total value of all items in a purchase order. Consider the PO XML shown below. <?xml version="1.0" encoding="UTF-8" ?>   <po xmlns="ht...

Oracle SOA Suite

Obtaining the Execution Times of BPEL Processes over a period of time

Here is a simple BPEL Query that will get you the statistics of execution times of all BPEL Process instances over a period of time. The stats include the number of invocations, minimum, maximum and average time of execution. view plaincopy to clipboardprint?SELECT process_id,count(*) as num_invocations,      max(((EXTRACT(HOUR FROM MODIFY_DATE) - extract(hour from creation_date)) *3600 +          (EXTRACT(MINUTE FROM MODIFY_DATE) - extract(MINUTE from creation_date)) *60 +          (EXTRACT(SECOND FROM MODIFY_DATE) - extract(SECOND from creation_date))) *1000)      as Max_Time ,         min(((EXTRACT(HOUR FROM MODIFY_DATE) - extract(hour from creation_date)) *3600 +         (EXTRACT(MINUTE FROM MODIFY_DATE) - extract(MINUTE from creation_date)) *60 +         (EXTRACT(SECOND FROM MODIFY_DATE) - extract(SECOND from creation_date))) *1000)      as Min_Time ,         avg(((EXTRACT(HOUR FROM MODIFY_DATE) - extract(hour from creation_date)) *3600 +         (EXTRACT(MINUTE FROM MODIFY_DATE) - extract(MINUTE from creation_date)) *60 +         (EXTRACT(SECOND FROM MODIFY_DATE) - extract(SECOND from creation_date))) *1000)      as Avg_Time         FROM CUBE_INSTANCE        WHERE         state &lt;> 9            and         creation_date > '09-APR-08 09.00.00.000000000 AM'           and         creation_date &lt; '09-APR-08 01.00.00.000000000 PM'            group by process_id order by process_id asc  SELECT process_id,count(*) as num_invocations, max(((EXTRACT(HOUR FROM MODIFY_DATE) - extract(hour from creation_date)) *3600 + (EXTRACT(MINUTE FROM MODIFY_DATE) - extract(MINUTE from creation_date)) *60 + (EXTRACT(SECOND FROM MODIFY_DATE) - extract(SECOND from creation_date))) *1000) as Max_Time , min(((EXTRACT(HOUR FROM MODIFY_DATE) - extract(hour from creation_date)) *3600 + (EXTRACT(MINUTE FROM MODIFY_DATE) - extract(MINUTE from creation_date)) *60 + (EXTRACT(SECOND FROM MODIFY_DATE) - extract(SECOND from creation_date))) *1000) as Min_Time , avg(((EXTRACT(HOUR FROM MODIFY_DATE) - extract(hour from creation_date)) *3600 + (EXTRACT(MINUTE FROM MODIFY_DATE) - extract(MINUTE from creation_date)) *60 + (EXTRACT(SECOND FROM MODIFY_DATE) - extract(SECOND from creation_date))) *1000) as Avg_Time FROM CUBE_INSTANCE WHERE state &lt;> 9 and creation_date > '09-APR-08 09.00.00.000000000 AM' and creation_date &lt; '09-APR-08 01.00.00.000000000 PM' group by process_id order by process_id asc In this query, you need to replace the sample date and time values with the values that you wish to use and report. Here is another query that gives the execution times of all BPEL instances over the given time period. view plaincopy to clipboardprint?   select bpel_process_name as process_id,           instance_key as cikey,           trunc(creation_date),           eval_time as exec_time    from bpel_process_instances    where state &lt;> 9 and         creation_date > '11-APR-08 09.00.00.000000000 AM' and         creation_date &lt; '11-APR-08 05.00.00.420000000 PM'   order by process_id asc, exec_time desc       select bpel_process_name as process_id, instance_key as cikey, trunc(creation_date), eval_time as exec_time from bpel_process_instances where state &lt;> 9 and creation_date > '11-APR-08 09.00.00.000000000 AM' and creation_date &lt; '11-APR-08 05.00.00.420000000 PM' order by process_id asc, exec_time desc In this query, you need to replace the sample date and time values with the values that you wish to use and report. Note that the above query shall give you the execution times for a particular day. Take a look at the comments on this blog entry to see a modified example that uses the "day" as well to obtain stats that span across multiple days.

Here is a simple BPEL Query that will get you the statistics of execution times of all BPEL Process instances over a period of time. The stats include the number of invocations, minimum, maximum and...

Oracle SOA Suite

Dynamically updating bpel.xml properties within your BPEL Process

There are different properties that you could actually update in your process descriptor. They are a) The Configuration properties b) The preference properties c) The partnerlink properties. These properties are illustrated below. view plaincopy to clipboardprint?&lt;BPELSuitcase>     &lt;BPELProcess id="UpdatePropertyProcess" src="UpdatePropertyProcess.bpel">       &lt;partnerLinkBindings>         &lt;partnerLinkBinding name="client">           &lt;property name="wsdlLocation">             UpdatePropertyProcess.wsdl            &lt;/property>           &lt;property name="partnerlinkProperty1">             valueOfPartnerlinkProperty 1            &lt;/property>         &lt;/partnerLinkBinding>       &lt;/partnerLinkBindings>        &lt;preferences>          &lt;property name="preferenceProperty1" encryption="plaintext">            valueOfPreferenceProperty1           &lt;/property>        &lt;/preferences>        &lt;configurations>         &lt;property name="configProperty1" encryption="plaintext">           valueOfConfigProperty1          &lt;/property>         &lt;/configurations>      &lt;/BPELProcess>   &lt;/BPELSuitcase>  To update these properties dynamically within the BPEL Process, you can use a Java embedding within the process, as shown below. view plaincopy to clipboardprint?   try {      getLocator().lookupProcess ("UpdatePropertyProcess").                     getDescriptor ().                      getConfigurations().                        setPropertyValue ("configProperty1",                         "newValueOfConfigPropertyValue1");      getLocator().lookupProcess ("UpdatePropertyProcess").                      getDescriptor ().                       getPreferences().                        setPropertyValue ("preferenceProperty1",                          "newValueOfPreferenceProperty1" );      getLocator().lookupProcess ("UpdatePropertyProcess").                      getDescriptor ().                       getPartnerLinkBindings().                         getPartnerLinkBinding ("client").                           setPropertyValue ("partnerlinkProperty1",                           "newValueOfPartnerlinkProperty 1");     }     catch(Throwable ex) {     }       Click here to download the Sample BPEL Process project.

There are different properties that you could actually update in your process descriptor. They are a) The Configuration properties b) The preference properties c) The partnerlink properties....

Oracle SOA Suite

Miscellaneous Ant tasks for Managing the BPEL Server

The serverAdmin ANT task This news item describes a simple ant task that I had come up named serverAdmin that allows you to Selectively undeploy BPEL Processes Selectively purge BPEL process instances. Cancel and Recover Invocation Messages Cancel and Recover Callback Messages Get one or more domain configuration properties Set one or more domain configuration properties Fetch the latest domain log from the Server Create/delete a domain on the BPEL server Setup and Usage To setup this task, perform the following steps. Copy the admintasks.jar from http://blogs.oracle.com/ramkumarMenon/gems/admintasks.jar into $ORACLE_HOMEintegrationlib directory. Open up ant-orabpel.xml in $ORACLE_HOMEbpelutilities directory and paste the following piece of code into the file within the element. <path id="admin.tasks.class.path">   <pathelement location="${bpel.home}/../lib/admintasks.jar"/>  </path>  <property name="admin.tasks.class.path" refid="admin.tasks.class.path"/>  <taskdef name="serverAdmin" classname="com.collaxa.cube.ant.taskdefs.ServerAdmin">    <classpath>      <pathelement path="${admin.tasks.class.path}"/>    </classpath>  </taskdef> Illustrative Command Syntax       <serverAdmin  providerURL="opmn:ormi://<hostName>:<opmnRequestPort>:<oc4jInstanceName>/orabpel"  userName="oc4jadmin" providerURL="opmn:ormi://::/orabpel">      <serverAdmin  providerURL="opmn:ormi://<hostName>:<opmnRequestPort>:<oc4jInstanceName>/orabpel" userName="oc4jadmin" password="<pwdforoc4jadmin>">       <createDomain domainName="testDomain"/>       <deleteDomain domainName="testDomain"/>       <manageDomain domain="default">              <undeployProcesses select="BPELProcess.*"  type="all" revision="all"/>              <undeployProcesses select="TestXPath"  type="retired" revision="all"/>             <undeployProcesses select="Sample.*" type="all" revision="2.0"/>             <undeployProcesses select="SampleProcess" type="active" revision="1.0"/>         <!--example dateTime format "yyyy-MM-dd'T'HH:mm:ss Z"   "1994-11-05T08:15:30 -0800-->         <!--example date format "yyyy-MM-dd"   "1994-11-05"-->          <purgeInstances select="TestXPath" type="all" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>          <purgeInstances select="TestJMS" type="closed.stale" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>             <getProperties propertyNames="dspMinThreads,dspMaxThreads,syncMaxWaitTime"/>              <setProperty name="dspMinThreads" value="5"/>              <cancelInvocations select="PurchaseOrderProcess" revision="1.0" fromDateTime="2007-11-05T17:45:56 -0800" toDateTime="2007-11-05T17:45:58 -0800"/>              <recoverInvocations select="OrderCreationProcess" revision="1.0" fromDateTime="2007-11-05T17:21:10 -0800" toDateTime="2007-11-05T17:21:15 -0800"/>              <cancelCallbacks select="OrderCreationProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>              <recoverCallbacks select="OrdeUpdateProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>              <printLog outFile="D:\\temp\\latest_domain.log" lineCount="2000"/>          <purgeInstances select="all" type="closed.stale" fromDate="2007-10-29" toDate="2007-10-31"/>          <purgeInstances fromDate="2007-10-29" toDate="2007-10-31"/>          <purgeInstances select="SampleProcess" type="closed.completed"  toDateTime="2007-10-31"/>          <purgeInstances select="SampleProcess2" fromDateTime="2007-10-29T11:21:03 -0800"/>          <purgeInstances select="TestXPath" type="closed.stale" fromDate="2007-10-29" />         <purgeInstances/>        </manageDomain>      </serverAdmin>Short Description 1. UnDeployProcesses subtask The select argument for "undeployProcesses" subtask accepts both exact process names, as well as java regex expressions. For instance, the above example shows undeployment for all processes whose name starts with the string "BPELProcess".All arguments are mandatory.If you wish to specify "all" values for one or more arguments, specify them in the format ="all". For instance, you can specify type="all" or revision="all" or select="all" to indicate selection of all process states, all revisions or all processes. 2. PurgeInstances subtask If fromDateTime/fromDate is omitted, it purges every matching instance upto and including the "toDateTime/toDate". Note that in case you specify a date as opposed to a dateTime, the time is defaulted to the beginning of the date. [i.e. 12 AM]If the "toDateTime/toDate" is omitted, it purges every matching instance till the present.If both are specified, the task purges all matching instances including and between the given timespan.If both are omitted, the task purges all matching instances irrespective of the time.The dateTime has to be specified in the format given in the above example.The "type" attribute, if omitted, is equivalent to "all". The other values are closed.aborted closed.cancelled closed.completed closed.faulted closed.stale closed.pendingCancel initiated open.running open.faulted open.suspended Each serverAdmin task can be used to administer a different BPEL runtime.Within each serverAdmin, you can provide multiple tasks, one for each domain to purge and undeploy processes and instances in each domain. 3. Print Log Subtask Prints the domain log 4. SetProperty subtask Sets a domain property. e.g. dspMaxThreads 5. GetProperties subtask Gets the property values for the given set of domain properties.[comma separated] 6. Recovery/Cancellation/Deletion of Invocation or callback subtasks Recovers, deletes or cancels invocations/callback. Arguments to this task are the processName, revision, the from/to date or dateTimes in the given format as specified in the example. [yyyy-MM-dd'T'HH:mm:ss Z or yyyy-MM-dd] 7. Create Domain subtask Creates a domain with the given name. 8. Delete Domain subtask Deletes the domain with the given name.Notes:Ensure that BPEL_HOME and ORACLE_HOME are properly set.Sample Build File <?xml version="1.0" encoding="iso-8859-1"?><project name="ServerAdminBuild" default="deploy" basedir=".">    <!--=============================-->    <!-- Process deployment targets  -->    <!--=============================-->    <!-- Set bpel.home from developer prompt's environment variable BPEL_HOME -->    <condition property="bpel.home" value="${env.BPEL_HOME}">        <available file="${env.BPEL_HOME}/utilities/ant-orabpel.xml"/>    </condition>    <!-- If bpel.home is not yet using env.BPEL_HOME, set it for JDev -->    <property name="bpel.home" value="${oracle.home}/integration/bpel"/>    <!-- First override from build.properties in process.dir, if available -->    <property file="${process.dir}/build.properties"/>    <!-- import custom ant tasks for the BPEL PM -->    <import file="${bpel.home}/utilities/ant-orabpel.xml"/>    <target name="adminTasks">      <serverAdmin  providerURL="opmn:ormi://server.host.com:6004:oc4j_soa/orabpel" userName="oc4jadmin" password="welcome1">        <manageDomain domain="default">              <undeployProcesses select="BPELProcess.*"  type="all" revision="all"/>             <getProperties propertyNames="dspMinThreads"/>              <setProperty name="dspMinThreads" value="5"/>              <cancelInvocations select="PurchaseOrderProcess" revision="1.0" fromDateTime="2007-11-05T17:45:56 -0800" toDateTime="2007-11-05T17:45:58 -0800"/>              <recoverlInvocations select="OrderCreationProcess" revision="1.0" fromDateTime="2007-11-05T17:21:10 -0800" toDateTime="2007-11-05T17:21:15 -0800"/>              <cancelCallbacks select="OrderCreationProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>              <recoverCallbacks select="OrdeUpdateProcess" revision="2.0" fromDate="2007-11-05" toDate="2007-11-06"/>              <printLog outFile="D:\\temp\\latest_domain.log" lineCount="2000"/>              <undeployProcesses select="TestXPath"  type="retired" revision="all"/>             <undeployProcesses select="Sample.*" type="all" revision="2.0"/>             <undeployProcesses select="SampleProcess" type="active" revision="1.0"/>         <!--example dateTime format "yyyy-MM-dd'T'HH:mm:ss Z"   "1994-11-05T08:15:30 -0800-->         <!--example date format "yyyy-MM-dd"   "1994-11-05"-->          <purgeInstances select="TestXPath" type="all" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>          <purgeInstances select="TestJMS" type="closed.stale" fromDateTime="2007-10-29T11:21:03 -0800" toDateTime="2007-10-31T13:21:03 -0800"/>          <purgeInstances select="all" type="closed.stale" fromDate="2007-10-29" toDate="2007-10-31"/>          <purgeInstances fromDate="2007-10-29" toDate="2007-10-31"/>          <purgeInstances select="SampleProcess" type="closed.completed"  toDateTime="2007-10-31"/>          <purgeInstances select="SampleProcess2" fromDateTime="2007-10-29T11:21:03 -0800"/>          <purgeInstances select="TestXPath" type="closed.stale" fromDate="2007-10-29" />         <purgeInstances/>        </manageDomain>      </serverAdmin>    </target></project>

The serverAdmin ANT task This news item describes a simple ant task that I had come up named serverAdmin that allows you to Selectively undeploy BPEL Processes Selectively purge BPEL process instances. Can...

Oracle SOA Suite

Customizing any BPEL Project Artifact using <customizeDocument>

Tokenization of artifacts in a BPEL ProjectThis note describes a simple ant task that I had come up with that provides an easy and flexible method to enable migration of Process artifacts while deploying to multiple target environments.Problem StatementMost often, the BPEL process projects that you develop contain XSDs and WSDLs that fall into one or more of the following categories.a) The artifacts themselves are hosted on a dedicated server for the specific environment. [For instance, in the OHS htdocs within the development server] The artifacts are referred from the project using absolute URLs, containing the host, port, and other server specific information.b) The artifacts include or import other artifacts that are hosted on a dedicated server for the specific environment.c) The WSDL contains a JNDI location that changes for each environment.d) The WSDL defines inline schemas that contain imported remote XSDs that again are hosted on the dedicated development server.If your process exhibits one or more of the above characteristics, then more often that not, you will encounter the challenge of automating the migration of these artifacts at deployment time, especially when you have a medium to large number of projects, and/or if you have multiple target environments to deploy to.There are multiple approaches that are in prevelance today to tackle this.a) The laborious error-prone way of manually replacing the URLs/JNDI names for the new environments.b) Usage of &lt;customize> and &lt;customizeWSDL> ant tasks.But what will be really useful is a generic customization infrastructure that enables users to tokenize any arbitrary XML based artifact within the BPEL Project that includes, but is not limited toa) The BPEL fileb) The WSDL file(s)c) XSDsd) XSLTe) Toplink MappingsThe list goes on.OverviewThe above issues are addressed through a new customization ant task, namely customizeDocument. This task is very similar in usage and behaviour to the existing customization tasks shipped with the product.The task allows token replacements of contents of any element or attribute that can be reached through an XPath expression. The only limitation of the task is within the tokenization of Processing Instructions within your XML based documents. For instance, the Jdeveloper generated XSL Map file contains a PI indicating the URLs of the source and target XSDs for the map. These URLs cannot be tokenized using this task, nor is this supported through any of the existing customization task.Setup and UsageTo setup this task, perform the following steps.a) Copy the customtasks.jar available at http://blogs.oracle.com/ramkumarMenon/gems/customtasks.jar into $ORACLE_HOME\integration\lib directory.b) Open up ant-orabpel.xml in $ORACLE_HOME\bpel\utilities directory and paste the following piece of code into the file within the &lt;project> element.&lt;path id="custom.tasks.class.path">    &lt;pathelement location="&lt;absolute path to location of customtasks.jar>"/> &lt;/path>     &lt;property name="custom.tasks.class.path" refid="custom.tasks.class.path"/>&lt;taskdef name="customizeDocument" classname="com.collaxa.cube.ant.taskdefs.customize.document.CustomizeDocument">    &lt;classpath>      &lt;pathelement path="${custom.tasks.class.path}"/>    &lt;/classpath>&lt;/taskdef>  The usage of this task is best illustrated through a simple running example.You have a BPEL process project named �CreatePurchaseOrder� that you have deployed to the �test� environment. After you have performed all the necessary tests, you wish to promote this process to the production environment. The project contains amongst others, the process WSDL named CreatePurchaseOrderService.wsdl that imports the local Process Schema named PurchaseOrder.xsd. The WSDL also imports another WSDL named GeneralPOHeader.wsdl that is a shared WSDL amongst multiple BPEL Processes. This WSDL is hosted on the OHS on the �test� environment. The CreatePurchaseOrderService.wsdl also imports an XSD named Addressing.xsd that is again hosted on the OHS on the test environment.Moreover, each environment is associated with a specific support group � that receives notification on faults and errors within processes deployed to that specific environment. The support team email is specified as a preference witihn the deployment descriptor of the BPEL process. [bpel.xml]. This is how a portion of CreatePurchaseOrderService.wsdl looks like.&lt;?xml version = '1.0' encoding = 'UTF-8'?>&lt;definitions name="PurchaseOrderService" targetNamespace="http://xmlns.oracle.com/PurchaseOrderService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:client="http://xmlns.oracle.com/PurchaseOrderService" xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/">        &lt;import namespace="http://xmlns.po.com/general" location="http://testsoa.server.com:7780/services/GeneralPOHeader.wsdl" />        &lt;types>  &lt;schema xmlns="http://www.w3.org/2001/XMLSchema">   &lt;import namespace="http://xmlns.oracle.com/CreatePurchaseOrderService" schemaLocation="CreatePurchaseOrder.xsd"/>   &lt;import namespace="http://xmlns.po.com/addressing" schemaLocation="http://schemas.xmlsoap.org/wsdl/"/>    &lt;property name="prefix.xsd" value="http://schemas.xmlsoap.org/wsdl/"/>     &lt;property name="prefix.xsd" value="

Tokenization of artifacts in a BPEL Project This note describes a simple ant task that I had come up with that provides an easy and flexible method to enable migration of Process artifacts while...

Oracle SOA Suite

Specifying null content in your XML Document using nillable and xsi:nil

At times, it is very important to distinguish between empty content and null content in your XML documents. XML Parsers consider text values of empty elements as an empty string, and not null.For instance, &lt;itemId>&lt;/itemId> and &lt;itemId/> are both nodes whose text content is an empty string. When an XML Parser parsers the document containing this element, the parser treats both variants of the itemId element as one with empty string value.If you wish to explicitly mark the element to have a value of null as opposed to an empty content, you should declare the element in the schemato be "nillable", signalling that the value for the element can come in as null at runtime.For instance &lt;xsd:element name="itemId" nillable="true"/>At runtime, the element has to be explicitly marked with the "xsi:nil="true" to indicate the null content.For e.g. &lt;itemId xsi:nil="true"/> or &lt;itemId xsi:nil="true">&lt;/itemId>. Any schema aware XML parser will then be able to interpret the element content to have a null value.But you cannot have xsi:nil="true" for elements that have non-null content. For e.g. &lt;itemId xsi:nil="true">hello&lt;/itemId> is illegal.But you are free to have attributes on elements that have xsi:nil="true".Note that "xsi" is  just a prefix - the "nil" attribute comes from the XML Schema instance namespace - http://www.w3.org/2001/XMLSchema-instance. You could define any arbitrary namespace prefix to refer to the "nil" attribute.Another important point to note is that you cannot define "xsi:nil" on attributes. They can be defined only on elements.Moreover, it is also illegal to define nillable on element references."ref" and "nillable" are mutually exclusive attributes.For e.g.&lt;element ref="ItemId" nillable="true"/> is invalid.Nillable should be specified on the actual element definition.

At times, it is very important to distinguish between empty content and null content in your XML documents. XML Parsers consider text values of empty elements as an empty string, and not null.For...

Oracle SOA Suite

Getting the Fault Payload returned by BPEL Processes in RMI Clients

Assume that you have a BPEL Process that returns a Fault may it be business or runtime. Your RMI Client can receive the payload of the faults from the BPEL Processes by using the snippet below. view plaincopy to clipboardprint?   import oracle.xml.parser.v2.XMLElement;    import com.oracle.bpel.client.ServerException;    import com.oracle.bpel.client.BPELFault;    try {           //invoke the BPEL process using the DeliveryService API.       }catch(ServerException ex) {         Throwable t = ex.getCause();            if(t instanceof BPELFault)  {           BPELFault fault = (BPELFault)t;        //in the line below, "payload" is the name of the message part.        //replace it with the part name that you have defined in the WSDL.        //if its a runtime fault, refer to RuntimeFault.wsdl to obtain the        //part name. In that case, the payload will be a string value.              XMLElement faultPayload = (XMLElement)fault.getPart("payload");              //do processing with payload         }          }  import oracle.xml.parser.v2.XMLElement; import com.oracle.bpel.client.ServerException; import com.oracle.bpel.client.BPELFault; try { //invoke the BPEL process using the DeliveryService API. }catch(ServerException ex) { Throwable t = ex.getCause(); if(t instanceof BPELFault) { BPELFault fault = (BPELFault)t; //in the line below, "payload" is the name of the message part. //replace it with the part name that you have defined in the WSDL. //if its a runtime fault, refer to RuntimeFault.wsdl to obtain the //part name. In that case, the payload will be a string value. XMLElement faultPayload = (XMLElement)fault.getPart("payload"); //do processing with payload } }

Assume that you have a BPEL Process that returns a Fault may it be business or runtime. Your RMI Client can receive the payload of the faults from the BPEL Processes by using the snippet below. view...

Oracle SOA Suite

Why doesnt my XPath work with unprefixed path elements?

Assume that you had an XML Document like the one illustrated below.view plaincopy to clipboardprint?   &lt;purchaseOrder xmlns="www.oracle.com/po">     &lt;id>100&lt;/id>     &lt;items>      &lt;item name="TV">        &lt;description>television&lt;/description>      &lt;/item>      &lt;item name=VCR">        &lt;description>Video Cassette Recorder&lt;/description>      &lt;/item>      &lt;item name="DVD">        &lt;description>Digital Video Disc&lt;/description>      &lt;/item>     &lt;/items>     &lt;comment>PO from Ramkumar Menon&lt;/comment>   &lt;/purchaseOrder>  You had a piece of java code in which you wish to get the comments from the purchaseOrder. You choose to use the "selectNodes()" API to get the value. view plaincopy to clipboardprint?      DOMParser parser = new DOMParser();    StringReader reader = new StringReader(poXMLString);    parser.parse(reader);;    XMLDocument doc = parser.getDocument();    XMLElement docElement = (XMLElement)doc.getDocumentElement();    NodeList list = doc.selectNodes("/purchaseOrder/comment",docElement);    System.err.println("number of items in the list = " + list.getLength());   DOMParser parser = new DOMParser(); StringReader reader = new StringReader(poXMLString); parser.parse(reader);; XMLDocument doc = parser.getDocument(); XMLElement docElement = (XMLElement)doc.getDocumentElement(); NodeList list = doc.selectNodes("/purchaseOrder/comment",docElement); System.err.println("number of items in the list = " + list.getLength()); Result - Guess what! It is zero. Why ? Here you go! The Location path expression that I just modeled contains a set of location steps "purchaseOrder"and "comment". Xpath expects each of the node names within the location steps to be a QName. [consisting of a namespace URI and a local name] But, yes, but, if the namespace prefix on the node name is specified to be "empty", the nodes are assumed to come from null namespace, and not the default namespace. That is exactly why you get zero nodes on the evaluation of the expression. Whats the workaround? Ensure that the path elements have a namespace prefix, or You could use wildcard expressions . For instance,the above expression could be re-written as "/*[local-name()='purchaseOrder'][namespace-uri()='www.oracle.com/po'] /*[local-name()='comments'[namespace-uri()='www.oracle.com/po'] You could use either of these approaches, and you've got what you wished for!

Assume that you had an XML Document like the one illustrated below. view plaincopy to clipboardprint?    &lt;purchaseOrder xmlns="www.oracle.com/po">     &lt;id>100&lt;/id>     &lt;items>      &lt;item name...

Oracle SOA Suite

Whats the difference between OC4J standalone and an OC4J in the Oracle Application Server ?

Here are a few but "not comprehensive" differences between OC4J in a standalone configuration, and OC4J in an Oracle Application Server configuration.[For comprehensive information, please refer to the "Introduction to OC4J" chapter in the "OC4J configuration and administration Guide"Properties of OC4J in a Standalone configuration1) Minimal set of components including J2EE and web services.2) Comes with EM for administration3) Can also be configured througth ant tasks or admin_client.jar4) Available as a single zip file.5) No backup, restore or disaster recovery capabilities6) Comes with a builtin OC4J web server7) Can be started using oc4j script or through oc4j.jar.    for e.g. to startup the standalone oc4j instance,   use oc4j -start or java -jar oc4j.jar.   To shutdown, use oc4j -shutdown or java -jar admin_client.jar &lt;args>. or java -jar &lt;admin.jar> &lt;options>Properties of OC4J in an Oracle Application Server configuration1) one or more OC4J Instances in an OAS cluster.2) Comes with EM for admiinistration3) Comes with a full fledged HTTP Server4) Comes with opmn for starting/stopping/monitoring components like oc4j, http server.5) comes with ONS for managing communication between components in the app server.6) Allows for load balancing across group of OC4J Instances in a cluster. [communication between objects in the cluter is provided through ONS]7) Can be administered through   a) EM   b) ant tasks   c) admin_client.jar   d) admin.jar8) Backup, restore and disaster recovery capabilities available9) web communications managed through OHS as the front-end listener. OHS passes incoming HTTP requests to mod_oc4j module, that dispatches the request to the approrpaite OC4J Instance using AJP at a configured port.  

Here are a few but "not comprehensive" differences between OC4J in a standalone configuration, and OC4J in an Oracle Application Server configuration. [For comprehensive information, please refer to...

Oracle SOA Suite

Subtracting 2 dateTime values into a duration using XPath 2.0

Here is a simple XSLT that allows you to subtract two xsd:dateTime values into a xsd:duration value. The given XSLT uses XPath 2.0. Hence to get it to work, ensure that the "version" attribute on the &lt;xsl:stylesheet> element is set to "2.0". I have used Oracle BPEL 10.1.3.1 for this illustration.XSL Source&lt;xsl:stylesheet version="2.0" xmlns:ns1="http://www.output.org"                xmlns:xsd="http://www.w3.org/2001/XMLSchema"                xmlns:ns0="http://www.input.org"                exclude-result-prefixes="xsl xsd ns0 ns1">  &lt;xsl:template match="/">    &lt;ns1:output>      &lt;ns1:durationValue>        &lt;xsl:value-of select="(xsd:dateTime(/ns0:input/ns0:date1) - xsd:dateTime(/ns0:input/ns0:date2))"/>      &lt;/ns1:durationValue>    &lt;/ns1:output>  &lt;/xsl:template>&lt;/xsl:stylesheet>Input&lt;?xml version="1.0" encoding="UTF-8" ?>&lt;input xmlns="http://www.input.org">   &lt;date1>2007-07-17T12:50:28.256&lt;/date1>   &lt;date2>2007-07-18T12:52:28.257&lt;/date2>&lt;/input>Output&lt;?xml version = '1.0' encoding = 'UTF-8'?>&lt;ns1:output xmlns:ns1="http://www.output.org">   &lt;ns1:durationValue>-P1DT2M0.1S&lt;/ns1:durationValue>&lt;/ns1:output> 

Here is a simple XSLT that allows you to subtract two xsd:dateTime values into a xsd:duration value. The given XSLT uses XPath 2.0. Hence to get it to work, ensure that the "version" attribute on the...

Oracle SOA Suite

Tokenizing WSDL imports while deploying to mutliple environments

Your BPEL Process might have one or more WSDLs that import another WSDL or an XSD from the server. This might result in hardcoded URLs in your WSDL - for instance&lt;definitions ....>   &lt;import namespace="http://www.oracle.com/po" location="http://localhost:7779/schemas/xml/createpo.wsdl"/>  . .... &lt;/definitions> When you are deploying to multiple environments, you might want to change the host and port for the URL that points to this WSDL, so that it points to the current server, or whatever you wish to use.There is useful task named &lt;customizeWSDL> that allows you to do this.For this, follow the same instructions I had mentioned in the earlier blog entry for deployment to multiple environments,but with the following difference.Instead of the &lt;customize> task, use the &lt;customizeWSDL> taskFor e.g.         &lt;bpelc>               . . . . .           &lt;customizeWSDL  inFile="${process.dir}/bpel/PurchaseOrder.wsdl" outFile="${process.dir}/bpel/PurchaseOrder.wsdl">                &lt;wsdlImport namespace="&lt;/wsdlImport">http://www.oracle.com/po" locationURI="http://${deploy_host}:${deploy_port}/schemas/xml/createpo.wsdl"/>                         &lt;/customizeWSDL>        &lt;/bpelc> 

Your BPEL Process might have one or more WSDLs that import another WSDL or an XSD from the server. This might result in hardcoded URLs in your WSDL - for instance &lt;definitions ....>    &lt;import...

Oracle SOA Suite

Deploying BPEL Process to multiple environments using Ant

Deploying BPEL Processes to multiple environmentsOverviewOracle BPEL PM 10.1.3.1 provides utility ant scripts that aid in deploying your BPEL Processes to remote BPEL Servers. This allows you the flexibility of automating bulk deployment of a set of BPEL processes to a target environment. The ant scripts work off a properties file that provide the details of the target system.The Product install comes with a default ant-orabpel.properties that exists in your $ORACLE_HOME/bpel/utilities directory. This file contains default deployment tokens that are used by the ant script for deployment.Here is how the default ant-orabpel.properties looks like.&lt;!---- START ant-orabpel.properties ->############################################# Use this file to OVERRIDE default properties when deploying this project# using "ant" from Developer Prompt or "ant" on project's build.xml in Jdev# These properties do not get used when deploying from Jdev project -> Deploy############################################ AppServer platform: currently supported values are ias_10g, oc4j_10g#platform = ias_10g# Change below if deploying in domain other than "default"#domain = default# Change below if deploying with process revision other than 1.0#rev = 1.0# Make sure admin.user, admin.password is correct for appserver#admin.user = oc4jadmin#admin.password =# http.hostname and http.port should point to BPEL Server's host and http port#http.hostname = localhost#http.port = 9700# For BPEL in cluster environemnt, j2ee.hostname may not be same as# http.hostname, where j2ee.hostname will be local hostname,# while http.hostname will be virtual hostname# For deployment of applications in oc4j cluster, set cluster = true# and oc4jinstancename to opmn cluster group it belongs to such as default_group#cluster = false#j2ee.hostname = localhost# rmi.port or opmn.requestport is used in jndi.url/deployment-url in# standalone or midtier installation respectively.# rmi.port value below is default value as in BPEL standalone-developer install.# If you rely on this value, make sure it's correct for your installation# as from command "opmnctl status -l" output in midtier/SOA install.#rmi.port = 23791#opmn.requestport = 6003#oc4jinstancename = home#asinstancename =# Set verbose to true if you want to see verbose output from deployment tasks#verbose = false# Following properties are used by bpelTest.bpeltest.callHandler =bpel.context.properties = ${bpel.home}/samples/tutorials/102.InvokingProcesses/rmi/context.properties &lt;!-- END ant-orabpel.properties -->You could override these properties by altering the default build.properties that exist in your Project directory.The deployment is driven off a build.xml that exists in each BPEL Project. The build file defines ant targets for compilation, task validation, deployment etc.&lt;project name="bpel.deploy" default="deploy" basedir=".">&lt;!--=============================-->&lt;!-- default "deploy" target -->&lt;!--=============================--> &lt;target name="deploy" depends="pre-build, process-deploy, post-build" />&lt;target name="process-deploy"depends="validateTask, compile, deployProcess, deployTaskForm, deployDecisionServices" /> Customizing PartnerlinkBindings for each Target EnvironmentThe problemThe bpel.xml artifact is a serialized deployment descriptor for each of your BPEL processes. It provides handles to the partners with which your BPEL process interacts with, as well as provides information about deployment specific configurations and preferences for your BPEL ProcessIn the event that your BPEL process invokes another one, and you wish to refer to the WSDL of the latter directly, as opposed to copying its WSDL locally within your project, the partnerlinkBindings within your bpel.xml would contian hardcoded WSDL URLs that contain the host, port, domain and revision of your BPEL Processfor e.g.&lt;?xml version = '1.0' encoding = 'UTF-8'?>&lt;BPELSuitcase>&lt;BPELProcess id="ClientProcess" src="ClientProcess.bpel">&lt;partnerLinkBindings>&lt;partnerLinkBinding name="ServerProcess">&lt;property name="wsdlLocation">http://localhost:8888/orabpel/default/1.0/ServerProcess?wsdl&lt;/property>&lt;property name="validateXML">true&lt;/property>&lt;/partnerLinkBinding>&lt;/BPELProcess>&lt;/BPELSuitcase>This poses a problem when you wish to deploy the client and server processes described above into different environments, since the wsdlLocation of the serverProcess differs for each target environment. The brute force way to handle this would be to change the deployment descriptor while performing deployment to each target environment. Alternatively, you could have a separate bpel.xml for each environment. This is cumbersome and error-prone.The solutionThe preferred option would be to have a single deployment descriptor and a single templatized build script that can be executed for each target environment. The product supports this notion through a &lt;customize> ant task, that allows you to customize deployment descriptor properties like partnerlinkBindings.The approachFollow the steps mentioned below, in order.a) Navigate to the $ORACLE_HOME/bpel/utilities directory.b) Create copies of ant-orabpel.properties namely ant-orabpel_dev.properties, ant-orabpel_test.properties and ant-orabpel_prod.properties. These names are arbitrarily chosen to reflect properties for dev, test and prod environments. You could specify the names you wish. c) Specify the host, port, domain and default revision parameters in each of the three [or n] new properties file.for e.g. the following tokens could be added to the ant-orabpel_dev.properties# custom tokenshost_name=devserver.yourcompany.comport_number=8888domain_name=defaultwhereas the following tokens could be added to the ant-orabpel_test.properties.# custom tokenshost_name=testserver.yourcompany.comport_number=7777domain_name=loanRequestSimilary, specify the tokens for each environment where you wish to deploy to, in the appropriate ant_orabpel_&lt;env>.properties. d) Now go to each of your BPEL Projects.e) Copy and paste the build.xml in your project directory into the bpel subdirectory.f) Navigate to the bpel subdirectory, and open up the new build.xml and perform the following changes.i) Navigate to the &lt;compile> target.The compile target should look like&lt;target name="compile">&lt;echo>--------------------------------------------------------------| Compiling bpel process ${process.name}, revision ${rev}--------------------------------------------------------------&lt;/echo>&lt;bpelc input="${process.dir}/bpel/bpel.xml" out="${process.dir}/output"rev="${rev}" home="${bpel.home}"/>&lt;/target>Change it to have your templatized partnerlinkBindings.&lt;target name="compile">&lt;echo>--------------------------------------------------------------| Compiling bpel process ${process.name}, revision ${rev}--------------------------------------------------------------&lt;/echo>&lt;bpelc input="${process.dir}/bpel/bpel.xml" out="${process.dir}/output"rev="${rev}" home="${bpel.home}">&lt;customize>&lt;partnerLinkBinding name="ServerProcess">&lt;property name="wsdlLocation">http://${host_name}:${port_number}/orabpel/${domain_name}/ServerProcess/${rev}/ServerProcess?wsdl&lt;/property>&lt;/partnerLinkBinding> &lt;/customize>&lt;/bpelc> &lt;/target>This customize ensures two things at compile-time.1) Overrides the specific partnerlinkBindings mentioned in the deployment descriptor.2) Performs token replacements in the partnerlinkBindings based on token values defined in the ant-orabpel.properties. [or specific properties files that are imported into the build.xml]Note that you could define your own build.properties or ant-orabpel.properties anywhere in your file system. You would just need to import them in yout build.xml. If two properties file define the same token,the one that is defined first in document order takes precedence.g) While deploying to the "dev" environment, you might want to refer to the ant-orabpel_dev.properties, whereas while deploying to "test", you might want to refer to ant-orabpel_test.properties. to ensure that you can specify these dynamically from command line, while running the ant task, perform the following step.Navgiate to the following line in the build.xml.&lt;!-- Use deployment related default properties -->&lt;property file="${bpel.home}/utilities/ant-orabpel.properties"/> Change it to the following.&lt;!-- Use deployment related default properties -->&lt;property file="${bpel.home}/utilities/ant-orabpel_${env}.properties"/> h) Now navigate to the parent directory and open up the build.xml in the current directory.i) Modify it so that it calls the compile target in the bpel subdirectory, as opposed to the default compile target in the same build.xml.For this, follow the steps mentioned below.1) create a new compile target that redirects execution to the target wirthin the build file within the bpel subdirectory.&lt;target name="compileEnv">&lt;ant dir="${process.dir}/bpel"/>&lt;/target>2) Modify the process-deploy target to invoke this new compile target. i.e. change the following snippet&lt;target name="process-deploy"depends="validateTask, compile, deployProcess, deployTaskForm, deployDecisionServices" />so as to point to the new compile target.&lt;target name="process-deploy"depends="validateTask, compileEnv, deployProcess, deployTaskForm, deployDecisionServices" />j) Thats all! Now you need to invoke the deployment for each environment by going to the developer prompt, navigating to the project directory, and typing in the followingD:BPELBPELProcess1> ant -Denv=dev This will ensure that the ant-orabpel_dev.properties are picked up for token resolution, and appropriate replacements are made from the same.Follow the same steps for other environments. 

Deploying BPEL Processes to multiple environments Overview Oracle BPEL PM 10.1.3.1 provides utility ant scripts that aid in deploying your BPEL Processes to remote BPEL Servers. This allows you the...

Oracle SOA Suite

XML - Dissected

XML is a language used to describe a class of data objects called XML documents. XML documents have both a physical structure and a logical structure. Here is the illustration of the phyiscal structure of an XML document.   As indicated in the diagram, the physical layout of an XML document consists of one or more entities. Each document should have a document entity. An entity may refer to other entities that may result in inclusion of those entities in the document.XML DocumentA data object is an XML document if it is "well-formed". There are several constraints that the data object need to adhere to, in order to be well formed. These are discussed in detail in the XML 1.0 specification. But at the minimum, the document should hold one or more elements within it. The document should have exactly one root element whose content should not appear within any other element. Each element in the document that is not the root should have a parent element. Parsed Entities are those entities that contain character sequences. The characters may either be markup or character data.Characters could be one ofa) Tabb) Carriage Returnc) Line feedd) Unicode characterse) ISO/IEC 10646 charactersOf these, (a), (b), (c) and #x20 are termed as whitespace characters.Markup Markup allows description of the logical structure and the storage of an XML document.Characters used for Markup could take form as one of the following.a) Start tagb) End tagc) Empty element tagd) Entity referencese) Character referencesf) Commentsg) CDATA section delimitersh) Document type declarationsi) Processing Instructionsj) XML declarationsk) Text declarationsl) Whitespace outside of the document element.  Character data All Characters except markup form the Character data in an XML Document. The ampersand and the left angle brackets are not allowed in character data except when used witihn a comment, a PI or a CDATA section.At all other places, these characters have to appropriately escaped using numerical character references or the predefined entity references [for e.g. &amp;]. Entities and entity references are described later in this article.Similarly, apostrpohes and quotation marks have to be used in their escaped representation for use within contents of elements and attributes.XML DeclarationXML Documents should begin the XML declaration that indicates the version&lt;?xml version = '1.0' encoding = 'UTF-8'?>The above declaration instructs the processor to interpret the document according to XML 1.0 specification, and informs it about the character encoding that is in use within the document.Markup declarationsMaybe either of an element type declaration, attribute list declaration, entity declaration, notation declaration, a PI declaration or a comment declaration.For e.g.&lt;!ELEMENT orderDate EMPTY> is an element declaration. These can be defined locally within the XML document as a part of the document type declaration, or within an external subset � a DTD.&lt;!ATTLIST order Id PCDATA "100-001"> is a declaration of an attribute named "Id" for an element name "order". The declaration also indicates that the attribute possesses a default value "100-001". Entity Declarations and ReferencesDo not confuse this with the "Entity" referred to in figure 1. Those entities are just logical representations of the actual physical storage of the XML document.Entities are used for two main purposes.a) To act as a macro �define once and use at multiple placesb) To refer to external resources from within the document, for instance an XML file, a JPG image or a Word document.c) To refer to arbitrary unicode characters within your XML document.(a) are termed as internal entities.(b) are termed as external entities(c) are termed as character entities.An Entity has to be declared before it can be used.The declaration for each of these categories of entities is illustrated below.1. Internal Entity declaration&lt;!ENTITY orgName �Oracle Corporation�>This means that "orgName" is an entity that aliases the string "Oracle Corporation".This entity can be referenced witihn the XML document by prefixing the entity name with a "&" and suffixing it with a semicolon.For e.g.&lt;purchaseOrder>&lt;address>. . &lt;country>&orgName;&lt;/country>&lt;/address>&lt;shipAddress>. . . .&lt;country>&orgName;&lt;/country>&lt;/shipAddress>&lt;/purchaseOrder>2. External Entity declarationExternal entities can be declared to refer to XML text, or binary content.Declarations for entities that contain XML text are declared as&lt;!ENTITY entityName [PUBLIC "publicIdentifier"] SYSTEM "system-identifier".For example, you could include a product catalog XML into your XML document using the following entity declaration.&lt;!ENTITY catalog SYSTEM "http://www.oracle.com/prod/catalog/products.xml" > These kind of external entities are termed as Parsed Entities.For declaring entities containing non-XML data, the declaration should contain a NOTATION that indicates the actual format of the entity.For e.g.&lt;!NOTATION JPG SYSTEM "Joint Photographic Experts Group">&lt;!ENTITY picture SYSTEM "http://www.photos.com/myphotos/me.jpg" JPG"> These kind of external entities are termed as Unparsed Entities.3. Character EntitiesXML 1.0 specification defines 5 pre-defined character entities namely lt, gt, amp, quot and apos.These stand for the characters "&lt;", ">", "&", " and ` respectively.These entities, and for that matter, any character entities, need not be declared separately in your XML document. The following example illustrates references to these entities in an XML document.&lt;description>This is a &lt;tag&gt; &amp; &apos; is an apostrophe&lt;/description>These properties are listed below.For referring to any arbitrary unicode character in your document, you just need to use entity reference for the hex code or the decimal unicode character number.For e.g.&lt;chineseText>&lt;&#x6C34; is a chinese character&lt;/chineseText>Expanded and Unexpanded EntitiesEntity expansion refers to the derefencing of the entity value when it is encountered in the document.When entity declarations in a document contain entity references, those entity references are not expanded until the entity reference to the containing entity is encountered. For example&lt;!ENTITY ramkumar &r;kumar>&lt;!ENTITY r ram>Here "ramkumar" is an unexpanded entity. It contains the entity reference "r". This reference is not expanded until &ramkumar; is encountered in the XML document.On the other hand, Character entities are expanded as soon as they are encountered.Processing InstructionsA Processing instruction allows XML documents to provide instructions for applications that intend to process the document. A processing instruction is not a part of the character data of an XML document.The most common PI that is in use is the XML declaration.&lt;?xml version = '1.0' encoding = 'UTF-8'?>The above processing instructions instructs the processor to interpret the document according to XML 1.0 specification, and informs it about the character encoding that is in use within the document.You could find alternate usages of processing instructions in the XSL Maps that you generate using Oracle Jdeveloper. It would by default contain processing instruction for the Mapper tool on the source and target XSDs for the XSL Map.For e.g.&lt;?oracle-xsl-mapper&lt;!-- SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY. -->&lt;mapSources>&lt;source type="XSD">&lt;schema location="bpel/Input.xsd"/>&lt;rootElement name="inputRoot" namespace="http://xmlns.oracle.com/input"/>&lt;/source>&lt;/mapSources>&lt;mapTargets>&lt;target type="XSD">&lt;schema location="bpel/Output.xsd"/>&lt;rootElement name="outputRoot" namespace="http://xmlns.oracle.com/output"/>&lt;/target>&lt;/mapTargets>&lt;!-- GENERATED BY ORACLE XSL MAPPER 10.1.3.1.0(build 061009.0802) AT [TUE JUN 26 11:27:36 PDT 2007]. -->?>Document Type DeclarationDeclares or gives pointers to the definition of markup declarations in the XML Document. This definition of the grammar is termed as "document type definition" or DTD.The DTD can be local or external [or both together ]to the XML document.For e.g.&lt;?xml version="1.0"?>&lt;!DOCTYPE purchaseOrder SYSTEM "po.dtd">&lt;purchaseOrder>. . . . &lt;/purchaseOrder>indicates that the element purchaseOrder is defined at the DTD at the URI "po.dtd".whereas&lt;?xml version="1.0"?>&lt;!DOCTYPE purchaseOrder [&lt;!ELEMENT purchaseOrder (shipTo|billTo|customer)>. . . . . ]>&lt;purchaseOrder>. . . . &lt;/purchaseOrder>contain local markup declarations. &lt;?xml version="1.0"?>&lt;!DOCTYPE purchaseOrder SYSTEM "po.dtd"[&lt;!ELEMENT purchaseOrder (shipTo|billTo|customer)>. . . . . ]>&lt;purchaseOrder>. . . . &lt;/purchaseOrder>contains both internal and external markup declarations. For instance, one of the elements within the purchaseOrder could be defined in the dtd "po.dtd" [termed as the external subset], whereas others, for instance, "shipTo" and "billTo" could be declared in the internal subset, i.e. local to the document.Standalone Document declarationThe Document can be declarared to be a standalone XML document if the document does not depend on any external subset [an external DTD] to resolve the declarations for any of the objects defined within the XML document. In other words, the processor of the XML document need not worry about processing any external subsets to process the XML document.The standalone document declaration is performed as a part of the XML declaration PI.i.e.&lt;?xml version="1.0" standalone="yes|no">The XML specification lists four cases where the processor needs to lookup declarations in an external subset.a) Attributes may have default valuesConsider an XML document that contains an element named shipInfo. The shipInfo element is defined to possess an attribute named orderDate. &lt;?xml version="1.0" standalone="no"?>&lt;purchaseOrder>&lt;shipInfo>. . . &lt;/shipInfo>&lt;/purchaseOrderIf you take a close look at the XML above, the shipInfo element does not possess such an attribute, even though the declaration says so. That�s fine too, since attributes need not occur in the document, even if the elements are defined to possess one or more. But what if the attribute declaration defined a default value for orderDate? In this case, the parser needs to lookup the definition of the attribute to obtain the default value for the attribute while processing the document. If the declaration of the attribute and the defaulting is defined at an external subset, then the standalone attribute value should indicate "no" to serve as an instruction to the processor.b) Resolve Entity references in an external subsetThe XML document could be referring to entities that had been declared in the external subset. c) Perform Attribute value NormalizationIf the normalization of an attribute value requires resolution of an entity declared in an external subset. Normalization is a process followed by the XML processor before the value can be validated. This process involves the following steps.i) Perform end-of-the-line handling � which involves replacing all carriage return and immediately following line feed characters into a line feed character.ii) Perform in-place replacement of all character entity references.iii) Perform resolution of all entity references in the attribute value. The entity itself could be defined in the internal or external subset.iv) Replace all whitespace, linefeed, carriage return and tab characters with a single whitespace character.d) Elements with Element-only contentIf the XML document contains element types with element-only content.i.e. the element contains child elements that are of element type, optionally separated by whitespace characters.This has an interesting significance.You can notice whitespace content between endTags and startTags of elements, in an XML document. The element could have been defined to be &lt;!ELEMENT order (PCDATA|shipTo|billTo|customer)*>or&lt;!ELEMENT order (shipTo|billTo|customer)*>In the former case, the whitespaces should not be ignored � they should be passed as is, to the processor. In the latter case, they should be ignored.To indicate that the processor needs to consider the whitespaces, the document modeler could indicate that the document is not standalone, by adding the declaration on the XML declaration PI. Further, this is only necessary if the element declaration is in an external subset.  XML Information SetAn XML Information Set also termed as the Infoset is used to describe well-formed XML Documents. It does so by defining a logical data model for an XML document. The logical data model is achieved through an abstract data set containing information items that describe different portions of the XML document. An infoset is usually obtained by parsing an XML Document according to the rules of the specification. On the flip side, XML can be considered as a serialized form of the logical structure defined by the Infoset. But an XML may not be the only possible serialized representation of the Infoset. In summary, an Infoset shields serialization syntax from the logical model. Foor instance, an Infoset could be serialized into a binary XML format that has a different syntax from a serialized XML 1.0 document.Although building an Infoset requires the XML to be well formed, it may not necessarily be a valid XML document. For instance, the XML may possess broken external entity references, or possess undeclared elements or attributes. None of these prevent the XML document from possessing an Infoset. For e.g., the following XML document has an Infoset, even though it is not a valid document.&lt;?xml version="1.0"?>&lt;price>This is not a number�&lt;/price>But the following is not a well-formed XML document, and hence cannot possess an infoset.&lt;?xml version="1.0"?>&lt;Start>textContent&lt;/SomeOtherNode>Similarly, an XML document that is not namespace-well-formed cannot possess an Infoset. The notion of namespace well formedness is described in detail within the W3C recommended specification - Namespaces in XML 1.0 [Second Edition]For e.g.&lt;?xml version="1.0"?>&lt;root>&lt;this is not a valid node name>foobar&lt;/this is not a valid node name>&lt;/root>is not a namespace well-formed document, since the node name does not conform to the NCName production.XML Information Sets are typically used within other specifications that need to refer to information in an XML document. For this purpose, the Infoset provides a consistent set of definitions for different information that can appear in the document.An information item is an abstract description of a specific item in an XML document.It may contain one to eleven number of information items as explained below. At the minimum, the Infoset contains the Document Information Item that contains exactly one Element Information item.The 11 information items are listed below.a) The Document Information Itemb) Element Information Itemsc) Attribute Information Itemsd) Processing Instruction Information Itemse) Unexpanded Entity Reference Information Itemsf) Character Information Itemsg) Comment Information Itemsh) The Document Type Declaration Information Itemi) Unparsed Entity Information Itemj) Notation Information Itemsk) Namespace Information ItemsEach information item is attached with a set of properties. An illustration of the properties of the Document Information item and the Element information Item is given below. For a complete list of properties, refer to the XML Information Set specification.Properties of the Document Information Item1) Children �an ordered list of child information items. The list contains exactly one element information item termed as the "root". It could also contain exactly one Doctype declaration information item, and one more comment information items. The list of childrent does not include the PIs and comments within inline DTDs.2) Document element � an element informaiton item, commonly referred to as the root.3) Notations4) Unparsed entities5) Base URI6) Character encoding scheme7) Standalone8) Version9) All declarations processed Properties of the Element Information Item1) Namespace name2) Local Name3) Prefix4) Children5) Attributes6) Namespace attributes7) In-scope Namespaces8) Base URI9) ParentAll of the properties should have been clear from the earlier sections, except for "Base URI". The latter is explained below.Base URIsThe notion of base URIs originated from HTML, where designers use the HTML &lt;base> tag to indicate the base URI to be used while resolving any other relative URIs used in the web page, rather than using the current document�s URI.For instance, a web page at http://publicdocs.com/rammenon/index.html" may have the following content.&lt;HTML>&lt;HEAD>&lt;BASE href="

XML is a language used to describe a class of data objects called XML documents. XML documents have both a physical structure and a logical structure. Here is the illustration of the phyiscal structure...

Namespaces

Handling No Namespace Schemas within your BPEL Processes

There could be cases where you might end up referring to unqualified elements/attributes in yout BPEL Processes. Unqualified means that the elements/attributes are defined in null/no namespace. These elements could be defining messageTypes in your process WSDLs, or referred to within BPEL assign activities or XSL Transformations. For handling these use-cases, the following approach is suggested. The approach is explained in the following sub-sections. a) Declaring a WSDL message referring to an unqualified element or type WSDL Message Parts refer to elements or types through an  element or  type attribute. These attributes are of a xsd:QName datatype. For e.g. <definitions xmlns=" http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.loan.com/"> . . . . <types> <xsd:schema targetNamespace="http://www.oracle.com/"> xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:import namespace="http://www.loan.com/" schemaLocation="LoanRequest.xsd"/> <xsd:import namespace="http://www.response.com/" schemaLocation="LoanResponse.xsd"/> </types> <message name="LoanServiceRequestMessage"> <part name="payload" element="tns:LoanRequest"/> </messageType> </definitions> Few things are worth noting here. The wsdl components [messageType, part etc] are defined in the namespace "http:schemas.xmlsoap.org/wsdl/" , that is defined to be the default namespace using the "xmlns" attribute on the <definitions> root element of the wsdl. Default namespace URI is the umbrella for all unprefixed global declarations in the document. The message part in this case points to a qualified element named "LoanRequest" that is defined in the namespace http://www.loan.com/ aliased by the prefix "tns". Coming to the point, if the LoanRequest is defined in a null/no namespace, then the WSDL document needs to undergo a few changes. The following are the list of things that need to be considered while making changes. a) Unqualified elements are always unprefixed. You cannot have a prefix that resolves to a null namespace URI. b) If a default namespace declaration is specified on the document, then all unprefixed nodes shall resolve to the default namespace. If there are null namespace components that need to be referred, then there should not be a default namespace declaration in the document, as a result of point (a) above. c) Prefixed namespace declarations cannot declare a null namespace URI., i.e., you cannot define xmlns:ns1="" in your document Applying these rules on the WSDL document, we need to a) Remove the xmlns=http://schemas.xmlsoap.org/wsdl/ from the <definitions> element. b) Now that there is no default namespace, we need to explicitly prefix all the wsdl components like definitions, message, types etc. You need to define a prefix lets say xmlns:wsdl on the definitions element, and explicitly prefix all wsdl components including <definitions> with the <wsdl:?> prefix. c) The element/type attribute of the message part now needs to point to the unprefixed element/type reference. I.e. in this case, it would be</DIR></DIR>  <wsdl:definitions xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/" > . . . . <wsdl:types>   <xsd:schema targetNamespace="http://www.oracle.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">     <xsd:import schemaLocation="LoanRequest.xsd"/>     <xsd:import namespace=http://www.response.com/" schemaLocation="LoanResponse.xsd"/>    </xsd:schema>  <wsdl:types> <wsdl:message name="LoanServiceRequestMessage">    <wsdl:part name="payload" element="LoanRequest"/> <wsdl:message> </wsdl:definitions> b) Handling unqualified elements within BPEL Assigns/XSLTs In exactly the same way as mentioned above, you need to explicitly prefix all BPEL components using the bpws prefix, and remove the default namespace declaration from the BPEL document. Then proceed to refer to any unqualified elements without using a prefix. The same applies for XSLT. Do not explicitly declare a default namespace in the XSLT. Refer to all unqualified elements without using a prefix. There is a slight difference in the way our JDev designer generates code for BPEL and XSLT. BPEL designer generates all BPEL components in the default namespace, whereas XSLT mapper does not define a default namespace. Hence, you need to explicitly change the source code to remove the default namespace declarations and add the prefixed references to all bpel components like <bpws:assign>, <bpws:process>, <bpws:invoke> etc, just as you would have done for the WSDL. After you make these changes, things will look good. But the bad part is that if you add a new variable/activity etc into the BPEL using the design view, BPEL designer again adds a default namespace declaration, and adds the entity in the default namespace. i.e. <variable name=".."/> In this case, you need to re-edit the source code to remove the default namespace declaration, and would need to explicitly prefix the activity using a prefix.

There could be cases where you might end up referring to unqualified elements/attributes in yout BPEL Processes. Unqualified means that the elements/attributes are defined in null/no namespace.These...

Oracle SOA Suite

Result Tree Fragments and Node-Sets

When you use an XML fragment to initialize a variable or a parameter, then the variable or parameter is of the   "result tree fragment" datatype. This is an XSLT 1.0 specific datatype [just like node-set, but slightly different].   A result tree fragment is equivalent to a node-set that contains just the root node.   You cannot apply operators like "/", "//" or predicate on a result tree fragments. They are only applicable for node-set datatypes.   Typically,when you perform a "select" in XSLT, what you get is a node-set.    For instance,    <xsl:variable name="countryNames" select="/tns:Countries/tns:Country"/>   means that the variable countryNames contains a node-set of "Country" nodes. You can apply operators like "/" on this variable, for instance    <xsl:for-each select="$countryNames/@name">     . . .    </xsl:for-each>   But you cannot perform this kind of an operation on a result tree fragment.   There are two ways to solve this issue. a) In XSLT 1.0 The resolution of this is to convert the result tree fragment into a node-set. I am not aware of any oracle specific xpath extension functions that can do this trick for you. You could use EXSLT to achieve this. EXSLT provides some very useful extensions to XSLT.They have defined an extension function node-set() that converts result tree fragments into node-sets. Alternatively, you could also write your own java routine to convert between result tree fragments and node-sets.  I am an XSLT with the EXSLT xpath function for your reference.  Note the namespace declaration for exsl, and the function usage. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:p1="http://example.org" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl"> <xsl:param name="param1">   <FileList>     <File Name='a' valid='true' automated='false'/>     <File Name='b' valid='true' automated='false'/>     <File Name='c' valid='true' automated='false'/>     <File Name='d' valid='true' automated='false'/>     <File Name='e' valid='true' automated='false'/>     <File Name='f' valid='true' automated='false'/>   </FileList> </xsl:param> <xsl:template match="/">   <ExternalAccess>     <Query>         <Parameters>             <xsl:for-each select="exsl:node-set($param1)/FileList/File">                 <xsl:variable name="secondary" select="."/>                 <RetrievedFile>                     <xsl:attribute name="Name">                         <xsl:value-of select='@Name'/>                     </xsl:attribute>                     <xsl:attribute name="valid">                         <xsl:value-of select='@valid'/>                     </xsl:attribute>                     <xsl:attribute name="automated">                         <xsl:value-of select='@automated'/>                     </xsl:attribute>                 </RetrievedFile>             </xsl:for-each>         </Parameters>     </Query>   </ExternalAccess> </xsl:template> </xsl:stylesheet> b) Use XSLT 2.0 You can code your transformations in XSLT 2.0.  XSLT 2.0 deprecates ResultTreeFragments i.e. if you are modeling an XSLT 2.0 transformation, and you create a variable or a parameter that holds a tree fragment, it is implicitly a node sequence. You could then use path expressions against these variables and parameters. To make your transformations executed by an XSLT 2.0 processor, simply change the "version" attribute on the &lt;xsl:stylesheet> to "2.0". With this approach, you can use the select expression "$param1/FileList/File" to iterate over the File elements witihn the XSLT parameter. Here is the XSLT 2.0 code for this approach. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:p1="www.example.org"> <xsl:param name="param1"> <FileList> <File Name='a' valid='true' automated='false'/> <File Name='b' valid='true' automated='false'/> <File Name='c' valid='true' automated='false'/> <File Name='d' valid='true' automated='false'/> <File Name='e' valid='true' automated='false'/> <File Name='f' valid='true' automated='false'/> </FileList> </xsl:param> <xsl:template match="/"> <ExternalAccess>       <Query>             <Parameters>                 <xsl:for-each select="$param1/FileList/File">                        <xsl:variable name="secondary" select="."/>                                <RetrievedFile>                                        <xsl:attribute name="Name">                                            <xsl:value-of select='@Name'/>                                        </xsl:attribute>                                        <xsl:attribute name="valid">                                            <xsl:value-of select='@valid'/>                                        </xsl:attribute>                                        <xsl:attribute name="automated">                                            <xsl:value-of select='@automated'/>                                        </xsl:attribute>                                  </RetrievedFile>                 </xsl:for-each>       </Parameters>   </Query> </ExternalAccess> </xsl:template> </xsl:stylesheet>

When you use an XML fragment to initialize a variable or a parameter, then the variable or parameter is of the   "result tree fragment" datatype. This is an XSLT 1.0 specific datatype [just like...

Oracle SOA Suite

Passing BPEL Variable contents into XSLT as Parameters

Here is an interesting solution for passing content of BPEL variables into XSL Transformations as XSL Parameters.XSL is executed using the XPath Extension Function ora:processXSLT. The two arguments for this extension function are as follows.1) The XSL File Name2) The source variable to be transformed [bpws:getVariableData(...)]But there is one more argument that this XPath function can accept - 'properties'.Note the signature of this function specified in xpath-functions.xmlSignature:  ora:processXSLT('template','input','properties'?).These properties translate to XSL Parameters that can be accessed within the XSL Map using the construct &lt;xsl:param name="&lt;paramName>"/>You can retrieve the value of this parameter within your XSLT in a way similar to the way used to extract data from XSL variables.For e.g.  &lt;Name>&lt;xsl:value-of select="$param1"/>&lt;/Name>  The "properties" argument of the XPath function is expected to be an XML Element that has the following structure.Illustrated below is an example of such a properties XML.&lt;parameters xmlns:ns2="http://schemas.oracle.com/service/bpel/common" xmlns="http://schemas.oracle.com/service/bpel/common">  &lt;ns2:item>    &lt;ns2:name>userName&lt;/ns2:name>    &lt;ns2:value>ramkmeno&lt;/ns2:value>  &lt;/ns2:item>  &lt;ns2:item>    &lt;ns2:name>location&lt;/ns2:name>    &lt;ns2:value>CA&lt;/ns2:value>  &lt;/ns2:item>&lt;/parameters>Within the XSLT, the parameters are accessible through their names. [in this case, the parameter names are "userName" and "location", and their values are "ramkmeno" and "CA" respectively.Approach1) Declare a variable that is of the abovementioned dataType [see XML above.]2) Populate the variable with the contents of the BPEL variable you wish to pass into the XSLT3) Invoke processXSLT() with the XSL File, source variable, and the parameters variable.4) Access the parameter contents within the XSLTExampleBPEL Snippet&lt;!--Step 1: initialize the parameters variable from whatever BPEL variable whose information you need to access from within XSLT -->&lt;assign name="initializeXSLParameters">    &lt;bpelx:annotation>      &lt;bpelx:pattern>transformation&lt;/bpelx:pattern>    &lt;/bpelx:annotation>    &lt;copy>      &lt;from expression="ora:processXSLT('SetParams.xsl',                bpws:getVariableData('inputVariable','payload'))"/>     &lt;to variable="propertiesXMLVar"/>   &lt;/copy>&lt;/assign>&lt;!--Step 2: Invoke the XSLT with the parameters as the third argument -->&lt;assign name="executeXSLT">    &lt;bpelx:annotation>      &lt;bpelx:pattern>transformation&lt;/bpelx:pattern>    &lt;/bpelx:annotation>    &lt;copy>       &lt;from expression="ora:processXSLT('TestXSLParams.xsl',            bpws:getVariableData('inputVariable','payload'),            bpws:getVariableData('propertiesXMLVar'))"/>       &lt;to variable="outputVariable" part="payload"/>   &lt;/copy>&lt;/assign>XSLT Snippet&lt;xsl:stylesheet version="1.0" ....>  &lt;xsl:param name="userName"/>  &lt;xsl:param name="location"/>  &lt;xsl:template match="/">    &lt;ns1:TestXSLParamsProcessResponse>      &lt;ns1:result>        &lt;xsl:value-of select="concat('User : ', $userName, ' Location : ',$location)"/>      &lt;/ns1:result>    &lt;/ns1:TestXSLParamsProcessResponse>  &lt;/xsl:template>&lt;/xsl:stylesheet>Output&lt;TestXSLParamsProcessResponse xmlns:ns1="http://xmlns.oracle.com/TestXSLParams" xmlns="http://xmlns.oracle.com/TestXSLParams">  &lt;ns1:result>User : ramkmeno Location : CA&lt;/ns1:result>&lt;/TestXSLParamsProcessResponse>

Here is an interesting solution for passing content of BPEL variables into XSL Transformations as XSL Parameters.XSL is executed using the XPath Extension Function ora:processXSLT. The two arguments...

Oracle

Integrated Cloud Applications & Platform Services