Re: WebServiceContext not injected in endpoint

2008-02-28 Thread Li, Weiye
As a matter of fact, it works for even 2.0.4. I tried it yesterday, this 
context got injected and I could get request back indirectly from it.
Well, I used Spring bean for all my test.


On 2/28/08 3:07 AM, Davide Gesino [EMAIL PROTECTED] wrote:



Hi Dan,

I have used this CXF 2.1 snapshot.
apache-cxf-2.1-incubator-20080228.032802-34.zip   28-Feb-2008 04:16   24M
I have tried this code, and actually the context is not injected. maybe I am
doing something wrong.
With the SingletonFactory it happens the same. Maybe the fault is the way I
create the service.
Anyway the creation policy works fine, with the PerSessionFactory I have a
brand new instance created for each request I get.

Here is the code:

Object implementor = new GreeterImpl();
String address = http://localhost:9000/SoapContext/SoapPort;;
org.apache.cxf.service.invoker.Factory factory = new
org.apache.cxf.service.invoker.PerRequestFactory(GreeterImpl.class);
org.apache.cxf.service.invoker.Factory factory = new
org.apache.cxf.service.invoker.SingletonFactory(GreeterImpl.class);
JAXWSMethodInvoker invoker = new JAXWSMethodInvoker(factory);
JaxWsServerFactoryBean factoryBean = new JaxWsServerFactoryBean();
factoryBean.setAddress(address);
factoryBean.setServiceBean(implementor);
factoryBean.setInvoker(invoker);
factoryBean.create();

