You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jacob Marcus <ja...@gmail.com> on 2007/08/27 17:34:22 UTC

Simple front-end and xs:anyType

Hi,

Is there a way to support xs:anyType using the Simple frond end? I tried a
method like
String push(Object obj) in my interface. The wsdl is successfully generated.
However, when I try to call the method from my client, I get the following
error. Any pointers would be great.

org.apache.cxf.interceptor.Fault: object is not an instance of declaring
class
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(
AbstractInvoker.java:92)
        at org.apache.cxf.service.invoker.AbstractInvoker.invoke(
AbstractInvoker.java:62)
        at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(
ServiceInvokerInterceptor.java:56)
        at org.apache.cxf.workqueue.SynchronousExecutor.execute(
SynchronousExecutor.java:37)
        at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(
ServiceInvokerInterceptor.java:92)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
PhaseInterceptorChain.java:207)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(
ChainInitiationObserver.java:73)
        at org.apache.cxf.transport.servlet.ServletDestination.doMessage(
ServletDestination.java:78)
        at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(
ServletController.java:231)


Thanks,
Jacob

Simple front-end and xs:anyType

Posted by girish sonber <gi...@capgemini.com>.
hi ,

this is my interface:

import com.src.capgemini.javapole.data.model.Party;

@SOAPBinding(use=SOAPBinding.Use.LITERAL, style=SOAPBinding.Style.DOCUMENT)
@WebService(name="WsParty",
targetNamespace="http://idserver.adc.capgemini.com/")
public interface WsParty {
	
	@WebMethod(operationName="getAllParty", exclude=false)

@ResponseWrapper(className="com.capgemini.adc.idserver.GetAllPartyResponse",
localName="getAllPartyResponse",
targetNamespace="http://idserver.adc.capgemini.com/")
	@RequestWrapper(className="com.capgemini.adc.idserver.GetAllParty",
localName="getAllParty",
targetNamespace="http://idserver.adc.capgemini.com/")
	public List<Party> getAllParty();

}

and my wsdl file is 

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="WsPartyService"
targetNamespace="http://idserver.adc.capgemini.com/"
xmlns:ns1="http://idserver.adc.capgemini.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://idserver.adc.capgemini.com/"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://idserver.adc.capgemini.com/">
<xs:element name="getAllParty" nillable="true" type="tns:getAllParty"/>
<xs:element name="getAllPartyResponse" nillable="true"
type="tns:getAllPartyResponse"/>
<xs:complexType name="getAllPartyResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="getAllParty"/>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://idserver.adc.capgemini.com/"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://idserver.adc.capgemini.com/">
<xs:complexType name="party">
<xs:sequence>
<xs:element minOccurs="0" name="firstName" type="xs:string"/>
<xs:element name="internalId" type="xs:long"/>
<xs:element minOccurs="0" name="lastName" type="xs:string"/>
<xs:element name="partyUid" type="xs:long"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="getAllPartyResponse">
    <wsdl:part name="result" element="ns1:getAllPartyResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="getAllParty">
    <wsdl:part name="parameters" element="ns1:getAllParty">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="WsParty">
    <wsdl:operation name="getAllParty">
      <wsdl:input name="getAllParty" message="ns1:getAllParty">
    </wsdl:input>
      <wsdl:output name="getAllPartyResponse"
message="ns1:getAllPartyResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="WsPartyServiceSoapBinding" type="ns1:WsParty">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="getAllParty">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="getAllParty">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="getAllPartyResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="WsPartyService">
    <wsdl:port name="WsPartyPort" binding="ns1:WsPartyServiceSoapBinding">
      <soap:address location="http://localhost:9090/hello"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

here i think that 

xs:complexType name="getAllPartyResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
xs:anytype shoul be of type party 
and when i generate the implementation class i give me the error 

return type is incompatible with the SEI .

please help 

-- 
View this message in context: http://www.nabble.com/Simple-front-end-and-xs%3AanyType-tf4336455.html#a12556331
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Simple front-end and xs:anyType

Posted by Jacob Marcus <ja...@gmail.com>.
Hi,

