OpenESB etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
OpenESB etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

28 Aralık 2010 Salı

revisited: migration from open esb + glassfish to apache tomcat + ode

please see http://hilaltarakci.blogspot.com/2010/03/migration-from-open-esb-glassfish-to.html for prior knowledge about the topic..
i have to migrate our processes from glassfish+open esb to apache tomcat+apache ode..
in this post, i simply note down differences or additions to the above prior post.
first of all, this time, i used latest versions:
  • apache ode : 1.3.4 instead of 1.3.3
  • apache tomcat: 7.0.5 instead of 6.0.24
  • metro: 2.0.1 instead of 2.0
CATALINA_HOME, JAVA_HOME and JRE_HOME environment variables are defined properly.

While installing metro on tomcat, i used the command
ant -f metro-on-tomcat.xml install
and there is luckily no problems due to version changes..

the correct arrangement of web.xml and creation of sun-jaxws.xml under project-home/web/WEB-INF is not straightforward this time, since there is a number of web services deployed in the same .war file. so, i want to explain the details..
here some links:

a small tip: after rewriting web.xml and sun-jaxws.xml, in order to prepare the .war file under dist folder, right click and build the project in netbeans ide.. choosing clean and build results in wiping out sun-jaxws.xml and overwriting web.xml..

a sample web.xml
<?xml version="1.0" encoding="UTF-8"?>

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<description>Balistika2010Ws</description>
<display-name>Balistika2010Ws</display-name>
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<description>JAX-WS endpoint - Service1</description>
<display-name>Service1</display-name>
<servlet-name>Service1</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Service1</servlet-name>
<url-pattern>/ode/processes/Service1</url-pattern>
</servlet-mapping>
<servlet>
<description>JAX-WS endpoint - Service2</description>
<display-name>Service2</display-name>
<servlet-name>Service2</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Service2</servlet-name>
<url-pattern>/ode/processes/Service2</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

a sample corresponding sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>

<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'>
<endpoint
name='Service1'
implementation='tr.gov.tubitak.service.Service1'
url-pattern='/ode/processes/Service1'/>
<endpoint
name='Service2'
implementation='tr.gov.tubitak.service.Service2'
url-pattern='/ode/processes/Service2'/>
</endpoints>

The url-pattern attributes in web.xml and sun-jaxws.xml should match.

The implementation attribute is the web service itself..

However, tomcat throws the following error:
SEVERE: WSSERVLET11: failed to parse runtime descriptor: javax.xml.ws.WebServiceException: Unable to create JAXBContext
javax.xml.ws.WebServiceException: Unable to create JAXBContext
at com.sun.xml.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:166)
...
Caused by: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
javax.persistence.EntityManager is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at javax.persistence.EntityManager
at public javax.persistence.EntityManager tr.gov.tubitak.uzay.balistika2010.sas.service.series.jaxws.MergeAbsEvidGrpsInCase.arg1
at tr.gov.tubitak.uzay.balistika2010.sas.service.series.jaxws.MergeAbsEvidGrpsInCase
javax.persistence.EntityManager does not have a no-arg default constructor.

The error is due to the fact that i pass EntityManager between (public) method calls in order to preserve my transactions.. see this for details: http://hilaltarakci.blogspot.com/2010/12/persistence-using-jpa.html

so, how to fix this? for now, i redesigned the code in such a way that EntityManager passing methods are all defined as private..

in fact, defining problematic methods as private solved some other weird errors as well.. i do not record them, since i did not understand their nature!!

at this point, web services are all deployed successfully and i can see wsdl s..

now the bpel part.. if you do not bind all partner links that is used in mentioned process in deploy.xml, you get the following error:
16:52:58,729 ERROR [NStateLatch] Latch error, was releasing for state 1 but actually in -1
16:52:58,731 WARN [ProcessStoreImpl] Deployment failed within the engine, store undeploying process.
java.lang.IllegalArgumentException: SecurityPL must be bound to an endpoint in deploy.xml
at org.apache.ode.bpel.engine.BpelProcess.setRoles(BpelProcess.java:519)

deploy.xml of ode-home/examples/DynPartner is a good sample..

now, it is time to test deployed processes from a java client.. i created client side artifacts from manually written wsdl in the deployed bpel module, not from the endpoint itself..

when i called the process from the client, i got the following error:

SEVERE: org.objectweb.asm.ClassWriter.(I)V
java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.(I)V
at net.sf.cglib.core.DebuggingClassWriter.(DebuggingClassWriter.java:47)
...
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
at tr.gov.tubitak.uzay.balistika2010.sas.dao.base.BlsEntityManager.getEm(BlsEntityManager.java:20)
at tr.gov.tubitak.service.Service1.method1(Service1.java:116)