@javax.jws.WebService(name = Greeter, serviceName = SOAPService,
portName = SoapPort, targetNamespace =
http://apache.org/hello_world_soap_http;, wsdlLocation =
hello_world.wsdl, endpointInterface =
org.apache.hello_world_soap_http.Greeter)
public class GreeterImpl implements Greeter {

@Resource
private WebServiceContext context;

public java.lang.String greetMe(java.lang.String requestType) {
LOG.info(Executing operation greetMe);

System.out.println(requestType);

if (context != null) {
System.out.println(context properly injected);
}
 else System.out.println(context properly is null!!);
return hello my dear;
}


--
View this message in context: 
http://www.nabble.com/WebServiceContext-not-injected-in-endpoint-tp15708465p15732342.html
Sent from the cxf-user mailing list archive at Nabble.com.







What jars files are not required on client side

2008-02-26 Thread Li, Weiye
I just started to use CXF with Spring. There're 23 jars required for the 
integration of Spring and CXF on the document ( 
http://cwiki.apache.org/CXF20DOC/writing-a-service-with-spring.html )

Are those all required on client side? Are there any only required for Server 
side? Thanks.



Re: How to pass a HashMap

2008-02-25 Thread Li, Weiye
Should be the latest one:2.0.4
Thanks for the reply.


On 2/23/08 11:49 AM, Benson Margulies [EMAIL PROTECTED] wrote:

What version of CXF have you got?


On Fri, Feb 22, 2008 at 4:39 PM, Li, Weiye [EMAIL PROTECTED] wrote:

 The CXF document says that Aegis data binding can even works on Map. I
 tried this, but it always return an empty one. Here's my testing codes. Did
 I miss something? Or I need to write special config file?




 @WebService(name=EmicroManager, targetNamespace=http://test.emicro )
 @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
 ParameterStyle.WRAPPED)
 public interface EmicroService {
  @WebMethod
  @RequestWrapper(className=test.model.Employee,
  localName=employee, targetNamespace=
 http://test.emicro/types )
  @Oneway
  public void addEmployee(Employee emp);


  @WebMethod(operationName=getEmployeesAsMap)
  @ResponseWrapper(className=java.util.HashMap,
  localName=EmployeesMap, targetNamespace=
 http://test.emicro/types;)
  public Map getEmployeesMap();

 }





 public static void main(String args[]) throws Exception {

  JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();

  factory.setServiceClass(test.EmicroService.class);

  factory.setAddress(http://localhost:9080/emicro-ws/EmicroService;);

  factory.getServiceFactory().setDataBinding(new AegisDatabinding());



  EmicroService client = (EmicroService)factory.create();



// add 2 employees here, then



MapInteger, Employee emap = client.getEmployeesMap();

logger.info(emap);



System.exit(0);

}



 The backend configuration is just following the CXF tutorial
 bean id=aegisBean class=
 org.apache.cxf.aegis.databinding.AegisDatabinding scope=prototype/



  bean id=jaxws-and-aegis-service-factory

class=org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
 scope=prototype

property name=dataBinding ref=aegisBean /

property name=serviceConfigurations

  list

bean class=
 org.apache.cxf.jaxws.support.JaxWsServiceConfiguration /

bean class=
 org.apache.cxf.aegis.databinding.AegisServiceConfiguration /

bean class=
 org.apache.cxf.service.factory.DefaultServiceConfiguration /

  /list

/property

  /bean





  bean id=emicro class=org.stjude.ri.emicro.ws.EmicroServiceImpl
 /



  jaxws:endpoint id=helloWorld implementor=#emicro
 address=/EmicroService

jaxws:serviceFactory

  ref bean='jaxws-and-aegis-service-factory' /

/jaxws:serviceFactory

  /jaxws:endpoint





 Any advice? Thanks








Re: How to pass a HashMap

2008-02-25 Thread Li, Weiye
I think I may have to declare .aegis.xml.
It was my 2nd try (I mean, use Map only). I did use MapInteger, Employee on 
my first try and the outcome is the same: empty map returned.

On 2/24/08 12:09 PM, Benson Margulies [EMAIL PROTECTED] wrote:

It does work. But you have to tell it what's in the map. Either declare the
type as

MapA,B, or use a .aegis.xml file to tell it.

 
 
 
  @WebService(name=EmicroManager, targetNamespace=http://test.emicro )
  @SOAPBinding(style=Style.RPC, use=Use.LITERAL, parameterStyle=
  ParameterStyle.WRAPPED)
  public interface EmicroService {
   @WebMethod
   @RequestWrapper(className=test.model.Employee,
   localName=employee, targetNamespace=
  http://test.emicro/types )
   @Oneway
   public void addEmployee(Employee emp);
 
 
   @WebMethod(operationName=getEmployeesAsMap)
   @ResponseWrapper(className=java.util.HashMap,
   localName=EmployeesMap, targetNamespace=
  http://test.emicro/types;)
   public Map getEmployeesMap();
 



How to work with document type?

2008-02-25 Thread Li, Weiye
My testing Jax-WS with Aegis worked only with RPC style. When I changed 
soapbinding with RPC style, the same codes give exception. Here's my WS file:

@WebService(name=EmicroManager, targetNamespace=http://emicro.test;) 
@SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL, 
parameterStyle=ParameterStyle.WRAPPED) public interface EmicroService {
.
}

When client tried to use the service: ws.addEmployee(Employee) or any other 
method, exception thrown as:
Feb 25, 2008 9:32:29 AM org.apache.cxf.phase.PhaseInterceptorChain doIntercept 
INFO: Interceptor has thrown exception, unwinding now 
org.apache.cxf.interceptor.Fault: NO_MESSAGE_FOR_PARTat 
org.apache.cxf.aegis.databinding.XMLStreamDataWriter.write(XMLStreamDataWriter.java:72)
at 
org.apache.cxf.aegis.databinding.XMLStreamDataWriter.write(XMLStreamDataWriter.java:45)
at 
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:93)
at 
org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)at 
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)at 
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)at 
$Proxy24.addEmployee(Unknown Source)


Where the Employee extends a base class People. Both of them are simple 
Java bean.

The same codes works if I change DOCUMENT to RPC. I believe I must miss 
something, but what's that?
Help?

Thanks.