How do you customize the JAXB when using the simple front end.? The article
talks about how to do it  with  the wsdl2ava tool, if I am not mistaken.

Has some one tried this with the simple front end?

Thanks,
Jacob


On 8/27/07, James Mao <ja...@iona.com> wrote:
>
> You can customize the jaxb to use the java.util.Calendar or
> java.util.Date in case of jaxb databinding.
> Here's the documentation:
>
> http://cwiki.apache.org/confluence/display/CXF20DOC/WSDL+to+Java
> (grep: *Q: How to map xsd:dateTime to java.util.Date?*)
>
> Cheers,
> James
>
> > Thanks Dan! I have got it work.
> >
> > I notice one interesting thing though. If I send a Date from the client,
> it
> > is getting converted to an
> > XMLGregorianCalendarImpl at the server side. I see that there is an
> existing
> > JIRA issue open on this.
> > (https://issues.apache.org/jira/browse/CXF-369)
> >
> > I changed the data binding to use Aegis data binding and now see
> > java.util.GregorianCalendar.
> >
> > Is there a way I can customize this to get java.util.Date at the server?
> The
> > Jira issue says you can customise jaxb binding using an xml snippet. It
> is
> > not clear, where this xml snippet will fits in.
> >
> > Thanks,
> > J
> >
> >
> >
> >
> >
> >
> >
> >
> > On 8/27/07, Dan Diephouse <da...@envoisolutions.com> wrote:
> >
> >> Hi Jacob,
> >>
> >> You may have to turn on xsi:type writing for aegis. If you're using the
> >> API,
> >> it'll probably look something like this:
> >>
> >> ServerFactoryBean sf ...
> >> Map<String, Object> props = new HashMap<String, Object>();
> >> props.put(AegisDatabinding.WRITE_XSI_TYPE_KEY, "true");
> >> sf.setProperties(props);
> >>
> >> Or in XML form:
> >>
> >> <jaxws:endpoint ....>
> >>   <jaxws:properties>
> >>     <entry key="writeXsiType">true</entry>
> >>   </jaxw:properties>
> >> </jaxws:endpoint>
> >>
> >> Hope that helps some. Cheers,
> >> - Dan
> >>
> >>
> >>
> >> On 8/27/07, Jacob Marcus <ja...@gmail.com> wrote:
> >>
> >>> Hi,
> >>>
> >>> Is there a way to support xs:anyType using the Simple frond end? I
> tried
> >>>
> >> a
> >>
> >>> method like
> >>> String push(Object obj) in my interface. The wsdl is successfully
> >>> generated.
> >>> However, when I try to call the method from my client, I get the
> >>>
> >> following
> >>
> >>> error. Any pointers would be great.
> >>>
> >>> org.apache.cxf.interceptor.Fault: object is not an instance of
> declaring
> >>> class
> >>>         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(
> >>> AbstractInvoker.java:92)
> >>>         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(
> >>> AbstractInvoker.java:62)
> >>>         at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(
> >>> ServiceInvokerInterceptor.java:56)
> >>>         at org.apache.cxf.workqueue.SynchronousExecutor.execute(
> >>> SynchronousExecutor.java:37)
> >>>         at
> >>> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(
> >>> ServiceInvokerInterceptor.java:92)
> >>>         at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
> >>> PhaseInterceptorChain.java:207)
> >>>         at org.apache.cxf.transport.ChainInitiationObserver.onMessage(
> >>> ChainInitiationObserver.java:73)
> >>>         at
> org.apache.cxf.transport.servlet.ServletDestination.doMessage
> >>>
> >> (
> >>
> >>> ServletDestination.java:78)
> >>>         at
> >>> org.apache.cxf.transport.servlet.ServletController.invokeDestination(
> >>> ServletController.java:231)
> >>>
> >>>
> >>> Thanks,
> >>> Jacob
> >>>
> >>>
> >>
> >> --
> >> Dan Diephouse
> >> Envoi Solutions
> >> http://envoisolutions.com | http://netzooid.com/blog
> >>
> >>
> >
> >
>

Re: Simple front-end and xs:anyType

