Pages

Monday, January 21, 2008

Tuscany SCA java and JDeveloper 11g

This weekend I was testdriving the Tuscany SCA java release, this release works very well. I hope there will be an Oracle implementation of SCA JAVA soon. The development of SCA and SDO are very important to make better and less complex soa applications. Gartner's vice president of application integration and middleware analysis says "SDO does for data in a SOA application what SCA does for service components, it abstracts the developer's view of the data in an effort to simplify the design and maintenance of data-handling application functions." With Tuscany it is very easy to expose new Services. Use components written in other languages then Java ( script, bpel, spring etc) or use ws, rmi, ejb or jms components. All you have to do is to configure the composite file. So you can use every component in your application. That is enough theory for this blog.
JDeveloper 11G TP3 does not supports SCA Java. It is not know if it will support it in the 11g release but with 11g you can make SDO services. This is very easy, for more info see my previous blog . Let's try to use a jdev sdo service as a component in a tuscany application. I create a new jdeveloper project and add all the tuscany libraries to this project. Then create a composite file called customer.composite and put it in the root of src folder.

<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="/nl/ordina/hr/model/service/common/"
xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" name="customer"
xmlns:tns="/nl/ordina/hr/model/service/common/"
xmlns:types="/nl/ordina/hr/model/service/common/types/"
xmlns:errors="http://xmlns.oracle.com/adf/svc/errors/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>
<component name="CustomerServiceComponent">
<implementation.java class="nl.ordina.soa.sdo.CustomerServiceComponent" />
<reference name="customerService"/>
</component>
<reference name="customerService" promote="CustomerServiceComponent/customerService">
<interface.java interface="nl.ordina.hr.model.service.common.serviceinterface.CustomerService" />
<binding.ws uri="http://XPCND7010XMP.work.local:8989/EJB-sdo_hr-Model-context-root/CustomerService" />
</reference>
</composite>

Here I defined a component which I can use in my app and this component uses the web service reference to connect to the sdo webservice.
Now add the sdo customer service jars to this project. We have to create a class which implements the sdo customerservice.

package nl.ordina.soa.sdo;

import java.util.List;
import nl.ordina.hr.model.dataaccess.common.CustomersViewSDO;
import nl.ordina.hr.model.service.common.serviceinterface.CustomerService;
import oracle.jbo.common.service.types.FindControl;
import oracle.jbo.common.service.types.FindCriteria;
import oracle.jbo.common.service.types.ProcessControl;
import oracle.jbo.common.service.types.ProcessData;

import org.osoa.sca.annotations.Reference;

public class CustomerServiceComponent implements CustomerService {

private CustomerService customerService;

@Reference
public void setCustomerService(CustomerService customerService) {
this.customerService = customerService;
}

public CustomerService getCustomerService() {
return customerService;
}

public CustomersViewSDO getCustomersView(Integer customerId){

System.out.println("Called getCustomersView");
return customerService.getCustomersView(customerId) ;
}

public CustomersViewSDO createCustomersView(CustomersViewSDO customersView) {
return customerService.createCustomersView(customersView);
}

public CustomersViewSDO updateCustomersView(CustomersViewSDO customersView) {
return customerService.updateCustomersView(customersView);
}

public void deleteCustomersView(CustomersViewSDO customersView){
customerService.deleteCustomersView(customersView);
}

public CustomersViewSDO mergeCustomersView(CustomersViewSDO customersView) {
return customerService.mergeCustomersView(customersView);
}

public List findCustomersView(FindCriteria findCriteria,
FindControl findControl) {
return customerService.findCustomersView(findCriteria, findControl);
}

public List processCustomersView(String changeOperation,
List customersView,
ProcessControl processControl) {
return customerService.processCustomersView(changeOperation,customersView, processControl);
}

public ProcessData processCSCustomersView(ProcessData processData,
ProcessControl processControl) {
return customerService.processCSCustomersView(processData, processControl);
}
}


Now we can test it. Create a test class where we load the composite file and call a method of the customerservice.

package nl.ordina.soa.sdo;

import nl.ordina.hr.model.dataaccess.common.CustomersViewSDO;
import nl.ordina.hr.model.service.common.serviceinterface.CustomerService;
import org.apache.tuscany.sca.host.embedded.SCADomain;

