The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

likebean (11) [Avatar] Offline
#1
Hi,I am newbie about SCA,and I expect the book.I study the example of Tuscany,and I feel SCA is only let program

more simple,but in essentially,It is same as invoking B service component in A component by coding throught Axis or

xfire client. i.e, It's architecture is point-to-point,It is not recommend by ESB.
So,how about using ESB and SCA?I am confused.

Best RGDS
simon.nash (37) [Avatar] Offline
#2
Re: confused about SCA
Thanks for asking about this. It's an important question.

There are different aspects to SCA. One very important aspect is a programming model for services that isn't specific to a particular network protocol. If you write client and service code using Axis, the client and service are tied to Web Services. If you write client and service code using SCA, the client and service can be configured to use any protocol, for example Web Services, JMS, or CORBA. This flexibility is very useful for deployment in ESBs because it allows the protocol to be chosen at deployment or administration time rather than at development time. So in this respect, SCA and ESBs are very complementary.

As well as this protocol-neutral programming model, SCA provides a wiring framework. In a ESB, connection endpoints for wires can be chosen dynamically and configured by the ESB. This is another advantage over Axis, where the client chooses which service it will invoke.

SCA connections between clients and services currently use a point-to-point model, as you say. There has been some work on designing an event model for SCA which would extend SCA to provide multi-point relationships, but this is still work in progress and there isn't yet a published specification.

In summary, SCA can be used with ESBs today and provides valuable flexibilty through its programming model and wiring model. In the future, the SCA event model will extend the current point-to-point wiring model to support multi-point relationships.

Best regards
Simon
likebean (11) [Avatar] Offline
#3
Re: confused about SCA
Hi Simon,Thanks for your reply first,But what's meaing about your said:

"This flexibility is very useful for deployment in ESBs because it allows the protocol to be chosen at deployment or administration time rather than at development time."

do you want to express

"This flexibility is very useful for deployment in SCA because it allows the protocol to be chosen at deployment or administration time rather than at development time."?

and

"In a ESB, connection endpoints for wires can be chosen dynamically and configured by the ESB."

do you want to express

"In a SCA, connection endpoints for wires can be chosen dynamically and configured by the SCA."?

I am like programming mode and wiring mode SCA provide,just like I like spring.

But my question is about SCA and ESB. ESB recommend bus mode instead of point-to-point mode SCA provide ,if I use SCA in my project,I face some disadvantage of point-to-point mode and how can I use SCA and ESB in my project? some example present is appreciated.

Best regards
simon.nash (37) [Avatar] Offline
#4
Re: confused about SCA
I was talking about an ESB that has knowledge of SCA. An ESB vendor could embed or enable Tuscany to provide the capabilities that I mentioned. If they don't do that, these capabilities would not be available "out of the box".

You might be able to do what you want by writing a custom binding for Tuscany. You could take a look at the binding-notification samples in Tuscany to see an example of doing this. Which ESB are you using? Can you say a bit more about the application scenario?

Best regards,
Simon
likebean (11) [Avatar] Offline
#5
Re: confused about SCA
Thanks,I want to use servicemix,but found its configration is complex,so I like SCA.
If I want to use webserivce like amazon in my java client component,need I write
a java interface corresponding amazon wsdl first?
simon.nash (37) [Avatar] Offline
#6
Re: confused about SCA
The easiest way is to generate the Java client interface from the Amazon WSDL using JAX-WS. You can use the wsimport command in JDK6 to do this. Then you can use the generated Java interface as the type of an SCA reference in a Tuscany Java client component. When you configure the client reference in your client component definition, you have two choices.

Option 1: You can use a reference definition like
<reference name="name of the reference">
<binding.ws uri="the URI of the Amazon service"/>
</reference>

Option 2: You can use a reference definition like
<reference name="name of the reference">
<binding.ws wsdlElement="<WSDL-namespace-URI>#wsdl.port(<service-name>/<port-name>smilie"/>
</reference>
and include the Amazon WSDL in your SCA contribution.

Option 1 is simpler, but I'm not sure how well it has been tested. If it doesn't work for the Amazon web service, changing to option 2 might make things work better.
likebean (11) [Avatar] Offline
#7
Re: confused about SCA
Thanks.But I think generate from wsdl to java interface is a troubled way...Is there some way like dynamic invoke in xfire webservice client.not need to generate java interface.
Sometime,I am confused why not need SCA.spring+ws-support+IOC config is sufficient.
simon.nash (37) [Avatar] Offline
#8
Re: confused about SCA
To define an SCA reference in a Java implementation, you need to use a Java interface to declare the reference. The SCA Java programming model does not currently have a way to dynamically invoke an SCA Java reference without a Java interface. It would be possible to do this using some other Web Services stack like XFire directly from within an SCA component.