Posted by James Mao <ja...@iona.com>.
You can customize the jaxb to use the java.util.Calendar or 
java.util.Date in case of jaxb databinding.
Here's the documentation:

http://cwiki.apache.org/confluence/display/CXF20DOC/WSDL+to+Java     
(grep: *Q: How to map xsd:dateTime to java.util.Date?*)

Cheers,
James

> Thanks Dan! I have got it work.
>
> I notice one interesting thing though. If I send a Date from the client, it
> is getting converted to an
> XMLGregorianCalendarImpl at the server side. I see that there is an existing
> JIRA issue open on this.
> (https://issues.apache.org/jira/browse/CXF-369)
>
> I changed the data binding to use Aegis data binding and now see
> java.util.GregorianCalendar.
>
> Is there a way I can customize this to get java.util.Date at the server? The
> Jira issue says you can customise jaxb binding using an xml snippet. It is
> not clear, where this xml snippet will fits in.
>
> Thanks,
> J
>
>
>
>
>
>
>
>
> On 8/27/07, Dan Diephouse <da...@envoisolutions.com> wrote:
>   
>> Hi Jacob,
>>
>> You may have to turn on xsi:type writing for aegis. If you're using the
>> API,
>> it'll probably look something like this:
>>
>> ServerFactoryBean sf ...
>> Map<String, Object> props = new HashMap<String, Object>();
>> props.put(AegisDatabinding.WRITE_XSI_TYPE_KEY, "true");
>> sf.setProperties(props);
>>
>> Or in XML form:
>>
>> <jaxws:endpoint ....>
>>   <jaxws:properties>
>>     <entry key="writeXsiType">true</entry>
>>   </jaxw:properties>
>> </jaxws:endpoint>
>>
>> Hope that helps some. Cheers,
>> - Dan
>>
>>
>>
>> On 8/27/07, Jacob Marcus <ja...@gmail.com> wrote:
>>     
>>> Hi,
>>>
>>> Is there a way to support xs:anyType using the Simple frond end? I tried
>>>       
>> a
>>     
>>> method like
>>> String push(Object obj) in my interface. The wsdl is successfully
>>> generated.
>>> However, when I try to call the method from my client, I get the
>>>       
>> following
>>     
>>> error. Any pointers would be great.
>>>
>>> org.apache.cxf.interceptor.Fault: object is not an instance of declaring
>>> class
>>>         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(
>>> AbstractInvoker.java:92)
>>>         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(
>>> AbstractInvoker.java:62)
>>>         at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(
>>> ServiceInvokerInterceptor.java:56)
>>>         at org.apache.cxf.workqueue.SynchronousExecutor.execute(
>>> SynchronousExecutor.java:37)
>>>         at
>>> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(
>>> ServiceInvokerInterceptor.java:92)
>>>         at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
>>> PhaseInterceptorChain.java:207)
>>>         at org.apache.cxf.transport.ChainInitiationObserver.onMessage(
>>> ChainInitiationObserver.java:73)
>>>         at org.apache.cxf.transport.servlet.ServletDestination.doMessage
>>>       
>> (
>>     
>>> ServletDestination.java:78)
>>>         at
>>> org.apache.cxf.transport.servlet.ServletController.invokeDestination(
>>> ServletController.java:231)
>>>
>>>
>>> Thanks,
>>> Jacob
>>>
>>>       
>>
>> --
>> Dan Diephouse
>> Envoi Solutions
>> http://envoisolutions.com | http://netzooid.com/blog
>>
>>     
>
>   

Re: Simple front-end and xs:anyType

Posted by Jacob Marcus <ja...@gmail.com>.
Thanks Dan! I have got it work.