public class Launch {
public final static void main(String[] args) throws Exception {
SCADomain scaDomain = SCADomain.newInstance("customer.composite");

CustomerService customerService = scaDomain.getService(CustomerService.class, "CustomerServiceComponent");

Integer custId = 147;
CustomersViewSDO cust = customerService.getCustomersView(custId);
System.out.println(cust.getCustFirstName()+" "+cust.getCustLastName());

scaDomain.close();
}
}

I got an error but Simon of tuscany helped me, I forgot the add @Reference to the customerService Setter.

20 comments:

  1. I'm a bit puzzled by your final comment about JAX-WS annotations. This sample seems to be a pure Java SCA Web service client with SDO data and no JAX-WS annotations that I can see. I'm guessing that the reference might be to JAXB annotations in the generated SDO code, which are needed to make the SDO serialize correctly. Is this correct? I would like to understand the specific issue so that we can prioritize it for support in a future Tuscany release.

    ReplyDelete
  2. Hi Simon,

    Yes it is pure web client with sdo data

    I got this error
    30-jan-2008 20:49:28 org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl$1 problem
    WARNING: [WARNING] Reference not found for component reference: CustomerServiceComponent/customerService null
    Called getCustomersView
    Exception in thread "main" java.lang.NullPointerException
    at nl.ordina.soa.sdo.CustomerServiceComponent.getCustomersView(CustomerServiceComponent.java:26)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:105)
    at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:233)
    at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:130)
    at $Proxy12.getCustomersView(Unknown Source)
    at nl.ordina.soa.sdo.Launch.main(Launch.java:14)

    @javax.ejb.Stateless(name="nl.ordina.hr.model.service.common.CustomerServiceBean")
    @javax.ejb.Remote(CustomerService.class)
    @javax.jws.WebService(targetNamespace="/nl/ordina/hr/model/service/common/",
    serviceName="CustomerService", portName="CustomerServiceSoapHttpPort",
    endpointInterface="nl.ordina.hr.model.service.common.serviceinterface.CustomerService")
    @oracle.j2ee.annotation.ejb.StatelessDeployment(copyByValue=false,
    minInstances=2)
    public class CustomerServiceImpl extends ServiceImpl implements CustomerService {
    private static boolean _isInited = false;

    /**This is the default constructor (do not remove).
    */
    public CustomerServiceImpl() {
    init();
    setApplicationModuleDefName("nl.ordina.hr.model.service.CustomerService");
    setConfigurationName("CustomerService");
    }

    /**Generated method. Do not modify. Do initialization in the constructor
    */
    protected void init() {
    if (_isInited) {
    return;
    }
    synchronized (CustomerServiceImpl.class) {
    if (_isInited) {
    return;
    }
    try {
    SDOHelper.INSTANCE.defineSchema("nl/ordina/hr/model/service/common/serviceinterface/", "CustomerService.xsd");
    _isInited = true;
    } catch (Exception ex) {
    ex.printStackTrace();
    }
    }
    }

    ReplyDelete
  3. To correct the errors you are seeing, you need to modify your CustomerServiceComponent class. The setter method setcustomerService() should have an @Reference annotation. This is imported as org.osoa.sca.annotations.Reference. Also, when I write a setter for customerService, I would name it setCustomerService (capital C) but this may not be required. Same for the getter. With these changes, you should get past the NullPointerException and the previous warning.

    If it still doesn't work after these changes, would you like to post your results to the Tuscany user mailing list (tuscany-user@ws.apache.org)? We'll be pleased to help you get started with Tuscany SCA and SDO.

    ReplyDelete
  4. Simon, I update my blog , but now I got this error, maybe you know the solution

    Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
    Exception in thread "main" org.osoa.sca.ServiceRuntimeException: org.osoa.sca.ServiceRuntimeException: org.apache.tuscany.sca.core.assembly.ActivationException: java.lang.IllegalStateException: The operation is not wrapper style.
    at org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADomain.java:264)
    at org.apache.tuscany.sca.host.embedded.SCADomain.newInstance(SCADomain.java:69)
    at nl.ordina.soa.sdo.Launch.main(Launch.java:9)
    Caused by: org.osoa.sca.ServiceRuntimeException: org.apache.tuscany.sca.core.assembly.ActivationException: java.lang.IllegalStateException: The operation is not wrapper style.
    at org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.init(DefaultSCADomain.java:183)
    at org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADomain.java:230)
    ... 2 more
    Caused by: org.apache.tuscany.sca.core.assembly.ActivationException: java.lang.IllegalStateException: The operation is not wrapper style.
    at org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.activate(CompositeActivatorImpl.java:745)
    at org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.init(DefaultSCADomain.java:181)

    ReplyDelete
  5. There is something in your CustomerService interface that Tuscany doesn't like. Can you post this interface, and the CustomersViewSDO interface or class?

    ReplyDelete
  6. The customerviewsdo is not so interesting

    package nl.ordina.hr.model.service.common.serviceinterface;

    import java.util.List;

    import javax.xml.namespace.QName;

    import nl.ordina.hr.model.dataaccess.common.CustomersViewSDO;

    import oracle.jbo.common.service.types.FindControl;
    import oracle.jbo.common.service.types.FindCriteria;
    import oracle.jbo.common.service.types.ProcessControl;
    import oracle.jbo.common.service.types.ProcessData;
    import oracle.jbo.service.errors.ServiceException;
    // ---------------------------------------------------------------------
    // --- File generated by Oracle ADF Business Components Design Time.
    // ---------------------------------------------------------------------
    @javax.jws.soap.SOAPBinding(parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED,
    style=javax.jws.soap.SOAPBinding.Style.DOCUMENT)
    @javax.jws.WebService(targetNamespace="/nl/ordina/hr/model/service/common/",
    name="CustomerService", wsdlLocation="nl/ordina/hr/model/service/common/serviceinterface/CustomerService.wsdl")
    @oracle.j2ee.ws.common.sdo.SchemaLocation(value="nl/ordina/hr/model/service/common/serviceinterface/CustomerService.xsd")
    public interface CustomerService {


    public static final String NAME =
    new QName("/nl/ordina/hr/model/service/common/",
    "CustomerService").toString();

    @javax.jws.WebMethod(action="/nl/ordina/hr/model/service/common/getCustomersView",
    operationName="getCustomersView")
    @javax.xml.ws.RequestWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="getCustomersView")
    @javax.xml.ws.ResponseWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="getCustomersViewResponse")
    @javax.jws.WebResult(name="result")
    CustomersViewSDO getCustomersView(@javax.jws.WebParam(mode=javax.jws.WebParam.Mode.IN,
    name="customerId")
    Integer customerId) throws ServiceException;

    @javax.jws.WebMethod(action="/nl/ordina/hr/model/service/common/createCustomersView",
    operationName="createCustomersView")
    @javax.xml.ws.RequestWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="createCustomersView")
    @javax.xml.ws.ResponseWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="createCustomersViewResponse")
    @javax.jws.WebResult(name="result")
    CustomersViewSDO createCustomersView(@javax.jws.WebParam(mode=javax.jws.WebParam.Mode.IN,
    name="customersView")
    CustomersViewSDO customersView) throws ServiceException;

    @javax.jws.WebMethod(action="/nl/ordina/hr/model/service/common/updateCustomersView",
    operationName="updateCustomersView")
    @javax.xml.ws.RequestWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="updateCustomersView")
    @javax.xml.ws.ResponseWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="updateCustomersViewResponse")
    @javax.jws.WebResult(name="result")
    CustomersViewSDO updateCustomersView(@javax.jws.WebParam(mode=javax.jws.WebParam.Mode.IN,
    name="customersView")
    CustomersViewSDO customersView) throws ServiceException;

    @javax.jws.WebMethod(action="/nl/ordina/hr/model/service/common/deleteCustomersView",
    operationName="deleteCustomersView")
    @javax.xml.ws.RequestWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="deleteCustomersView")
    @javax.xml.ws.ResponseWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="deleteCustomersViewResponse")
    void deleteCustomersView(@javax.jws.WebParam(mode=javax.jws.WebParam.Mode.IN,
    name="customersView")
    CustomersViewSDO customersView) throws ServiceException;

    @javax.jws.WebMethod(action="/nl/ordina/hr/model/service/common/mergeCustomersView",
    operationName="mergeCustomersView")
    @javax.xml.ws.RequestWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="mergeCustomersView")
    @javax.xml.ws.ResponseWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="mergeCustomersViewResponse")
    @javax.jws.WebResult(name="result")
    CustomersViewSDO mergeCustomersView(@javax.jws.WebParam(mode=javax.jws.WebParam.Mode.IN,
    name="customersView")
    CustomersViewSDO customersView) throws ServiceException;

    @javax.jws.WebMethod(action="/nl/ordina/hr/model/service/common/findCustomersView",
    operationName="findCustomersView")
    @javax.xml.ws.RequestWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="findCustomersView")
    @javax.xml.ws.ResponseWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="findCustomersViewResponse")
    @javax.jws.WebResult(name="result")
    List<CustomersViewSDO> findCustomersView(@javax.jws.WebParam(mode=javax.jws.WebParam.Mode.IN,
    name="findCriteria")
    FindCriteria findCriteria, @javax.jws.WebParam(mode=javax.jws.WebParam.Mode.IN,
    name="findControl")
    FindControl findControl) throws ServiceException;

    @javax.jws.WebMethod(action="/nl/ordina/hr/model/service/common/processCustomersView",
    operationName="processCustomersView")
    @javax.xml.ws.RequestWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="processCustomersView")
    @javax.xml.ws.ResponseWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="processCustomersViewResponse")
    @javax.jws.WebResult(name="result")
    List<CustomersViewSDO> processCustomersView(@javax.jws.WebParam(mode=javax.jws.WebParam.Mode.IN,
    name="changeOperation")
    String changeOperation, @javax.jws.WebParam(mode=javax.jws.WebParam.Mode.IN,
    name="customersView")
    List<CustomersViewSDO> customersView, @javax.jws.WebParam(mode=javax.jws.WebParam.Mode.IN,
    name="processControl")
    ProcessControl processControl) throws ServiceException;

    @javax.jws.WebMethod(action="/nl/ordina/hr/model/service/common/processCSCustomersView",
    operationName="processCSCustomersView")
    @javax.xml.ws.RequestWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="processCSCustomersView")
    @javax.xml.ws.ResponseWrapper(targetNamespace="/nl/ordina/hr/model/service/common/types/",
    localName="processCSCustomersViewResponse")
    @javax.jws.WebResult(name="result")
    ProcessData processCSCustomersView(@javax.jws.WebParam(mode=javax.jws.WebParam.Mode.IN,
    name="processData")
    ProcessData processData, @javax.jws.WebParam(mode=javax.jws.WebParam.Mode.IN,
    name="processControl")
    ProcessControl processControl) throws ServiceException;
    }



    package nl.ordina.hr.model.dataaccess.common;

    import oracle.sdo.SDODataObject;

    public class CustomersViewSDOImpl extends SDODataObject implements CustomersViewSDO {

    public static final int START_PROPERTY_INDEX = 0;

    public static final int END_PROPERTY_INDEX = START_PROPERTY_INDEX + 11;

    public CustomersViewSDOImpl() {}

    public java.lang.Integer getCustomerId() {
    return new Integer(getInt(START_PROPERTY_INDEX + 0));
    }

    public void setCustomerId(java.lang.Integer value) {
    set(START_PROPERTY_INDEX + 0 , value);
    }

    public java.lang.String getCustFirstName() {
    return getString(START_PROPERTY_INDEX + 1);
    }

    public void setCustFirstName(java.lang.String value) {
    set(START_PROPERTY_INDEX + 1 , value);
    }

    public java.lang.String getCustLastName() {
    return getString(START_PROPERTY_INDEX + 2);
    }

    public void setCustLastName(java.lang.String value) {
    set(START_PROPERTY_INDEX + 2 , value);
    }

    public java.lang.String getNlsLanguage() {
    return getString(START_PROPERTY_INDEX + 3);
    }

    public void setNlsLanguage(java.lang.String value) {
    set(START_PROPERTY_INDEX + 3 , value);
    }

    public java.lang.String getNlsTerritory() {
    return getString(START_PROPERTY_INDEX + 4);
    }

    public void setNlsTerritory(java.lang.String value) {
    set(START_PROPERTY_INDEX + 4 , value);
    }

    public java.math.BigDecimal getCreditLimit() {
    return getBigDecimal(START_PROPERTY_INDEX + 5);
    }

    public void setCreditLimit(java.math.BigDecimal value) {
    set(START_PROPERTY_INDEX + 5 , value);
    }

    public java.lang.String getCustEmail() {
    return getString(START_PROPERTY_INDEX + 6);
    }

    public void setCustEmail(java.lang.String value) {
    set(START_PROPERTY_INDEX + 6 , value);
    }

    public java.lang.Integer getAccountMgrId() {
    return new Integer(getInt(START_PROPERTY_INDEX + 7));
    }

    public void setAccountMgrId(java.lang.Integer value) {
    set(START_PROPERTY_INDEX + 7 , value);
    }

    public java.sql.Timestamp getDateOfBirth() {
    return (java.sql.Timestamp)get(START_PROPERTY_INDEX + 8);
    }

    public void setDateOfBirth(java.sql.Timestamp value) {
    set(START_PROPERTY_INDEX + 8 , value);
    }

    public java.lang.String getMaritalStatus() {
    return getString(START_PROPERTY_INDEX + 9);
    }

    public void setMaritalStatus(java.lang.String value) {
    set(START_PROPERTY_INDEX + 9 , value);
    }

    public java.lang.String getGender() {
    return getString(START_PROPERTY_INDEX + 10);
    }

    public void setGender(java.lang.String value) {
    set(START_PROPERTY_INDEX + 10 , value);
    }

    public java.lang.String getIncomeLevel() {
    return getString(START_PROPERTY_INDEX + 11);
    }

    public void setIncomeLevel(java.lang.String value) {
    set(START_PROPERTY_INDEX + 11 , value);
    }


    }

    ReplyDelete
  7. Thanks for posting this. It should give me all the information I need to tackle the problem, which as you said seems to be related to Tuscany's inability to handle JAX-WS annotations correctly. I'll post back here when I have more information or a fix you can try (probably a couple of weeks).

    ReplyDelete
  8. Hi Simon

    I have downloaded the 1.1 version and re-test my example. I am a little step further. If I debug then I see the customerService is looking well.
    But I want to retrieve the customer
    public CustomersViewSDO getCustomersView(Integer customerId){

    System.out.println("Called getCustomersView");
    return customerService.getCustomersView(customerId) ;

    then I got the following error


    java.lang.reflect.UndeclaredThrowableException:
    Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
    at $Proxy13.getCustomersView(Unknown Source)
    at nl.ordina.soa.sdo.CustomerServiceComponent.getCustomersView(CustomerServiceComponent.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationInvoker.invoke(JavaImplementationInvoker.java:105)
    at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:249)
    at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:146)
    at $Proxy13.getCustomersView(Unknown Source)
    at nl.ordina.soa.sdo.Launch.main(Launch.java:14)
    Caused by: org.apache.axis2.AxisFault: Unknown method
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486)
    at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
    at org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invokeTarget(Axis2BindingInvoker.java:101)
    at org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingInvoker.invoke(Axis2BindingInvoker.java:76)
    at org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:74)
    at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:249)
    at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:146)
    ... 11 more

    ReplyDelete
  9. Hi Simon,

    I am now testing oracle sdo ws with tuscany 1.2, this isn't working ,I tested with
    interface.wsdl interface="http://nl/ordina/sdo/service/common/serviceinterface/#wsdl.interface(OEServiceService)"

    I am getting this error

    4-mei-2008 20:24:19 org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl$1 problem
    WARNING: Component reference interface incompatible with reference interface: OEServiceComponent/OEService
    4-mei-2008 20:24:19 org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl$1 problem
    WARNING: Component reference interface incompatible with reference interface: OEServiceComponent/OEService
    Exception in thread "main" org.osoa.sca.ServiceRuntimeException: java.lang.NullPointerException
    at org.apache.tuscany.sca.host.embedded.SCADomain.createNewInstance(SCADomain.java:264)
    at org.apache.tuscany.sca.host.embedded.SCADomain.newInstance(SCADomain.java:69)
    at nl.ordina.tuscany.Test.main(Test.java:11)
    Caused by: java.lang.NullPointerException
    at org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceClient.createServiceClien


    If I use interface.java interface="nl.ordina.sdo.service.common.serviceinterface.OEServiceService"

    then I got this error

    Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
    Called getCustomersView
    Exception in thread "main" org.apache.tuscany.sca.databinding.TransformationException: No wrapper handler is provided for databinding: null
    at org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer.getWrapperHandler(Input2InputTransformer.java:204)
    at org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer.transform(Input2InputTransformer.java:103)
    at org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer.transform(Input2InputTransformer.java:43)
    at org.apache.tuscany.sca.databinding.impl.MediatorImpl.mediate(MediatorImpl.java:73)
    at org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.transform(DataTransformationInterceptor.java:186)
    at org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:76)
    at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:286)
    at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:154)
    at $Proxy15.getCustomersView1(Unknown Source)

    Maybe you know the solution

    Thanks

    ReplyDelete
  10. Hi Edwin,
    Unfortunately the stack trace for your interface.wsdl attempt with 1.2 is truncated at the vital point! Please can you post a full stack trace. Or even better (if you are able to do this) would be to open a Tuscany JIRA and attach your stack trace, WSDL and client code.

    The interface.java problem looks similar to the earlier problem that was caused by Tuscany's inability to handle JAX-WS annotations correctly. The good news here is that we have made a lot of progress with fixing these problems, and I think it is pretty much working now with JAXB. The next step is to get it working with SDO as well.

    ReplyDelete
  11. Hi Simon,

    Thanks for the reply. When you are ready with the sdo code, give me a reply and I will test this.

    For the other problem I will open a Jira call.

    ReplyDelete
  12. Hi Simon.

    I tried the new Tuscany and I am almost there I had to change CustomerSDO to the Impl in the service else I got a jaxb interface error.

    But now I got this error maybe you know the solution.

    2-sep-2008 22:02:07 org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator
    WARNING: Exception while generating WSDL for OEServiceComponent/OEService
    2-sep-2008 22:02:07 org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator
    SEVERE: Exception thrown was: org.osoa.sca.ServiceRuntimeException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
    commonj.sdo.DataGraph is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
    at commonj.sdo.DataGraph
    at public commonj.sdo.DataGraph oracle.sdo.SDODataObject.getDataGraph()
    at oracle.sdo.SDODataObject
    at nl.ordina.sdo.dataaccess.common.CustomersViewSDOImpl
    commonj.sdo.DataGraph does not have a no-arg default constructor.
    this problem is related to the following location:
    at commonj.sdo.DataGraph
    at public commonj.sdo.DataGraph oracle.sdo.SDODataObject.getDataGraph()
    at oracle.sdo.SDODataObject
    at nl.ordina.sdo.dataaccess.common.CustomersViewSDOImpl

    thanks Edwin

    ReplyDelete
  13. Edwin,
    Did you manage to overcome remaining issues with Tuscany? I am interested on using Tuscany instead of Oracle SOA for small clients where price of Oracle SOA will not fit budget.
    Did you try your blog with current Jdeveloper 11g as well?

    Thanks in advance
    Robert

    ReplyDelete
  14. Hi,

    Great plan , I will try it again.
    and update this post.

    thanks Edwin

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. Hi,

    I got it working, I just need to generate a ws proxy client ( it works with adf-bc sdo ws and jax-ws service ) and use this and the jar of the service.

    make a implemention

    package nl.whitehorses.tuscany.service;

    import org.osoa.sca.annotations.Reference;

    import nl.whitehorses.soa.ws2.proxy.HrModuleService;
    import nl.whitehorses.soa.ws2.proxy.ServiceException;
    import nl.whitehorses.soa.ws2.proxy.types.EmployeesViewSDO;


    public class HrModuleComponent implements HrModuleService {

    private HrModuleService hrModule;

    @Reference
    public void setHrModule(HrModuleService hrModule) {
    this.hrModule = hrModule;
    }


    public EmployeesViewSDO getEmployeesView1(int employeeId) throws ServiceException {
    System.out.println("Called getEmployeesView");
    return hrModule.getEmployeesView1(employeeId);
    }
    }


    and use this in the composite

    <component name="HrModuleComponent">
    <implementation.java class="nl.whitehorses.tuscany.service.HrModuleComponent" />
    <reference name="hrModule">
    <binding.ws uri="http://localhost:7101/ADF_BC_SDO-Model-context-root/HrModuleService"/>
    </reference>
    </component>

    and then it works perfectly

    ReplyDelete
  18. Hi Edwin,
    Thanks for fast feedback. I will play with it. So far i have tried to approach to problem to make Tuscany and ADF BC working without WS just to simplify it and allow for example to run some processes within same transaction using policy in Tuscany but I am not very successful so far :-D/

    Thanks again.

    ReplyDelete
  19. Ok,

    then you can better use adf-bc standalone and make a java component in tuscany.

    http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcservices.htm#ADFFD1539

    String amDef = "devguide.model.StoreFrontService";
    String config = "StoreFrontServiceLocal";
    /*
    * This is the correct way to use application custom methods
    * from the client, by using the application module's automatically-
    * maintained custom service interface.
    */
    // Acquire instance of application module, cast to client interface
    StoreFrontService service =
    (StoreFrontService)Configuration.createRootApplicationModule(amDef,config);
    String total = service.findOrderTotal(1011);

    Or use eclipselink , this is license free and can be configured in jdevelope

    EntityManager em = null;
    try {
    em = Persistence.createEntityManagerFactory("CompanyUnit")
    .createEntityManager();
    Employee emp = em.find(Employee.class, id);
    em.getTransaction().begin();
    emp.setVacationHours(newval);
    em.getTransaction().commit();
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    em.close();
    interrupt();
    }

    ReplyDelete