Wednesday, January 21, 2009

hostname with and without domain name issue

Why I write this?

The reason why I write this is as I faced this.
Some kind of a behaviour that I have never seen to known, but yes I did find this.

What did I see?

I was happy developing my BPEL process. everything looks cool and alright.
Now I had BPEL process A and B.

A was calling process B
B was developed happily and deployed

Started developing A, this is when I see this strange error
When I tried to create a partner link for B from the service explorer in partner link wizard
"The WSDL could not be located" error was displayed in the wizard

How can that be?

Yes how can this be, I was actually using the service explorer and making my way to B and selecting it and still WSDL not discoverable
What stupidity, how can this be?

What does the partner link actually not like?

Well, what I found is this. The URL for webservice was causing the issue. The wonderful hostname.

The URL from service explorer did not have the domain name in the hostname.
When I added the domain name there in the WSDL location, the WSDL was working alright.

Strage aint it.

What was the other issue?

The WSDL was alright, but there was some thing else that broke.
When I tried to deploy A it came back with the following error.

Error:
[Error ORABPEL-10902]: compilation failed
[Description]: in "bpel.xml", XML parsing failed because "undefined part element.
In WSDL at "http://hostname.domainname:portnumber/orabpel/domain/B/B?wsdl", message part element "{http://schemas.xmlsoap.org/ws/2003/03/addressing}MessageID" 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.


What does the error mean?

When I opened up the WSDL from BPEL console I saw this.
The WSDL from BPEL console was looking like this http://hostname:portnumber/orabpel/domain/B/B?wsdl
With out the domain name.

Also when I opened the WSDL, the ws-addrressing was like this
<schema>
<import namespace="http://schemas.xmlsoap.org/ws/2003/03/addressing" schemaLocation="http://domainname:portnumber/orabpel/xmllib/ws-addressing.xsd"/>
</schema>


The domain name was missing from the import.

What does this mean?

As the domain was missing the server could not locate the import from ws-addressing.
And the namespace that was present right at the taop was
xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing"
wsa was refering to wsa:RelatesTo, wsa:MessageID and wsa:ReplyTo
All these should be failing one by one in trial to deploy to the server the BPEL process that tries to partnerlink B.

How to fix this?

The fix is as simple as changing the WSDL to have the complete domain name in hostname.

But how to do that?

The change is as simple as this.
Open up the file ${OracleAS_Home}\bpel\system\config\collaxa-config.xml

Change the following
Property name soapServerUrl

<property id="soapServerUrl">
<name>BPEL soap server URL</name>
<value>http://hostname:portnumber</value>
<comment>
<![CDATA[This URL is published as part of the SOAP address of a process in the WSDL file.<p/> The hostname and port for this URL should be customized to match the hostname of your system and the port of your HTTP gateway.]]>
</comment>
</property>

To
<property id="soapServerUrl">
<name>BPEL soap server URL</name>
<value>http://hostname.domain:portnumber</value>
<comment>
<![CDATA[This URL is published as part of the SOAP address of a process in the WSDL file.<p/> The hostname and port for this URL should be customized to match the hostname of your system and the port of your HTTP gateway.]]>
</comment>
</property>

Also change similarly in the next property
soapCallbackUrl

What caused the problem?

During install the hostname file had the server host name before the hostname with domain name causing all this error.
So be sure to install with care and check the host file before install. Even if you break it, you are sure now how to fix this, aint you!!

Tuesday, January 06, 2009

BPEL 10.1.3.4 Deployment Framework

Why I want to write this?

I wanted to find some quick start material for using BPEL deployment framework in 10.1.3.4
Damn I could not find any. Nothing that looked like a quick start thing.
And the worst part was the closest I could find was oracle documentation about it.