Chapter 2 of Apache Tuscany in Action explains various advantages of using SCA. These advantages are mostly in the area of flexibility in composing services and the ability to externally configure various aspects of a service implementation without changing the code. For some applications, these things are very important. The alternatives that you have mentioned don't provide as much flexibility and configurability as SCA.
likebean (11) [Avatar] Offline
#9
Re: confused about SCA
Thanks for reply and we have four existing web application basing j2ee technology,and now we want to construct a new system to provide composite-service basing these existing web application.and the new system is basing j2ee technology too.I think if using SCA.we need modify existing four web application by adding SCA layer and runtime.(including provide new java interface
fit the request of new composite-service system,and add TuscanyServletFilter to web.xml...),then expose this interface as webservice throught SCA config.
After these existing applications modification complete,we can consume these webservice provide by these existing applications in the new system throught SCA config.

Is this a right way? please give me any advice.

Another question,if the way described above is right,how to process complex argument(java object) when these existing application providing java interface,I feel the appropriate way is SDO.
but can not find any demo usage in tuscany..any example is appreciated!

Thanks and Best regards.
likebean (11) [Avatar] Offline
#10
Re: confused about SCA
Thanks for reply and we have four existing web application basing j2ee technology,and now we want to construct a new system to provide composite-service basing these existing web application.and the new system is basing j2ee technology too.I think if using SCA.we need modify existing four web application by adding SCA layer and runtime.(including provide new java interface
fit the request of new composite-service system,and add TuscanyServletFilter to web.xml...),then expose this interface as webservice throught SCA config.
After these existing applications modification complete,we can consume these webservice provide by these existing applications in the new system throught SCA config.

Is this a right way? please give me any advice.

Another question,if the way described above is right,how to process complex argument(java object) when these existing application providing java interface,I feel the appropriate way is using SDO.so the existing application must provide java interface and some xsd files(need by SDO),and java interface like following :

public DataObject saveOrder(DataObject argument);

and existing application may involve work translating DataObject to existing POJO java class and inverse too.

Is this a right way?

Thanks and Best regards.

Message was edited by:
likebean
simon.nash (37) [Avatar] Offline
#11
Re: confused about SCA
Yes, you can modify an existing Web application in the way you have described so that it can be invoked from other Tuscany SCA components. In the future Tuscany will provide more ways to integrate SCA with JEE, but this simple webapp approach is a good one to use for now. The "webapp" samples in Tuscany show how to do this.

For complex data type support in Java you can use either JAXB or SDO. In both cases it's best to start with WSDL and XSD and generate Java interfaces or classes from WSDL and XSD. The advantage of SDO over JAXB is that SDO can be used with other languages than Java. For complex types in Java my personal preference would be to use JAXB. This produces POJOs with annotations, and I find it easier to work with these than to use SDO.
likebean (11) [Avatar] Offline
#12
Re: confused about SCA
Hi simon,when I write java interface like:
public DataObject test(DataObject param);
then use binding:ws in define service,then the wsdl generated by tuscany like following:
....
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="unqualified" >
targetNamespace="http://baseinfo.demo.tuscany.wiscom.com/" xmlns:ns0="http://sdo.commonj/"
xmlnssmilies="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://sdo.commonj/"/>
<xs:element name="test">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="arg0" nillable="true" type="ns0:dataObject"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="testResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="ns0:dataObject"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>

so It will force webservice consumer use sdo too,It seems not a good idea.
any advice?

And I try to modify the generated wsdl to replace '<wsdl:types>...sdo.commonj...' in with following common style:

....

<xsd:complexType name="BaseInfo">
<xsd:sequence>
<xsd:element name="id" type="xsd:int"/>
<xsd:element name="name" type="xsd:string"/>
<xsd:element name="bornDate" type="xsd:date"/>
<xsd:element name="graduated" type="xsd:boolean"/>
<xsd:element name="address" type="Address"/>
<xsd:element name="familyMembers" type="FamilyMembers"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="Address">
<xsd:sequence>
<xsd:element name="conntry" type="xsd:string"/>
<xsd:element name="city" type="xsd:string"/>
<xsd:element name="street" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
....

then modify binding:ws to using existing wsdl file,but It seems that tuscany generate new wsdl insistently,any config-example is appreciated.
simon.nash (37) [Avatar] Offline
#13
Re: confused about SCA
If you want to use SDO for the Java interfaces, you will need to start with WSDL and generate the Java SDO interfaces from that. It's not a very simple process and we don't have good examples in Tuscany for how to do this.

