Testing your service with the BPEL console

Using default XML input

Have you ever tested a BPEL process through the BPEL console and had to replace the given XML input data with your actual data over and over again? After a while you can really become a copy&paste maniac. It was quite a relief when I found out that you can easily define a default input for your process test.

Open the bpel.xml file of your project. It contains something like:

<?xml version = '1.0' encoding = 'UTF-8'?>
<BPELSuitcase>
   <BPELProcess id="searchShipyard" src="searchShipyard.bpel">
      <partnerLinkBindings>
         <partnerLinkBinding name="searchShipyard">
            <property name="wsdlLocation">searchShipyard.wsdl</property>
         </partnerLinkBinding>
      </partnerLinkBindings>
   </BPELProcess>
</BPELSuitcase>

In front of the closing </BPELProcess> tag insert the following code snipplet:

<configurations>
   <property name="defaultInput"><!&#91;CDATA&#91;
     --> Here goes your actual process input data and yes, this has to be XML <--
        &#93;&#93;></property>
</configurations>

After re-deplyoing your process go to your BPEL console, open the Dashboard, click on the link to your process and you should find your XML data as proposed process input.

Trust is a good thing, but verification sometimes is better…

If you’re using complex schemas with different namespaces in combination with imports/includes in your WSDL it is likely possible that the suggested XML input for testing your web service is a fraud. Somehow the BPEL process manager seems to get confused by nested namespaces.

Let me give you an an example to show what might happen. The following XML input was suggested in the BPEL console:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body xmlns:ns1="http://firefly.de/fly">
        <fly:FlightHeader xmlns:ns2="http://nostromo.de/nst">
            <ns2:SearchArgument>
                <ns2:Condition>active</ns2:Condition>
            </ns2:SearchArgument>
        </fly:FlightHeader>
    </soap:Body>
</soap:Envelope>

… but should have been something like:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header/>
    <soap:Body xmlns:nst="http://nostromo.de/nst" xmlns:voy="http://voyager.de/voy" xmlns:fly="http://firefly.de/fly">
        <nst:shipSearchRequest>
            <nst:SearchArgument>
                <voy:Condition>active</voy:Condition>
            </nst:SearchArgument>
        </nst:shipSearch>
 	<fly:FlightHeader>
 		<fly:Creator>ake</fly:Creator>
 	</fly:FlightHeader>
    </soap:Body>
</soap:Envelope>

Therefore my advice would be to always make sure that you are sending XML according to the respective WSDL and not to trust the BPEL console to much…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: