You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jainmcs03 <to...@gmail.com> on 2015/05/11 08:57:59 UTC

NoTypeConversionAvailableException

Team,

Below my route and im getting below exception while unmarshal then marshal.
Pls help resolve.

Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
converter available to convert from type:
localhost._8080.canonicalcxfserviceproxy.canonical.InquiryRequestType to the
required type: java.io.InputStream with value
localhost._8080.canonicalcxfserviceproxy.canonical.InquiryRequestType@19fe54bb

  <camelContext trace="true" xmlns="http://camel.apache.org/schema/spring">
      <route streamCache="true">
      <from uri="cxf:bean:canonicalService?dataFormat=PAYLOAD"/>
      <wireTap
uri="file:/home/analyzer/Desktop/input/?fileName=request.xml"/>
      <unmarshal>
      	<jaxb prettyPrint="true"
contextPath="localhost._8080.canonicalcxfserviceproxy.canonical"/>
      </unmarshal>
      <process ref="reqprocessor"/>
      <marshal>
      	<jaxb prettyPrint="true"
contextPath="com.equifax.services.eport.ws.schemas._1"/>
      </marshal>
      <wireTap
uri="file:/home/analyzer/Desktop/input/?fileName=realrequest.xml"/>      
      </route>    
  </camelContext>

Regards
Jayendran





--
View this message in context: http://camel.465427.n5.nabble.com/NoTypeConversionAvailableException-tp5766952.html
Sent from the Camel - Users mailing list archive at Nabble.com.

RE: NoTypeConversionAvailableException

Posted by Hans Orbaan <ha...@docdata.eu>.
Hi,

To generate @XmlRootElement annotations apparently you need to use anonymous inner types (unrelated example):
    <xs:element name="AcknowledgeOrders">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="OrderLine" type="OrderResult" minOccurs="1" maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

And not:
    <xs:element name="AcknowledgeOrders" type="OrderResults" />
    
    <xs:complexType name="OrderResults">
        <xs:sequence>
            <xs:element name="OrderLine" type="OrderResult" minOccurs="1" maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

Other option would be to wrap it in a JAXBElement<?> yourself and then marshal it:

FACTORY.createAcknowledgeOrders((OrderResults) object);


-----Oorspronkelijk bericht-----
Van: jainmcs03 [mailto:tojayendran.inbox@gmail.com] 
Verzonden: Monday 11 May 2015 13:31
Aan: users@camel.apache.org
Onderwerp: Re: NoTypeConversionAvailableException

Hi Claus,

Yes, @XmlRootElement() missing. No class with root element annotation in my code generated by cxf-codegen-plugin.

Actually my payload should be like this,

<InquiryRequest xmlns="http://services.equifax.com/eport/ws/schemas/1.0">
    <RequestHeader>
        <CustomerId></CustomerId>

Part of XSD is below,

   <xsd:element name="InquiryRequest" type="ns:InquiryRequestType">
      <xsd:annotation>
         <xsd:documentation>
            The WS Inquiry service request message root element declaration
         </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

Couldnt find my mistake.

Regards
Jayendran



--
View this message in context: http://camel.465427.n5.nabble.com/NoTypeConversionAvailableException-tp5766952p5766976.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: NoTypeConversionAvailableException

Posted by jainmcs03 <to...@gmail.com>.
Hi Claus,

I just added @XmlRootElement() in class InquiryRequestType and now no error
happens conversion done.
But the generated PAYLOAD looks like below, is this right?

<inquiryRequestType
xmlns="http://services.equifax.com/eport/ws/schemas/1.0">
    <RequestHeader>
        <CustomerId>3</CustomerId>

Actually inquiryRequestType is a type of root element <inquiryRequest>.

Regards
Jayendran



--
View this message in context: http://camel.465427.n5.nabble.com/NoTypeConversionAvailableException-tp5766952p5766977.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: NoTypeConversionAvailableException

Posted by jainmcs03 <to...@gmail.com>.
Hi Claus,

Yes, @XmlRootElement() missing. No class with root element annotation in my
code generated by cxf-codegen-plugin.

Actually my payload should be like this,

<InquiryRequest xmlns="http://services.equifax.com/eport/ws/schemas/1.0">
    <RequestHeader>
        <CustomerId></CustomerId>

Part of XSD is below,

   <xsd:element name="InquiryRequest" type="ns:InquiryRequestType">
      <xsd:annotation>
         <xsd:documentation>
            The WS Inquiry service request message root element declaration
         </xsd:documentation>
      </xsd:annotation>
   </xsd:element>

Couldnt find my mistake.

Regards
Jayendran



--
View this message in context: http://camel.465427.n5.nabble.com/NoTypeConversionAvailableException-tp5766952p5766976.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: NoTypeConversionAvailableException

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Just to be sure, is this class .InquiryRequestType annotated with JAXB
and do you have a jaxb.index file or what else JAXB requires?

Usually if you CXF you can auto generate them using its maven plugin

On Mon, May 11, 2015 at 9:58 AM, jainmcs03 <to...@gmail.com> wrote:
> Hi Claus,
>
> Its already added below dependency. Any special handling needed in
> processor?
>
>
>     <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-jaxb</artifactId>
>         <version>2.15.1</version>
>     </dependency>
>
>
> Regards,
> Jayendran
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/NoTypeConversionAvailableException-tp5766952p5766954.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: NoTypeConversionAvailableException

Posted by jainmcs03 <to...@gmail.com>.
Hi Claus,

Its already added below dependency. Any special handling needed in
processor?


    <dependency>
    	<groupId>org.apache.camel</groupId>
    	<artifactId>camel-jaxb</artifactId>
    	<version>2.15.1</version>
    </dependency>


Regards,
Jayendran



--
View this message in context: http://camel.465427.n5.nabble.com/NoTypeConversionAvailableException-tp5766952p5766954.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: NoTypeConversionAvailableException

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Do you have camel-jaxb on the classpath? It can help with coverting
JAXB POJOs to streams

On Mon, May 11, 2015 at 8:57 AM, jainmcs03 <to...@gmail.com> wrote:
>
> Team,
>
> Below my route and im getting below exception while unmarshal then marshal.
> Pls help resolve.
>
> Caused by: org.apache.camel.NoTypeConversionAvailableException: No type
> converter available to convert from type:
> localhost._8080.canonicalcxfserviceproxy.canonical.InquiryRequestType to the
> required type: java.io.InputStream with value
> localhost._8080.canonicalcxfserviceproxy.canonical.InquiryRequestType@19fe54bb
>
>   <camelContext trace="true" xmlns="http://camel.apache.org/schema/spring">
>       <route streamCache="true">
>       <from uri="cxf:bean:canonicalService?dataFormat=PAYLOAD"/>
>       <wireTap
> uri="file:/home/analyzer/Desktop/input/?fileName=request.xml"/>
>       <unmarshal>
>         <jaxb prettyPrint="true"
> contextPath="localhost._8080.canonicalcxfserviceproxy.canonical"/>
>       </unmarshal>
>       <process ref="reqprocessor"/>
>       <marshal>
>         <jaxb prettyPrint="true"
> contextPath="com.equifax.services.eport.ws.schemas._1"/>
>       </marshal>
>       <wireTap
> uri="file:/home/analyzer/Desktop/input/?fileName=realrequest.xml"/>
>       </route>
>   </camelContext>
>
> Regards
> Jayendran
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/NoTypeConversionAvailableException-tp5766952.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/