Sometimes we come across situations like BPEL receives an XML without any target namespace defined it and BPEL has to transform it to different format. Assume that the XML it receives is generated by third party application which is not in our control.Given this scenario we have no option of changing source input XML but we have to change the BPEL code to work with XML payload without name space associated with it.By default BPEL always works with payloads which has name space associated with it.
Brief steps to achieve this
- Remove target namespace attribute from xsd which is modelled to validate incoming xml
- Keep default namespace attribute in xsd
- Remove any namespace prefixes pointing to xsd default namespace from xsl file
Assume that BPEL receives below xml as input
<invoices>
<invoice>
<invoiceNumber>1234 </invoiceNumber>
<partNumber>AELWF</partNumber>
</invoice>
</invoices>
By default BPEL generates below xsd to represent above xml
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org"
targetNamespace="http://www.example.org"
elementFormDefault="qualified">
We need to remove targetNamespace from above xsd
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org"
elementFormDefault="qualified">
Remove any namespace prefixes in xsl files.
Now we can deploy BPEL process
There might be many other ways to achieve this, but I feel this approach is simple.
Perfect thanks! :)
ReplyDeletewhat about the wsdl that refers to the schema and what happens if it is the process xsd and wsdl?
ReplyDelete