I notice one interesting thing though. If I send a Date from the client, it
is getting converted to an
XMLGregorianCalendarImpl at the server side. I see that there is an existing
JIRA issue open on this.
(https://issues.apache.org/jira/browse/CXF-369)

I changed the data binding to use Aegis data binding and now see
java.util.GregorianCalendar.

Is there a way I can customize this to get java.util.Date at the server? The
Jira issue says you can customise jaxb binding using an xml snippet. It is
not clear, where this xml snippet will fits in.

Thanks,
J








On 8/27/07, Dan Diephouse <da...@envoisolutions.com> wrote:
>
> Hi Jacob,
>
> You may have to turn on xsi:type writing for aegis. If you're using the
> API,
> it'll probably look something like this:
>
> ServerFactoryBean sf ...
> Map<String, Object> props = new HashMap<String, Object>();
> props.put(AegisDatabinding.WRITE_XSI_TYPE_KEY, "true");
> sf.setProperties(props);
>
> Or in XML form:
>
> <jaxws:endpoint ....>
>   <jaxws:properties>
>     <entry key="writeXsiType">true</entry>
>   </jaxw:properties>
> </jaxws:endpoint>
>
> Hope that helps some. Cheers,
> - Dan
>
>
>
> On 8/27/07, Jacob Marcus <ja...@gmail.com> wrote:
> >
> > Hi,
> >
> > Is there a way to support xs:anyType using the Simple frond end? I tried
> a
> > method like
> > String push(Object obj) in my interface. The wsdl is successfully
> > generated.
> > However, when I try to call the method from my client, I get the
> following
> > error. Any pointers would be great.
> >
> > org.apache.cxf.interceptor.Fault: object is not an instance of declaring
> > class
> >         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(
> > AbstractInvoker.java:92)
> >         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(
> > AbstractInvoker.java:62)
> >         at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(
> > ServiceInvokerInterceptor.java:56)
> >         at org.apache.cxf.workqueue.SynchronousExecutor.execute(
> > SynchronousExecutor.java:37)
> >         at
> > org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(
> > ServiceInvokerInterceptor.java:92)
> >         at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
> > PhaseInterceptorChain.java:207)
> >         at org.apache.cxf.transport.ChainInitiationObserver.onMessage(
> > ChainInitiationObserver.java:73)
> >         at org.apache.cxf.transport.servlet.ServletDestination.doMessage
> (
> > ServletDestination.java:78)
> >         at
> > org.apache.cxf.transport.servlet.ServletController.invokeDestination(
> > ServletController.java:231)
> >
> >
> > Thanks,
> > Jacob
> >
>
>
>
> --
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
>

Re: Simple front-end and xs:anyType

Posted by Dan Diephouse <da...@envoisolutions.com>.
Hi Jacob,

You may have to turn on xsi:type writing for aegis. If you're using the API,
it'll probably look something like this:

ServerFactoryBean sf ...
Map<String, Object> props = new HashMap<String, Object>();
props.put(AegisDatabinding.WRITE_XSI_TYPE_KEY, "true");
sf.setProperties(props);

Or in XML form:

<jaxws:endpoint ....>
  <jaxws:properties>
    <entry key="writeXsiType">true</entry>
  </jaxw:properties>
</jaxws:endpoint>

Hope that helps some. Cheers,
- Dan



On 8/27/07, Jacob Marcus <ja...@gmail.com> wrote:
>
> Hi,
>
> Is there a way to support xs:anyType using the Simple frond end? I tried a
> method like
> String push(Object obj) in my interface. The wsdl is successfully
> generated.
> However, when I try to call the method from my client, I get the following
> error. Any pointers would be great.
>
> org.apache.cxf.interceptor.Fault: object is not an instance of declaring
> class
>         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(
> AbstractInvoker.java:92)
>         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(
> AbstractInvoker.java:62)
>         at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(
> ServiceInvokerInterceptor.java:56)
>         at org.apache.cxf.workqueue.SynchronousExecutor.execute(
> SynchronousExecutor.java:37)
>         at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(
> ServiceInvokerInterceptor.java:92)
>         at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(
> PhaseInterceptorChain.java:207)
>         at org.apache.cxf.transport.ChainInitiationObserver.onMessage(
> ChainInitiationObserver.java:73)
>         at org.apache.cxf.transport.servlet.ServletDestination.doMessage(
> ServletDestination.java:78)
>         at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(
> ServletController.java:231)
>
>
> Thanks,
> Jacob
>



-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog