You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Sebastián Groh (JIRA)" <de...@tuscany.apache.org> on 2009/05/30 00:04:45 UTC
[jira] Created: (TUSCANY-3067) WS bindings and SDO
WS bindings and SDO
-------------------
Key: TUSCANY-3067
URL: https://issues.apache.org/jira/browse/TUSCANY-3067
Project: Tuscany
Issue Type: Bug
Components: Java SCA Data Binding Runtime
Affects Versions: Java-SCA-1.4
Environment: S.O: Linux, (Kernel Version 2.6.24-24-generic)
Development tool: Eclipse Platform (Version: 3.4.0)
Application server: Apache Tomcat/5.5.27
Reporter: Sebastián Groh
Brief description:
I have a composite, this contains a service that have an ws binding, this service only retrieve a SDO object.
This example is helloworld-ws-sdo-webapp based, but the difference is that SDO object not is passed as parameter
in this case the SDO object is returned.
Here I put all needed for replicate the bug
My XSD file is:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://eclipse.org/SCAExample1/src/resources/clinicalLaboratory"
xmlns:tns="http://eclipse.org/SCAExample1/src/resources/clinicalLaboratory"
elementFormDefault="qualified">
<complexType name="Practice">
<sequence>
<element name="name" type="string" />
</sequence>
</complexType>
<complexType name="Laboratory">
<sequence>
<element name="name" type="string" />
<element name="practices" type="tns:Practice" maxOccurs="unbounded"/>
</sequence>
</complexType>
</schema>
Composite file:
<?xml version="1.0" encoding="UTF-8"?>
<sca:composite xmlns:federation="http://eclipse.org/SCAExample1/src/resources/federation"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
name="clinicalLaboratory" targetNamespace="http://eclipse.org/SCAExample1/src/resources/clinicalLaboratory">
<sca:component name="BiochemicalCircleComponent">
<sca:implementation.java class="services.bcircle.BiochemicalCircleImpl"/>
<sca:service name="BiochemicalCircle">
<sca:interface.java interface="services.bcircle.BiochemicalCircle"/>
<sca:binding.ws uri="http://localhost:8080/SCA1/MyServiceComponent"/>
</sca:service>
</sca:component>
<sca:service name="BiochemicalCircle" promote="BiochemicalCircleComponent/BiochemicalCircle"/>
</sca:composite>
Interface file:
package services.bcircle;
import java.util.ArrayList;
import javax.xml.bind.annotation.XmlType;
import model.sdo.EntityFactory;
import org.apache.tuscany.sca.databinding.annotation.DataBinding;
import org.osoa.sca.annotations.Remotable;
@Remotable
public interface BiochemicalCircle{
void setLaboratory(model.sdo.Laboratory lab);
model.sdo.Laboratory getLaboratory(String name);
}
Interface implementation:
package services.bcircle;
import model.sdo.EntityFactory;
import model.sdo.Laboratory;
import org.osoa.sca.annotations.Service;
@Service(BiochemicalCircle.class)
public class BiochemicalCircleImpl implements BiochemicalCircle{
public Laboratory getLaboratory(String name) {
Laboratory lab = EntityFactory.INSTANCE.createLaboratory();
lab.setName("Main Laboratory");
return lab;
}
public void setLaboratory(Laboratory lab) {
//sad method
System.out.println(lab.getName());
}
}
My Test class:
package test;
import model.sdo.EntityFactory;
import model.sdo.Laboratory;
import org.apache.tuscany.sca.host.embedded.SCADomain;
import services.bcircle.BiochemicalCircle;
import services.bcircle.BiochemicalCircleImpl;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
BiochemicalCircle biochemicalCircl = new BiochemicalCircleImpl();
Laboratory lab2 = biochemicalCircl.getLaboratory("Lab2"); //This invocation without use SCA works ok.
SCADomain scaDomain = SCADomain.newInstance("resources/clinicalLaboratory.composite");
BiochemicalCircle biochemicalCircle = scaDomain.getService(
BiochemicalCircle.class, "BiochemicalCircleComponent");
Laboratory lab = EntityFactory.INSTANCE.createLaboratory();
lab.setName("lab2");
biochemicalCircle.setLaboratory(lab); // this invocation works ok too
lab = biochemicalCircle.getLaboratory("Lab2"); // here I have an exception posted below.
//here I wait a moment before close scaDomain
scaDomain.close();
}
Exception:
Exception in thread "main" java.lang.ClassCastException: org.apache.tuscany.sdo.impl.AnyTypeDataObjectImpl
at $Proxy16.getLaboratory(Unknown Source)
at test.Test.main(Test.java:28)
Note:
EntityFactory and sdo objects where created using org.apache.tuscany.sdo.generate.XSD2JavaGenerator.
Another possibility to replicate this bug is modifying helloworld-ws-sdo-webapp, for example
change
public String getGreetings(Party party) { .... }
for something like
public Person getFirstPerson(Party party) {
// Assuming that party have elements
return party.getPeople().get(index);
}
Thanks,
Sebastián.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.