Similar as the service side:

Node  node = 
NodeFactory.newInstance().createNode(""helloworldwsclient.composite", 
this.getClass().getClassLoader()).start();
HelloWorldService helloWorldService  = node.getService(HelloWorldService.class, 
"HelloWorldServiceComponent"); 
...


From: amit patel 
Sent: Friday, December 04, 2009 8:02 AM
To: user@tuscany.apache.org ; antel...@apache.org 
Subject: Re: tuscany 2 and SCADomain


Thanks!

So I was able to start the service

Now what do I change the client code to?

SCADomain scaDomain = SCADomain.newInstance(

"helloworldwsclient.composite"); 
HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.

class, "HelloWorldServiceComponent"); 

OMFactory fac = OMAbstractFactory.getOMFactory();

OMElement imageElement = fac.createOMElement(

"image", null); 

// Creating the Data Handler for the file. 
DataHandler dataHandler = 

new DataHandler(new FileDataSource("C:/attachedfile.jpg")); 

//create an OMText node with the above DataHandler and set optimized to true 
OMText textData = fac.createOMText(dataHandler, 

true); 
imageElement.addChild(textData); 


String value = helloWorldService.getGreetings(

"attachedfile.jpg", imageElement); 
System.

out.println(value); 

scaDomain.close();

Reply via email to