From your post I think you don't already have WSDL/XSD files for the interface. In this case I would recommend starting from Java POJOs and using JAX-WS (the wsgen tool in JDK 6) to generate a WSDL file and XSDs. You can then edit the WSDL and XSDs to clean it up and do what you need for type definitions, and you can use the cleaned up WSDL file in an <interface.wsdl> or <binding.ws> element. The cleaned up WSDL and XSDs shouldn't have any dependencies on Java, JAXB, or SDO.

For your Java implementation, you can generate a JAX-WS interface from the cleaned up WSDL file using wsimport from JDK 6. This will contain various JAX-WS and JAXB annotations. You shouldn't edit this generated Java interface, just use in in your implementation code.

Here is a summary of the steps to follow.

1. Create a POJO Java interface that is approximately what you want to do.
2. Generate a WSDL and XSD from the POJO Java interface using wsgen.
3. Edit the WSDL and XSD to clean them up and tweak the data types and namespaces so that there are no dependencies on Java or JAX-WS.
4. Use the cleaned up WSDL and XSD in your <binding.ws> and <interface.wsdl>.
5. Generate a JAX-WS Java interface from the WSDL and XSD using wsimport.
6. Use the generated Java interface in your Java implementation code. You don't need the POJO interface from step 1 any more.
7. When you need to make changes to the interface, repeat steps 3 / 4 / 5. Don't edit the generated Java interface directly.

I think you will find this approach a lot easier than trying to make SDO work.
likebean (11) [Avatar] Offline
#14
Re: confused about SCA
Hi simon,thanks for your advice about using JAX-WS.but the reason I choice SDO is wanting to use it's dynamic feature(Dynamic Data API).I hate code generated,I think that will induce maintain cost:if service provider modify the data model,it will impact many.
And in the future, I want to add mediation(e.g ESB) between service provider and consumer to do somting like SDO dataobject translation.
And I can not find any example accord with my idea.
It is strange that why not tuscany generate a common WSDL(not including commonj.sdo..) for the java interface like:
public DataObject test(DataObject obj);

I agree manual-editing xsd firstly,but I wish tuscany can generated a common wsdl basing java interface and the existing xsd file,so non-sdo client can using this web service.
simon.nash (37) [Avatar] Offline
#15
Re: confused about SCA
OK, I understand what you would like to do. I don't know if anyone has done this successfully. I have used static SDO with SCA, starting from WSDL and generating SDO static interfaces and classes. I have not used dynamic SDO with SCA and I am not aware that anyone else has. It is hard to use dynamic SDO with WSDL because the WSDL needs to include exact details of the types being sent and received. The Tuscany SDO download includes some examples of using dynamic SDO, but these are standalone and not in conjunction with SCA.

The best way to get more information about this would be to ask a question on the Tuscany mailing list. We have a user mailing list user@tuscany.apache.org and a developer mailing list dev@tuscany.apache.org. The user list is for discussions about using Tuscany and the developer list is for discussions about development of the Tuscany code. This question about using dynamic SDO with SCA is a user question so I would suggest posting it to the user list. There are people on that list who know about SDO and one of them should be able to say whether this is possible and explain how to do it.
vyurik (76) [Avatar] Offline
#16
Re: confused about SCA
Hi Simon,
My reading of what you've described is that I can use any external web service (without knowledge of the specific technology, like .NET, it's generated with) that exposes a WSDL file and using SCA create a Java client that uses these services.
Do you know of any practical example/sample that uses this idea.

Also, it would be good if the inverse scenario works: a JEE app exposes a web service with WSDL and .NET client using SCA consumes the service. But so far, SCA has no C# support. Is it doable with some wrapper? Some other approach?

Regards,
Vitaly

Message was edited by:
vyurik
simon.nash (37) [Avatar] Offline
#17
Re: confused about SCA
There are some samples in the Tuscany binary distribution that call external Web services defined using WSDL. Take a look at helloworld-ws-reference to see how to set up an SCA client to use a port defined in an existing WSDL file. The WSDL file could have been generated by any Web service implementation, including .NET. Tuscany also provides an example of implementing this Web service using Tuscany SCA Java (see the helloworld-ws-service sample). This is only an example and there is no requirement to use SCA Java on the Web service implementation side.

Tuscany currently doesn't support using SCA within a .NET environment, and doesn't have a C# implementation type. The SCA specs also don't define these. It's easy to consume SCA services from .NET by exposing the SCA services using binding.ws and writing C# .NET Web service client code to call these services. This should handle most integration needs.

For fully native SCA support for C# or .NET, I'm sure the Tuscany project would be very interested to hear from anyone who wants to work on adding this.