Hi Brice,
Quick question, what's the relationship between calculator.wsdl and
calculatorUser.wsdl? Does calculatorUser.wsdl import calculator.wsdl?
Freeman
Fullocto wrote:
Hi all,
I created one service (calculator) using CXF SE and its consumer (it works).
Now I am creating two services : the pervious one (calculator) and an other
one (calculatorUser) that uses the add function of calculator.
I created the archives.
I deployed the first SA (calculator)
but I can't deploy the second SA in SMX :( :
- it asks for the calculator.wsdl (java.io.FileNotFoundException:
calculator.wsdl is not found)
--> I added it into the archive but it didn't solve the problem.
I am now wondering if i misunderstood how to use proxies.
http://servicemix.apache.org/servicemix-cxf-se.html :
In my case GreeterImpleForClientProxy is CalculatorUser2Impl and I want to
access from this class to the methods implemented in the calculatorImpl
(whose interface is Calculator).
here is my xbean.xml of my SE service unit: calculatorEndpoint is the name
of my endpoint (calculator SA was deployed)
<beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0"
xmlns:calculator="http://brice.mycompany.com/calculator"
xmlns:calculatorUser="http://brice.mycompany.com/calculatorUser">
<cxfse:endpoint>
<cxfse:pojo>
<bean class="com.mycompany.brice.calculatoruser.CalculatorUser2Impl">
<property name="calculator">
<cxfse:proxy endpoint="calculator:CalculatorEndpoint" context="#context"
type="com.mycompany.brice.calculator.Calculator" />
</property>
</bean>
</cxfse:pojo>
</cxfse:endpoint>
</beans>
Here is my class: so I think that the xbean.xml file will find the attribute
calculator whose type is com.mycompany.brice.calculator.Calculator and link
it to the endpoint.
/**
* Please modify this class to meet your needs
* This class is not complete
*/
package com.mycompany.brice.calculatoruser;
import javax.jbi.component.ComponentContext;
import java.util.logging.Logger;
import javax.jws.WebMethod;
import javax.jws.WebResult;
import com.mycompany.brice.calculator.Calculator;
import com.mycompany.brice.calculator.AddRequest;
/**
* This class was generated by IONA FUSE Services Framework 2.0.3.2-fuse
* Mon May 05 10:08:28 CEST 2008
* Generated source version: 2.0.3.2-fuse
*
*/
@javax.jws.WebService(name = "CalculatorUser2", serviceName =
"calculatorUser2Endpoint",
portName = "endpoint",
targetNamespace =
"http://brice.mycompany.com/calculatorUser",
wsdlLocation = "file:calculatorUser.wsdl" ,
endpointInterface =
"com.mycompany.brice.calculator.CalculatorUser2")
public class CalculatorUser2Impl implements CalculatorUser2 {
private static final Logger LOG =
Logger.getLogger(CalculatorUser2Impl.class.getName());
/*
* Utilisation du service calculator en proxy
*/
private ComponentContext context;
private Calculator calculator;
private AddRequest addRequest = new AddRequest();
/* (non-Javadoc)
* @see com.mycompany.brice.calculator.CalculatorUser2#multiplyBy2(int
parameters )*
*/
public int multiplyBy2(int parameters) {
LOG.info("Executing operation multiplyBy2");
System.out.println(parameters);
try {
System.out.println("Utilisation du proxy ");
addRequest.setNb1(parameters);
addRequest.setNb2(parameters);
int _return = getCalculator().add(addRequest);
return _return;
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
public void setCalculator(Calculator calculator) {
this.calculator = calculator;
}
public Calculator getCalculator(){
return calculator;
}
public ComponentContext getContext(){
return context=context;
}
public void setContext(ComponentContext context){
this.context=context;
}
}
In my service unit, I put 3 java classes: calculator.AddRequest.java (the
complex type), calculator.Calculator.java and
calculatorUser.CalculatorUser2Impl and I let CXF generate the different
files from the WSDL. I also added calculator.wsdl and calculatorUser.wsdl in
the SU.zip
But why does it need the calculator.wsdl?
Also why do I need to give all the classes used? Maybe I can use the shared
libraries to put all the classes used by proxied services??
What did I forget?
Thank you for your help
Brice