You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jan Kriesten <ja...@renitence.de> on 2007/06/26 13:47:45 UTC

marshalling error

hi,

i'm trying to get warm with cxf, but i run into mor problems.

i'm trying to set up a remote authentication service using acegi and want to
return a 'Authentication'-object.

but neither jaxb- nor aegis-binding seems to be able to handle this object, i
get the following exception:

---8<---
org.apache.cxf.binding.soap.SoapFault: Marshalling Error:
org.acegisecurity.Authentication is not known to this context
     at
org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:70)
---8<---

do i have to write my own in-/outhandlers for this?

best regards, --- jan.


Re: marshalling error

Posted by Jan Kriesten <ja...@renitence.de>.
Hi Freeman,

> Since Authentication is an interface, so your real message response
> should have an object(let's say it's instance of AuthenticationImpl)
> which implement Authentication, right?

well, sort of. What exact implementation of Authentication is used is determined
during runtime (i.e. depends on the AuthenticationProvider used, where there are
a few) and not really known by me. The Server side could always change the
implementation.

Anyway, the link is at least very helpful, thanks!

Best regards, --- Jan.


Re: marshalling error

Posted by Freeman Fang <fr...@iona.com>.
Hi Jan,
Since Authentication is an interface, so your real message response 
should have an object(let's say it's instance of AuthenticationImpl) 
which implement Authentication, right?
You need add AuthenticationImpl(which is an extra class for jaxb since 
we cann't get this class when build service model and init jaxb context 
from SEI) into jaxb context for mashalling.

Days ago, we have a similiar issue
https://issues.apache.org/jira/browse/CXF-340

All conversation and solution is on this link, I believe it's helpful.

Thanks very much

Freeman


Jan Kriesten wrote:
> hi freeman,
>
>   
>> Would you please append your whole testcase?
>> Is Authentication class defined as para or return type for your SEI?
>>     
>
> the interface is defined as follows:
>
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.jws.WebService;
> import org.acegisecurity.Authentication;
>
> public interface IAuthService
> {
>   @WebMethod
>   @WebResult( name="authenticated" )
>   public boolean authenticate( @WebParam(name="sid") String sid,
> @WebParam(name="uid") String username, @WebParam(name="pwd") String password );
>
>   @WebMethod
>   @WebResult( name="authentication" )
>   public Authentication getAuthentication( @WebParam(name="sid") String sid );
>
>   @WebMethod
>   @WebResult( name="roles" )
>   public Set<String> getRoles( @WebParam(name="sid") String sid );
> }
>
> Authentication is an interface which extends Principal and Serializable.
>
> I'm using the CXFServlet, so it might be that I have to configure AegisBinding
> on the Servlet-side (client is set to Aegis), but the documentation doesn't say how.
>
> Best regards, --- Jan.
>
>   

Re: marshalling error

Posted by Willem Jiang <ni...@iona.com>.
Hi
Just answer how to configure AegisBinding on the Servlet-side.
You can create the service by using spring to wire the 
JaxWsServerFactoryBean in the bean.xml.

Here is an example:
<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    
      xsi:schemaLocation="
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
">

<bean id="AegisDatabinding" 
class="org.apache.cxf.aegis.databinding.AegisDatabinding"/>

<bean id="JaxWsServiceFactoryBean" 
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
    <property name="wrapped" value="false"/>
    <property name="dataBinding" ref="AegisDatabinding"/>
</bean>

<bean id="greeterServerFactory"
    class="org.apache.cxf.jaxws.JaxWsServerFactoryBean" 
init-method="create">
    <property name="serviceClass" 
value="org.apache.cxf.customer.bare.CustomerService" />
    <property name="serviceBean">
      <bean class="org.apache.cxf.customer.bare.CustomerService"/>
    </property>
    <property name="address" value="/services/test"/>
    <property name="bus" ref="cxf"/> 
    <property name="serviceFactory" ref="JaxWsServiceFactoryBean"/>
  </bean> 

Cheers,

Willem.

Jan Kriesten wrote:
> hi freeman,
>
>   
>> Would you please append your whole testcase?
>> Is Authentication class defined as para or return type for your SEI?
>>     
>
> the interface is defined as follows:
>
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.jws.WebService;
> import org.acegisecurity.Authentication;
>
> public interface IAuthService
> {
>   @WebMethod
>   @WebResult( name="authenticated" )
>   public boolean authenticate( @WebParam(name="sid") String sid,
> @WebParam(name="uid") String username, @WebParam(name="pwd") String password );
>
>   @WebMethod
>   @WebResult( name="authentication" )
>   public Authentication getAuthentication( @WebParam(name="sid") String sid );
>
>   @WebMethod
>   @WebResult( name="roles" )
>   public Set<String> getRoles( @WebParam(name="sid") String sid );
> }
>
> Authentication is an interface which extends Principal and Serializable.
>
> I'm using the CXFServlet, so it might be that I have to configure AegisBinding
> on the Servlet-side (client is set to Aegis), but the documentation doesn't say how.
>
> Best regards, --- Jan.
>
>
>   


Re: marshalling error

Posted by Jan Kriesten <ja...@renitence.de>.
hi freeman,

> Would you please append your whole testcase?
> Is Authentication class defined as para or return type for your SEI?

the interface is defined as follows:

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import org.acegisecurity.Authentication;

public interface IAuthService
{
  @WebMethod
  @WebResult( name="authenticated" )
  public boolean authenticate( @WebParam(name="sid") String sid,
@WebParam(name="uid") String username, @WebParam(name="pwd") String password );

  @WebMethod
  @WebResult( name="authentication" )
  public Authentication getAuthentication( @WebParam(name="sid") String sid );

  @WebMethod
  @WebResult( name="roles" )
  public Set<String> getRoles( @WebParam(name="sid") String sid );
}

Authentication is an interface which extends Principal and Serializable.

I'm using the CXFServlet, so it might be that I have to configure AegisBinding
on the Servlet-side (client is set to Aegis), but the documentation doesn't say how.

Best regards, --- Jan.


Re: marshalling error

Posted by Freeman Fang <fr...@iona.com>.
Hi Jan,

Would you please append your whole testcase?

Is Authentication class defined as para or return type for your SEI?

Thanks very much

Freeman

Jan Kriesten wrote:
> hi,
>
> i'm trying to get warm with cxf, but i run into mor problems.
>
> i'm trying to set up a remote authentication service using acegi and want to
> return a 'Authentication'-object.
>
> but neither jaxb- nor aegis-binding seems to be able to handle this object, i
> get the following exception:
>
> ---8<---
> org.apache.cxf.binding.soap.SoapFault: Marshalling Error:
> org.acegisecurity.Authentication is not known to this context
>      at
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:70)
> ---8<---
>
> do i have to write my own in-/outhandlers for this?
>
> best regards, --- jan.
>
>