At least I could not google any thing even close
But neither of them helped me quick start like a quick list of things to do. :(

I hope this post comes up in google for the help of those who want it.

What is the first thing to do?

The first thing to do is edit your build.xml file
If you open up your BPEL project you will find that in Folder called Resources
If you are looking in the actual physical folder then you will find this in ${process.dir} (the bpel ant terminology)
Basically the top project folder where you find your jpr file.

Why build.xml first?

Fundamentals first, as you are going to use ant to perform deployment automation, you need to edit the build.xml file that ant uses.

Do what in build.xml?

You need to include the ant things that oracle has come up with.
Basically it has 4 things new
generateplan - to generate a brand new plan for you, isn't that cool
attachplan - to attach the plan to your jar while deplyoing
validateplan - to validate the plan, use for developement purpose only and disbale in PROD
extractplan - to extract the plan out from your jar file

Down to business in build.xml

how the hell to use these.
First things first. You need to create plan file as a starting point.
generateplan is the good thing that help you do this.

Stick this piece of code before the </project>

<target name="generateMyPlanFromProjectFile">
<generateplan planfile="${process.dir}/MyPlanFile.xml" verbose="true"
overwrite="true" descfile="${process.dir}/bpel/bpel.xml"/>
</target>


What this does is, generate a file called MyPlanFile.xml in your ${process.dir}

If you want to generate the plan file from jar file, you can stick this piece there as well.

<target name="GenerateMyPlanFromSuitcaseFile">
<generateplan planfile="${process.dir}/MyPlanFile.xml" verbose="true"
overwrite="true"
suitecase="${process.dir}/output/bpel_${BPELSuitcase.BPELProcess(id)}_${rev}.jar"/>
</target>

What this does is, generate the plan fuile from jar file.
Here the use of some things like ${rev} etc can found some where below in build.properties
For now just know that this will pick the correct jar

Basically stick both the pieces there.

If you have not yet complied to generate the jar, do not be surprised to see the GenerateMyPlanFromSuitcaseFile fail

What the hell do I do with this generateplan thing....

Well what else but run as ANT
Right click the build.xml in Jdeveloper, Open up Run Ant Target
Choose generateMyPlanFromProjectFile

JDeveloper should fire up and generate a file for you called MyPlanFile.xml
If you are not able to see that in Resources folder (same place where the build.xml is located) click refresh mate and you should see it

Congrats you have completed the first step easily

Changes in build.properties file

There is a file called build.properties in the same good old folder ${process.dir}
Open that up and see 2 properties called domain and rev
These are commented out by default

uncomment them and change them as below
#if domain name is "commmon" then type in common domain = ${enter the name of the domain yoiu want to deploy}
#if revision is 2.0 then type in 2.0 rev = ${version number of the bpel process}

Good with all this but where is the search and replace thing


Open up the MyPlanFile.xml and you should see some thing there.
Some thing like wsdlAndSchema

There is a element called search and replace

Need to fill this up to search and replace. Read the documentation to find how all to use it. This is the easy part aint it!! Just fill in some strings to test your code.

How to attach the plan

Stick this thing into the build.xml file

<target name="AttachMyPlan">
<echo> -------------------------------------------------------------- | Attaching the plan file ------------------------------------------------ </echo>
<attachplan planfile="${process.dir}/MyPlanFile.xml" verbose="true"
overwrite="true"
suitecase="${process.dir}/output/bpel_${BPELSuitcase.BPELProcess(id)}_${rev}.jar"/>
</target>

What this does is attach the plan file to your jar.

What about extract plan

I am not sure if you want this or not, but here is the piece of code

<target name="ExtractMyPlan">
<extractplan planfile="${process.dir}/MyPlanFile.xml" verbose="true"
overwrite="true"
suitecase="${process.dir}/output/bpel_${BPELSuitcase.BPELProcess(id)}_${rev}.jar"/>
</target>

Ya ya I know that you know what this does.

Now what else?

The last part, add the new target you added to the default target process-deploy

In the depends part of &lttarget name="process-deploy"
Add the target AttachMyPlan after complie

So the new target will look like

<target name="process-deploy"
depends="validateTask, compile, AttachMyPlan, deployProcess, deployTaskForm, deployDecisionServices"/>

Why Am I not adding the generateplan thing in there

Well you do not want to generate the plans always and over write the search and replace that you have read form the documentation and build

If you did then do not be surprised but only thing is I will be laughing ha ha ha :)

How to deploy to other Environments

Well that is for you to discover and explore
Just that you need to run this in dev prompt. Go to the same old ${process.dir} directory and run the ANT as
command promt>ant process-deploy

Congrats mate you have done it.
There are other few things that you can learn from the documentation if you are interested at all

Links that I liked

I could hardly google a lot of stuff for this.
The best is oracle documentation
http://download.oracle.com/docs/cd/E12524_01/relnotes.1013/e12523/bpelrn.htm#BABCEBAA

The next best I could find was
http://blogs.oracle.com/reynolds/2008/11/bpel_deployment_framework.html