no need to say, the process calls a web service which persists data inside a transaction.. according to http://www.myeclipseide.com/PNphpBB2-viewtopic-t-24287.html, the error was due to conflicting asm.jar s around.. actually, i faced the same problem before in a different environment: http://hilaltarakci.blogspot.com/2010/02/javalangnosuchmethoderror.html
in deployed web services library, asm.jar was of version 1.5.3; upgrading it to version 3.3.1 solved the mentioned error..

last update on 29.12.2010, 11:30..

6 Mart 2010 Cumartesi

migration from open esb + glassfish to apache tomcat + ode

In our project, we develop web services using jax-ws and deploy them to glassfish v2 coming with netbeans 6.5 ide. btw, we installed netbeans 6.5 with open esb selected, since we use it for our bpel s. Bpels are also deployed to the same glassfish as web services. Development and deployment are quite easy and fast. However, when we ran all the bpels one after the other during unit tests, the server seems to be very slow and after a few runs out of memory error comes up.. we tried to configure glassfish, but it did not work as we expected.. (the database is postgresql, but currently this is irrelevant.)

So, now i want to deploy web services and bpels to apache-tomcat-6.0.24 + apache-ode-war-1.3.3 just to see what happens.. (in order to deploy ode to tomcat, just download the zip files, extract them and copy ode.war under webapps folder of tomcat and start tomcat..)
Now, lets follow the migration step by step..

