Monday, 29 January 2007

Using nested Schemas within BPEL

When developing any BPEL based solution, you soon find that you are defining a common set of data objects that are used across multiple processes.

The most obvious place to define those data objects is in one or more XML Schemas which can then be referenced by each of your BPEL Processes.

Oracle BPEL PM 10.1.3 now provides the ability to import these Schemas as part of the BPEL Project Creation Wizard (in previous versions you had to import the Schema after the project was created – which you can of course still do in 10.1.3).

This all works very well, however there is a simple gotcha, that I’ve seen catch out a number of people, and that’s when you import schema’s which themselves import schemas.

Let’s take a simple example. A common scenario is to have a schema which defines common objects such as address, phoneNo, etc. This would be shared across multiple domain specific schemas such as customer (e.g. it imports the common schema to use the address, phoneNo type to hold the equivalent information for a customer).

Now, if were to import the customer schema into our BPEL Process, by default all we are importing are the definitions contained in Customer.xsd. This causes problems when we attempt to parse the customer schema as the parser can’t reference the definitions in the common schema.

The obvious answer here is to simply import the common schema as well. However this doesn’t work. To understand why let’s look at the import statements created in the <types> element of the WSDL file for the BPEL process:



The issue here is that each of the schemas has been imported into a “separate” schema, thus the common schema is not visible to the customer schema. However to fix this you simply edit the WSDL file to combine the imports into a single schema as illustrated below:

4 comments:

nikhil said...

your latest blog on recursion is great, but i have one question. How i will model EXIT command of PL/SQL in BPEL. this is essential if i need to come out of loop at a specific time; and secondly, do i have some thing ASCII function in BPEL. i couldn't find one??

workwest said...

I am facing a problem about the schema in BPEL process.
The schema is imported to the BPEL in the wsdl file and as you show in your example in the type section.

My question is that:
Is it some way that you can import your schema dynamically depended on where you deploy your services(test,development and production).
I would like to point to the different schema when I am deploying. I have already solution for how to deploy to the different environment with dynamically partnerlink and end point.
I hope somebody and give me some tips ..

amrita said...

hi Matt,

I am trying to import wsse xsd schema from http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd.

I am able able to do so also but i am getting WSDL compilation error.

Can u please help.

the error is :

Error:
[Error ORABPEL-10902]: compilation failed
[Description]: in "bpel.xml", XML parsing failed because "undefined part element.
In WSDL at "file:/C:/JDeveloper/jdev/mywork/CC&B/q/bpel/q.wsdl", message part element "{http://xmlns.oracle.com/q}qProcessResponse" is not defined in any of the schemas.
Please make sure the spelling of the element QName is correct and the WSDL import is complete.
".
[Potential fix]: n/a.

------------------

here q.wsdl is the wsdl of the BPEL project in which i am importing wsse schema

amrita said...
This comment has been removed by the author.