Monday, December 10, 2012

Stuck: cannot undeploy SOA composite

You ever run into the problem that you cannot redeploy or even undeploy an SOA composite? It can be frustrating. The most common reason is that the composite references an URL doesn't exist anymore. I think it's almost "stupid" to require that a composite referenced URL to exist when you need to undeploy a composite, come on, i don't even want the composite anymore, why do i care if it references a non-existent URL.

Anyway, here is a sample scenario how you might get stuck, and how you can try to un-stuck yourself.


1. an previously deployed SOA composite references an URL, say on OSB, http://localhost:8011/blah, Now that URL doesn't exist on osb anymore.

2. When you try to redeploy the composite from jdev, it won't re-deploy, complains http://localhost:8011/ext/blah not exist

3. try un-deploy bpel from EM console, get the same error, so BPEL needs 8011/blah to exist even for straight un-deploy or retire

4. fix: go to osb to temporarily (remember to change it back after!!!) enable 8011/blah, then un-deploy BPEL from EM console

5. deploy BPEL from JDEV

6. if it still doesn't work, switch back the temporary change on OSB, and try to deploy to a new composite version, such as 2.0.

Experiment JSON with OSB


Honestly, I never used json, other than hearing about it all the time. I am creating a Rest service with OSB, my colleague would like me to send the response back as json. So game is on. After trial and error, here is how I did it.
1.      Create a proxy service, select “Message Service”.
2.      For request message Type, you have multiple choices. Select “XML”. (if you want post up free text, then select “Text”)
3.      For response message type, select “Text”
4.      For transport, select “http” protocol
5.      Keep the default for the rest
Message flow:
1.      Process input:
Pick up your input XML from $body. Here is a quick note on parsing the $body, say you have payload like this:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <foo xmlns="foo">
    <bar xmlns="bar">car</bar>
  </foo>
</soapenv:Body>

To get “car”, use this xpath: $body/f:foo/b:bar/text()
Send Json response back:
[
    {{
        "PREM_ID":"111111",
        "PREM_TYPE_CD":"HOUSE",
        "ADDRESS1":"2222 Cypress Ave",
        "CITY":"Mountain Mesa",
        "POSTAL":"12345",
        "DESCR":"House",
        "operationArea":"KRV",
        "district":"MMS",
        "isMultiple":"N",
        "allowSelfService":"Y",
        "needAppointment":"N"
    }}
]

The only special thing I did was to escape “{“ with “{{“, and “}” with “}}”.
That’s it.