The first step is deploying war of web services generated by netbeans (under dist folder of the project) to tomcat. So, i just copied the war file under tomcat-home/webapps and restarted the server. As i expected, the deployment seemed successful in terms of a regular web application, however it can not process the web services since no wsit runtime is installed on tomcat. (in other words, i can not see the wsdl..) In order to fix this, we have to install metro on tomcat.. a helpful link is http://blog.theunical.com/webservers/tomcat/installation-and-configuration-of-jax-ws-metro-on-tomcat-6/
following the link,
  • i downloaded and unzipped metro 2.0,
  • edited tomcat-home/conf/catalina.properties by replacing shared.loader= line with shared.loader=metro-home/lib/*.jar,
  • set CATALINA_HOME environment variable with the command export CATALINA_HOME=path to tomcat-home and chech with echo $CATALINA_HOME
  • run the command ant -f metro-on-tomcat.xml from metro-home
changes in web service project (generated in netbeans ide as netbeans project):
we have to modify web.xml and add sun-jaxws.xml under project-home/web/WEB-INF in netbeans project. actually, i got help from fromjava example of metro samples package for figuring out how to change the configuration files.
  • in web.xml, add servlet definitions and in sun-jaxws.xml modify endpoint definitions accordingly..
  • build the project in netbeans and copy the war under project-home/dist folder to tomcat-home/webapps folder for deployment.
now, you should see the wsdl at the endpoint you specified in sun-jaxws.xml.

At this point, we have deployed web services successfully, and now is the time to deploy the bpels..

Bpel files and the corresponding wsdl are collected under a bpel module of netbeans ide.
The major necessity is a deploy.xml. Get one from ode-home/examples folder and copy under bpel-module-home. i used the one from sample HelloWorld2.
here is some info about ode deployment descriptor: http://ode.apache.org/creating-a-process.html

After modifying deploy.xml, clean and build the netbeans bpel module.
Before deploying your actual bpel module under tomcat-home/webapps/ode/WEB-INF/processes folder, you may want to try one of the samples coming with ode package just to see if it is working on its own samples.. It is good to note that the bpels i am about to deploy are using the above deployed web services..

Now, lets try to note down what i have to change:
  • some minor namespace errors come up, but they were easy to solve, just read the error log in tomcat-come/logs/catalina.out file.
  • the major restriction is it forced all endpoint addreses to format http://hostname:port/ode/processes/myProcessEndpointName for example http://localhost:8080/Balistika2010Ws/ode/processes/SeriesServiceService?wsdl and http://localhost:8080/ode/processes/AddParameter?wsdl are both valid endpoints..
now, build the bpel module in netbeans and make sure thedeploy.xml is under build folder, if it is not, copy it manually and copy the build folder under tomcat-home/webapps/ode/processes . you may want to rename the folder build with a more meaningful name.
now, check http://localhost:8080/ode/processes.html. If successful, the process must be seen at that address..
An important point is the wsdls for bpels are generated with axis2 anymore because of ode, not jaxws..

Some errors due to the differtence between bpel engines might arise.. For instance i got the following error from my previosly working bpel:

javax.xml.ws.soap.SOAPFaultException: axis2ns62:selectionFailure
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy33.lightLoginWsdlOperation(Unknown Source)
at odebpelclient.Main.main(Main.java:28)

Here is a discussion about the problem: http://mail-archives.apache.org/mod_mbox/ode-user/200810.mbox/%3Cfbdc6a970810200738i75692ac6qb47d3263e9aefe1c@mail.gmail.com%3E
Ode does not automatically initialize the variables, since this is not part of the standard.. This might be an extension provided by Open Esb.. So, lets initialize all the variables and redeploy..

i end this post here, i think the point is clear..

Note: btw, x-home in italics means the location where x is installed.

Edit on 8/3/2010, 14:08:
i get the following error when i called one of the bpels from client:

from server log:
DEBUG - GeronimoLog.debug(66) | Fault response message: {http://docs.oasis-open.org/wsbpel/2.0/process/executable}uninitializedPartnerRole

from client log:
javax.xml.ws.soap.SOAPFaultException: axis2ns6:uninitializedPartnerRole
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy33.lightLoginWsdlOperation(Unknown Source)
at odebpelclient.Main.main(Main.java:28)

himm, that error was due to a mistake in deploy.xml of bpels.. i had to use keyword invoke instead of provide for invoked web services. So, for writing deploy.xml file, ode-home/examples/DynPartner maybe a better example than HelloWorld2.
and besides, check the existence of initializePartnerRole=yes attribute, when partnerRole exists in partner link.
That solution worked for me :)

Edit on 10/3/2010, 11:37:
in our case, we want to write bpel s that works both with ode and open esb. Here is an example variable initialization that works with both:

<copy>
<from>
<literal>
<ns1:authorizeUserResponse>
<ns1:return> </ns1:return>
</ns1:authorizeUserResponse>
</literal>
</from>
<to variable="AuthorizeUserOut" part="parameters"/>
</copy>

btw, the empty string between returns is necessary..



17 Aralık 2009 Perşembe

a bpel data manipulation tutor + I18N: BPCOR-3023: Selection Failure

i liked the tutor, so lets share the link:
http://www.oracle.com/technology/products/ias/bpel/pdf/orabpel-Tutorial3-DataManipulationTutorial.pdf

some other links:
http://jsexton0.blogspot.com/2009/01/openesb-bpel-assignment-tips.html
http://n2.nabble.com/ignoreMissingFromData-usage-td2474810.html

btw, all this research was due to the following error with open esb + glassfish combination:

Caused by: com.sun.jbi.engine.bpel.core.bpel.exception.StandardException: I18N: BPCOR-3023: Selection Failure occurred in BPEL({http://enterprise.netbeans.org/bpel/Balistika2010Bpel/IncidentRegistration}IncidentRegistration) at line 71!
BPCOR-6129:Line Number is 69
BPCOR-6130:Activity Name is AssignExtractDaimData
at com.sun.jbi.engine.bpel.core.bpel.engine.impl.BPELInterpreter.createVirtualFaultUnit(BPELInterpreter.java:235)
at com.sun.jbi.engine.bpel.core.bpel.engine.impl.BPELInterpreter.execute(BPELInterpreter.java:203)

issue about
ignoreMissingData attribute on assign element
https://open-jbi-components.dev.java.net/issues/show_bug.cgi?id=181

3 Eylül 2009 Perşembe

bpel fault handling - 2

i mentioned a bug in my previous post: http://hilaltarakci.blogspot.com/2009/09/bpel-fault-handling.html
(just read the lines in red ).. however, i was wrong, that was not the real bug..

the problem:
Lets repeat the scenario. There is a web service throwing some exception and there is a bpel process delegating exactly the same exception. Unfortunately, at the client side, the details of the exception comes null even though the exception is properly catched..


catch (FaultCatchWsdlOperationFault ex) {
MyException2 exc = ex.getFaultInfo();
}


the reason:
If the bpel process uses the same exception type with the invoked web service's exception, than there is something wrong and the detail of the exception (detail comes from the web service) does not come with exception.getFaultInfo() method in your client app.

the solution:
The workaround is using different types in web service and bpel faults.
i hope the explanation is clear enough :)

1 Eylül 2009 Salı

bpel fault handling

Understanding fault handling mechanism of bpel took time for me, so lets note down the issue..

i want to explain bpel fault handling in 2 steps.. In step 1, there is a bpel process which does nothing except for throwing an exception. In step 2, there is a sample web service throwing a user defined exception and bpel catches and throws that exception..

Process without web service :

Here are the files for the bpel module:
FaultWsdl.wsdl


<?xml version="1.0" encoding="UTF-8"?>
<definitions name="wsdl" targetNamespace="http://j2ee.netbeans.org/wsdl/wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://j2ee.netbeans.org/wsdl/wsdl"
xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns0="http://xml.netbeans.org/schema/schema">
<types>
<xsd:schema targetNamespace="http://j2ee.netbeans.org/wsdl/wsdl">
<xsd:import schemaLocation="schema.xsd" namespace="http://xml.netbeans.org/schema/schema"/>
</xsd:schema>
</types>
<message name="wsdlOperationRequest">
<part name="part1" type="xsd:string"/>
</message>
<message name="wsdlOperationResponse">
<part name="part1" type="xsd:string"/>
</message>
<message name="wsdlOperationFault">
<part name="part1" element="ns0:faultstr"/>
</message>
<portType name="wsdlPortType">
<operation name="wsdlOperation">
<input name="input1" message="tns:wsdlOperationRequest"/>
<output name="output1" message="tns:wsdlOperationResponse"/>
<fault name="fault1" message="tns:wsdlOperationFault"/>
</operation>
</portType>
<binding name="wsdlBinding" type="tns:wsdlPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="wsdlOperation">
<soap:operation/>
<input name="input1">
<soap:body use="literal" namespace="http://j2ee.netbeans.org/wsdl/wsdl"/>
</input>
<output name="output1">
<soap:body use="literal" namespace="http://j2ee.netbeans.org/wsdl/wsdl"/>
</output>
<fault name="fault1">
<soap:fault use="literal" name="fault1" namespace="http://j2ee.netbeans.org/wsdl/wsdl"/>
</fault>
</operation>
</binding>
<service name="wsdlService">
<port name="wsdlPort" binding="tns:wsdlBinding">
<soap:address location="http://localhost:${HttpDefaultPort}/wsdlService/wsdlPort"/>
</port>
</service>
<plnk:partnerLinkType name="wsdl">
<!-- A partner link type is automatically generated when a new port type is added. Partner link types are used by BPEL processes.
In a BPEL process, a partner link represents the interaction between the BPEL process and a partner service. Each partner link is associated with a partner link type.
A partner link type characterizes the conversational relationship between two services. The partner link type can have one or two roles.-->
<plnk:role name="wsdlPortTypeRole" portType="tns:wsdlPortType"/>
</plnk:partnerLinkType>
</definitions>


schema.xsd i think jaxws wants the schema in a seperate file than the wsdl, at least netbeans web service client generation wizard does!


<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://xml.netbeans.org/schema/schema"
xmlns:tns="http://xml.netbeans.org/schema/schema"
elementFormDefault="qualified">
<xsd:element name="faultstr" type="xsd:string"></xsd:element>
</xsd:schema>


FaultProcess.bpel


<?xml version="1.0" encoding="UTF-8"?>
<process
name="FaultProcess"
targetNamespace="http://enterprise.netbeans.org/bpel/BpelFault1/Process1"
xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sxt="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Trace"
xmlns:sxed="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Editor"
xmlns:tns="http://enterprise.netbeans.org/bpel/BpelFault1/Process1">
<import namespace="http://j2ee.netbeans.org/wsdl/wsdl" location="FaultWsdl.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
<partnerLinks>
<partnerLink name="PartnerLink1" xmlns:tns="http://j2ee.netbeans.org/wsdl/wsdl" partnerLinkType="tns:wsdl" myRole="wsdlPortTypeRole"/>
</partnerLinks>
<variables>
<variable name="Fault1FaultVar" xmlns:tns="http://j2ee.netbeans.org/wsdl/wsdl" messageType="tns:wsdlOperationFault"/>
<variable name="WsdlOperationOut" xmlns:tns="http://j2ee.netbeans.org/wsdl/wsdl" messageType="tns:wsdlOperationResponse"/>
<variable name="WsdlOperationIn" xmlns:tns="http://j2ee.netbeans.org/wsdl/wsdl" messageType="tns:wsdlOperationRequest"/>
</variables>
<sequence>
<receive name="Receive1" createInstance="yes" partnerLink="PartnerLink1" operation="wsdlOperation" xmlns:tns="http://j2ee.netbeans.org/wsdl/wsdl" portType="tns:wsdlPortType" variable="WsdlOperationIn"/>
<assign name="Assign1">
<copy>
<from>'This error is thrown from the bpel process'</from>
<to variable="Fault1FaultVar" part="part1"/>
</copy>
<copy>
<from variable="Fault1FaultVar" part="part1"/>
<to variable="WsdlOperationOut" part="part1"/>
</copy>
</assign>
<reply name="Reply1" partnerLink="PartnerLink1" operation="wsdlOperation" xmlns:tns="http://j2ee.netbeans.org/wsdl/wsdl" portType="tns:wsdlPortType" faultName="tns:fault1" variable="Fault1FaultVar"/>
</sequence>
</process>


and offcourse the client call code:


try {
org.netbeans.j2ee.wsdl.wsdl.WsdlService service = new org.netbeans.j2ee.wsdl.wsdl.WsdlService();
org.netbeans.j2ee.wsdl.wsdl.WsdlPortType port = service.getWsdlPort();
javax.xml.ws.Holder part1 = new javax.xml.ws.Holder();
part1.value = new String("test");
port.wsdlOperation(part1);
} catch (org.netbeans.j2ee.wsdl.wsdl.WsdlOperationFault ex) {
System.out.println("fault: " + ex.getFaultInfo() );
}


The expected output is :


fault: This error is thrown from the bpel process


and done :) However, when web service thrown exceptions are considered, not so easy :(

Process catching exception thrown by invoked web service:

The sample web service:

MyWebService.java


package ws;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

@WebService()
public class MyWebService {

@WebMethod(operationName = "operation")
public String operation(@WebParam(name = "parameter")
String parameter) throws MyException {
throw new MyException("Exception thrown from web service :) ");
}
}


and the exception class..

MyException.java


package ws;

public class MyException extends Exception {
private String errorCode;

public MyException() {
}

public MyException(String msg) {
super(msg);
}

public String getErrorCode() {
return errorCode;
}

public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
}


Now the bpel module files:

FaultCatchProcess.bpel


<?xml version="1.0" encoding="UTF-8"?>
<process
name="FaultCatchProcess"
targetNamespace="http://enterprise.netbeans.org/bpel/BpelFault2/FaultCatchProcess"
xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sxt="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Trace"
xmlns:sxed="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Editor"
xmlns:tns="http://enterprise.netbeans.org/bpel/BpelFault2/FaultCatchProcess" xmlns:ns0="http://ws/">
<import namespace="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl" location="FaultCatchWsdl.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
<import namespace="http://enterprise.netbeans.org/bpel/MyWebServiceServiceWrapper" location="MyWebServiceServiceWrapper.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
<import namespace="http://ws/" location="MyWebServiceService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/>
<partnerLinks>
<partnerLink name="PartnerLink2" xmlns:tns="http://enterprise.netbeans.org/bpel/MyWebServiceServiceWrapper" partnerLinkType="tns:MyWebServiceLinkType" partnerRole="MyWebServiceRole"/>
<partnerLink name="PartnerLink1" xmlns:tns="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl" partnerLinkType="tns:FaultCatchWsdl" myRole="FaultCatchWsdlPortTypeRole"/>
</partnerLinks>
<variables>
<variable name="FaultToBpel" xmlns:tns="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl" messageType="tns:FaultCatchWsdlOperationFault"/>
<variable name="OperationOut" xmlns:tns="http://ws/" messageType="tns:operationResponse"/>
<variable name="OperationIn" xmlns:tns="http://ws/" messageType="tns:operation"/>
<variable name="FaultCatchWsdlOperationOut" xmlns:tns="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl" messageType="tns:FaultCatchWsdlOperationResponse"/>
<variable name="FaultCatchWsdlOperationIn" xmlns:tns="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl" messageType="tns:FaultCatchWsdlOperationRequest"/>
</variables>
<faultHandlers>
<catch faultName="ns0:MyException" faultVariable="myExceptionFromWs" faultMessageType="ns0:MyException">
<sequence name="Sequence1">
<assign name="Assign3">
<copy>
<from variable="myExceptionFromWs" part="fault"/>
<to variable="FaultToBpel" part="part1"/>
</copy>
</assign>
<reply name="Reply2" partnerLink="PartnerLink1" operation="FaultCatchWsdlOperation" xmlns:tns="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl" portType="tns:FaultCatchWsdlPortType" faultName="tns:fault1" variable="FaultToBpel"/>
</sequence>
</catch>
</faultHandlers>
<sequence>
<receive name="Receive1" createInstance="yes" partnerLink="PartnerLink1" operation="FaultCatchWsdlOperation" xmlns:tns="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl" portType="tns:FaultCatchWsdlPortType" variable="FaultCatchWsdlOperationIn"/>
<assign name="Assign1">
<copy>
<from variable="FaultCatchWsdlOperationIn" part="part1"/>
<to variable="OperationIn" part="parameters"/>
</copy>
</assign>
<invoke name="Invoke1" partnerLink="PartnerLink2" operation="operation" xmlns:tns="http://ws/" portType="tns:MyWebService" inputVariable="OperationIn" outputVariable="OperationOut"/>
<assign name="Assign2">
<copy>
<from variable="OperationOut" part="parameters"/>
<to variable="FaultCatchWsdlOperationOut" part="part1"/>
</copy>
</assign>
<reply name="Reply1" partnerLink="PartnerLink1" operation="FaultCatchWsdlOperation" xmlns:tns="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl" portType="tns:FaultCatchWsdlPortType" variable="FaultCatchWsdlOperationOut"/>
</sequence>
</process>


FaultCatchWsdl.wsdl


<?xml version="1.0" encoding="UTF-8"?>
<definitions name="FaultCatchWsdl" targetNamespace="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl" xmlns:ns="http://ws/" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<xsd:schema targetNamespace="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl">
<xsd:import namespace="http://ws/" schemaLocation="MyWebServiceService.xsd"/>
</xsd:schema>
</types>
<message name="FaultCatchWsdlOperationRequest">
<part name="part1" type="ns:operation"/>
</message>
<message name="FaultCatchWsdlOperationResponse">
<part name="part1" type="ns:operationResponse"/>
</message>
<message name="FaultCatchWsdlOperationFault">
<part name="part1" element="ns:MyException"/>
</message>
<portType name="FaultCatchWsdlPortType">
<operation name="FaultCatchWsdlOperation">
<input name="input1" message="tns:FaultCatchWsdlOperationRequest"/>
<output name="output1" message="tns:FaultCatchWsdlOperationResponse"/>
<fault name="fault1" message="tns:FaultCatchWsdlOperationFault"/>
</operation>
</portType>
<binding name="FaultCatchWsdlBinding" type="tns:FaultCatchWsdlPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="FaultCatchWsdlOperation">
<soap:operation/>
<input name="input1">
<soap:body use="literal" namespace="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl"/>
</input>
<output name="output1">
<soap:body use="literal" namespace="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl"/>
</output>
<fault name="fault1">
<soap:fault use="literal" name="fault1" namespace="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl"/>
</fault>
</operation>
</binding>
<service name="FaultCatchWsdlService">
<port name="FaultCatchWsdlPort" binding="tns:FaultCatchWsdlBinding">
<soap:address location="http://localhost:${HttpDefaultPort}/FaultCatchWsdlService/FaultCatchWsdlPort"/>
</port>
</service>
<plnk:partnerLinkType name="FaultCatchWsdl">
<!-- A partner link type is automatically generated when a new port type is added. Partner link types are used by BPEL processes.
In a BPEL process, a partner link represents the interaction between the BPEL process and a partner service. Each partner link is associated with a partner link type.
A partner link type characterizes the conversational relationship between two services. The partner link type can have one or two roles.-->
<plnk:role name="FaultCatchWsdlPortTypeRole" portType="tns:FaultCatchWsdlPortType"/>
</plnk:partnerLinkType>
</definitions>


The following wsdl and xsd are local copies for the web service wsdl..

MyWebServiceService.wsdl


<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3.1-hudson-749-SNAPSHOT. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3.1-hudson-749-SNAPSHOT. -->
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws/" name="MyWebServiceService">
<types>
<xsd:schema>
<xsd:import namespace="http://ws/" schemaLocation="MyWebServiceService.xsd"></xsd:import>
</xsd:schema>
</types>
<message name="operation">
<part name="parameters" element="tns:operation"></part>
</message>
<message name="operationResponse">
<part name="parameters" element="tns:operationResponse"></part>
</message>
<message name="MyException">
<part name="fault" element="tns:MyException"></part>
</message>
<portType name="MyWebService">
<operation name="operation">
<input message="tns:operation"></input>
<output message="tns:operationResponse"></output>
<fault message="tns:MyException" name="MyException"></fault>
</operation>
</portType>
<binding name="MyWebServicePortBinding" type="tns:MyWebService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
<operation name="operation">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
<fault name="MyException">
<soap:fault name="MyException" use="literal"></soap:fault>
</fault>
</operation>
</binding>
<service name="MyWebServiceService">
<port name="MyWebServicePort" binding="tns:MyWebServicePortBinding">
<soap:address location="http://localhost:8080/BpelFaultWS1/MyWebServiceService"></soap:address>
</port>
</service>
</definitions>


MyWebServiceService.xsd


<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3.1-hudson-749-SNAPSHOT. -->
<xs:schema xmlns:tns="http://ws/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://ws/">

<xs:element name="MyException" type="tns:MyException"></xs:element>

<xs:element name="operation" type="tns:operation"></xs:element>

<xs:element name="operationResponse" type="tns:operationResponse"></xs:element>

<xs:complexType name="operation">
<xs:sequence>
<xs:element name="parameter" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>

<xs:complexType name="operationResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>

<xs:complexType name="MyException">
<xs:sequence>
<xs:element name="errorCode" type="xs:string" minOccurs="0"></xs:element>
<xs:element name="message" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>

MyWebServiceServiceWrapper.wsdl
<?xml version="1.0" encoding="UTF-8"?>

<definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="MyWebServiceServiceWrapper" targetNamespace="http://enterprise.netbeans.org/bpel/MyWebServiceServiceWrapper" xmlns:tns="http://enterprise.netbeans.org/bpel/MyWebServiceServiceWrapper" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:ns="http://ws/">
<import location="MyWebServiceService.wsdl" namespace="http://ws/"/>
<plnk:partnerLinkType name="MyWebServiceLinkType">
<plnk:role name="MyWebServiceRole" portType="ns:MyWebService"/>
</plnk:partnerLinkType>
</definitions>


However, i think there is a bug here when bpel called from a java or web client.. Yes, the exception thrown by the web service is caught properly, but the detail info just disappears :( While testing via test module of the composite app, there is not such bug..

Here is the test with xml:

input

<soapenv:Envelope xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:faul="http://j2ee.netbeans.org/wsdl/FaultCatchWsdl">
<soapenv:Body>
<faul:FaultCatchWsdlOperation>
<part1>
<!--Optional:-->
<parameter>test</parameter>
</part1>
</faul:FaultCatchWsdlOperation>
</soapenv:Body>
</soapenv:Envelope>


output


<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode xmlns="">SOAP-ENV:Client</faultcode>
<faultstring xmlns="">fault1</faultstring>
<detail xmlns="">
<MyException xmlns="http://ws/">
<message>Exception thrown from web service :) </message>
</MyException>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


here the client call:


try {
org.netbeans.j2ee.wsdl.faultcatchwsdl.FaultCatchWsdlService service = new org.netbeans.j2ee.wsdl.faultcatchwsdl.FaultCatchWsdlService();
org.netbeans.j2ee.wsdl.faultcatchwsdl.FaultCatchWsdlPortType port = service.getFaultCatchWsdlPort();
ws.Operation part1 = new ws.Operation();
part1.setParameter("test");
ws.OperationResponse result = port.faultCatchWsdlOperation(part1);
System.out.println("Result = "+result);
} catch (org.netbeans.j2ee.wsdl.faultcatchwsdl.FaultCatchWsdlOperationFault ex) {
System.out.println("My exception is : " + ex.getFaultInfo().getMessage());
}


and the output:

My exception is : null

PS: i wrote down whole files to make trying the code easier..
You know, most portions of the files are automatically generated..

Btw, my ide is Netbeans 6.5 and i deploy to glassfish v2, and i use openesb for bpel..
Ooohh, done finally :)

Edit on 03/09/2009, 12:07 : The format of the post was a mess, so it is fixed by now..
The next post is about the bug mentioned here (in red)..

21 Ağustos 2009 Cuma

wrong port used for xsd in wsdl (openesb)

the environment is openesb (with netbeans 6.5.1) and glassfish server.
when the composite app with bpel processes is deployed, the wsdls for the processes include wrong ports in imports of inner schema files (in this case, 8080 instead of 9080).
here is a description of the problem http://n2.nabble.com/Wrong-Port-Used-When-Generating-Web-Service-Client-td3388707.html and the issue https://open-esb.dev.java.net/issues/show_bug.cgi?id=2204
Actually, the issue had been solved in the internal trunk, however the solution won't be available till next release :(
so, what to do ??

the workaround is
  • download the wsdls and all dependent schema files,
  • edit all imports (of used schema files) manually and
  • use the local wsdl in order to generate stubs at client side .
Thus, the stubs will be generated without any error :)

btw, deploying the business processes to apache ode is also tried. however, the same problem remained :(

16 Temmuz 2009 Perşembe

OpenESB, bpel foreach

Mapper interface is a bit complicated to use until getting used to it, at least it is for me..
While using a foreach construct, just stopped and couldn't know what to do.. This post helped to some extent: http://markmail.org/message/4s3avjssz5rojddj#query:openesb%20foreach+page:1+mid:cd6derznuhs5d7xp+state:results
Still assignment from array to counter a bit problematic.. i will write down the exact solution when solved..

Edit on 17.07.2009, 02.10: Assignment from array via counter was problematic. The problem was, as the counter increments, not only the current value was copied but also previous values remained. (the to part of the assign becomes an array instead of a single value). The bug was due to


< assign name="Assign">
<copy>
<from>$GetParameterTypeListOut.parameters/return[$paramTypeCounter]</from>
<to>$GetParameterListIn.parameters/parameterType[$paramTypeCounter]</to>
</copy>
</assign>


The error is fixed when [$paramTypeCounter] part is removed from to part of the assign.

5 Temmuz 2009 Pazar

jbpm bpel - first steps

i am looking for someway to deploy my bpel processes on jboss app server. i do not want to use jpdl which is not a standart, so i stuck to bpel.

This seems to be a solution: http://www.jboss.org/jbossjbpm/bpel/
As such, it can execute processes authored with the Eclipse BPEL designer or any other editor that produces standard BPEL documents.

Bpel designers generally generate some extra xml and so, it may be possible that you can not open your bpel process designed with Activos Designer with Eclipse Bpel Designer,or vice versa. (correct if i am wrong:)) However, OpenESB allows me to produce clean, standart bpel file without adding any extra xml. (When you design a process with Open Esb (Netbeans) Bpel designer, you will notice that the location for the elements are fixed in the GUI, you can not put anything you like at anywhere in the designer, you have to choose from some predefined locations.. i think that is why Netbeans designer's bpel is so clean:) since it does not require to keep the location info, no extensions to standard bpel is needed..) Therefore, the above sentence about jbpm bpel (in italic) is important to me.. This means, i may develop my bpel process with OpenEsb designer and deploy to jbpm bpel.. This post is to note down that experience..

The steps are as follows:

  • in order to make use of the examples coming with the jbpm bpel package, the following must be already installed:
- ant
- jboss app server (4.x.x is required according to https://jira.jboss.org/jira/secure/attachment/12311453/jbpm.bpel.guide.pdf)
- java 1.5 (i do not know why, but i could not make jwsdp accept jdk 6, during installation, that is why i need jdk 1.5, more specifically jdk1.5.0_19 is ok)
- java web services developer pack (the examples use wscompile etc. ant tasks from here, so using metro instead is expensive, i gave up on the way half.. ) jwsdp is needed just for running the given examples, not part of the actual solution. in actual case, metro web service stack will be used instead..

this package includes many bpel samples. however, in order to run these samples properly, the following modifications may be needed:

  • In jbpm-bpel-1.1.1/examples/common/build.properties file, modify the following properties accordingly:

jboss.version=4.2.3.GA (i am using this already, but any 4.x.x is said to be ok)
jboss.home=${software.installation.dir}/jboss-${jboss.version} (if different)
jwsdp.home=${software.installation.dir}/jwsdp-1.6
javac.source=1.4 (modify as 1.5)
javac.target=1.4 (modify as 1.5)

  • start jboss, (starting from port 8080 may be required, not sure. if something goes wrong, check that..)
  • execute command ant inside jbpm-bpel-1.1.1/examples, it should execute with success..
  • lets see if wsdl s are available:
http://127.0.0.1:8080/account/accountSystem?wsdl
http://127.0.0.1:8080/invoice/invoiceService?wsdl
http://127.0.0.1:8080/scheduling/schedulingProcess?wsdl
http://127.0.0.1:8080/shipping/shippingService?wsdl
http://127.0.0.1:8080/task/taskManager?wsdl
http://127.0.0.1:8080/ticket/ticketIssuer?wsdl
http://127.0.0.1:8080/translator/document?wsdl
http://127.0.0.1:8080/translator/text?wsdl

i got the addresses for the wsdl s from ${JBOSS_HOME}/server/default/data/wsdl

now it is time to dive into https://jira.jboss.org/jira/secure/attachment/12311453/jbpm.bpel.guide.pdf deeper, but it can wait :)
i do not want to ruin my sunday afternoon with that :)

Edit on 6/7/2009, 12.04: Sorry, i have forgotten to deploy jbpm-bpel itself on jboss.. So, at anytime you like, execute command ant deploy.ear inside /jbpm-bpel/jbpm-bpel-1.1.1/deploy and jbpm-bpel will be deployed on jboss. try to see jbpm bpel console from http://localhost:8080/jbpm-bpel/

Edit on 7/7/2009, 10.55: Yeah, OpenESB designer produces standard bpel files. However, unfortunately this does not mean that it could open every standard bpel file in its designer.. 

11 Mayıs 2009 Pazartesi

OpenESB

Hello all, this writing is about my first steps through Open ESB..
Very first step is installing GlassFish ESB v2 GA (Nov 2008, Stable & Released) which also includes netbeans 6.1 ide & glassfish v2. (https://open-esb.dev.java.net/Downloads.html)
Tutorial on http://www.netbeans.org/kb/61/soa/synchsample.html is very straightforward..

Now it is time to create a composite application from scratch.. The steps are:
  • create a sample web service to invoke from the following process. I used a random number generator..
  • create New Project/SOA/Bpel Module
  • create New Project/SOA/Composite Application
  • right click composite app and add created bpel module as new jbi module for that app.
  • create a Bpel process in Bpel module.
  • create a Wsdl (abstract) in Bpel module.
  • add PartnerLink to your bpel file with the type in the wsdl., the wsdl is automatically imported by the Bpel process.
  • add receive and reply elements to be pointed by that partnerlink.
  • copy the wsdl of the outer ws to bpel module. do not forget to copy all dependent files such as xsd s and update the location definitions in wsdl.
  • add wsdl import by file.
  • create a partnerlink for that wsdl in bpel file. this creates a wrapper wsdl for the outer wsdl and automatically adds them to the main wsdl of the process.
  • do not forget to replace the soap location as 9080 in the main wsdl of the process.
  • create a binding and a service for the main wsdl. otherwise, you can not test them via test node of the composite app.
  • deploy the composite app.
  • test the process via the test node in the composite app.
My next step will probably be this: http://blogs.sun.com/toxophily/entry/visual_web_pack_tip_using

Btw, i really liked OpenESB.. It provides a compact environment for web service development and orchestration.. Deployment and testing the process is very very easy. (Testing the deployed process in Eclipse Bpel + Apache ODE killed me before, but maybe it is my unskillfulness, so i say this out of the record :)) ) I liked the robustness and user friendliness of the Netbeans Bpel designer. Deleting elements from the process or moving the elements does not lead to problems..
That is all for now :)

Edit on 25.06.2009 11:12 : I supposed that full netbeans ide download does not provide me with open esb, but i was wrong (due to wrong download:( ) So, netbeans (with all option) from http://www.netbeans.org/downloads/start.html?platform=linux&lang=en&option=all&version=6.5.1 also supports open esb..

Edit on 26.06.2009 11.16: This is also a step-by-step tutorial http://www.netbeans.org/kb/61/soa/helloworldca.html