jboss-fuse / wsdl2rest

A tool allowing quick migration from existing JAX-WS services to REST
Apache License 2.0
26 stars 22 forks source link

Generate id values in all camel context elements #58

Closed lhein closed 6 years ago

lhein commented 6 years ago

Currently the output of the processor lacks id values in the camel context. It would be good to have an additional command line argument to enable the processor to generate such id values.

tdiesler commented 6 years ago

How about generating these ids always? Is it just the camelContext element where you need these ids?

Like this ...

https://github.com/jboss-fuse/wsdl2rest/blob/master/jaxws/src/main/resources/rpclit/rpclit-camel-context.xml#L9

apupier commented 6 years ago

How about generating these ids always?

that's fine for us. But is everybody using the generator will be happy?

Is it just the camelContext element where you need these ids?

no, it is also all rest/post/delete/get So more like that:

<camelContext id="cxfrs" xmlns="http://camel.apache.org/schema/spring">
        <dataFormats>
            <xmljson id="xmljson"/>
        </dataFormats>
        <restConfiguration bindingMode="json" component="jetty"
            host="localhost" port="8081"/>
        <rest id="rest-98f0b31e-027f-4d45-92c7-4eefb4124099" path="/jaxrs">
            <post consumes="application/json"
                id="post-45320c3f-b0dc-4513-9ecf-6b5691e947c8"
                outType="java.lang.Integer"
                type="org.jboss.fuse.wsdl2rest.test.doclit.Item" uri="/address">
                <to uri="direct:addAddress"/>
            </post>
            <delete id="delete-255fe6d9-15e5-497a-a3be-0ec15d072186"
                outType="org.jboss.fuse.wsdl2rest.test.doclit.Item"
                type="java.lang.Integer" uri="/address/{arg0}">
                <to uri="direct:delAddress"/>
            </delete>
            <get id="get-d620e9a6-b0cd-42e7-986c-2aa189851d97"
                outType="org.jboss.fuse.wsdl2rest.test.doclit.Item"
                type="java.lang.Integer" uri="/address/{arg0}">
                <to uri="direct:getAddress"/>
            </get>
            <get id="get-e0ee46b3-899a-4b24-b9cc-54116253b76e"
                outType="java.lang.String" uri="/addresses">
                <to uri="direct:listAddresses"/>
            </get>
            <put consumes="application/json"
                id="put-28dc44e5-67b0-4147-bfb6-28e0d7fb1431"
                outType="java.lang.Integer"
                type="org.jboss.fuse.wsdl2rest.test.doclit.Item" uri="/address">
                <to uri="direct:updAddress"/>
            </put>
        </rest>
        <route id="addAddress">
            <from id="_from1" uri="direct:addAddress"/>
            <log id="_log1" loggingLevel="INFO" message="addAddress"/>
            <to id="_to1" uri="cxf://http://localhost:9090/AddressPort?serviceClass=org.jboss.fuse.wsdl2rest.test.doclit.Address&amp;defaultOperationName=addAddress"/>
            <setHeader headerName="Content-Type" id="_setHeader1">
                <constant>text/plain</constant>
            </setHeader>
            <setBody id="_setBody1">
                <simple>${body}</simple>
            </setBody>
        </route>
        <route id="delAddress">
            <from id="_from2" uri="direct:delAddress"/>
            <log id="_log2" loggingLevel="INFO" message="delAddress"/>
            <setBody id="_setBody2">
                <simple>${header.arg0}</simple>
            </setBody>
            <unmarshal id="_unmarshal1">
                <json library="Jackson" unmarshalTypeName="java.lang.Integer"/>
            </unmarshal>
            <to id="_to2" uri="cxf://http://localhost:9090/AddressPort?serviceClass=org.jboss.fuse.wsdl2rest.test.doclit.Address&amp;defaultOperationName=delAddress"/>
            <setHeader headerName="Content-Type" id="_setHeader2">
                <constant>application/json</constant>
            </setHeader>
            <setBody id="_setBody3">
                <simple>${body[0]}</simple>
            </setBody>
        </route>
        <route id="getAddress">
            <from id="_from3" uri="direct:getAddress"/>
            <log id="_log3" loggingLevel="INFO" message="getAddress"/>
            <setBody id="_setBody4">
                <simple>${header.arg0}</simple>
            </setBody>
            <unmarshal id="_unmarshal2">
                <json library="Jackson" unmarshalTypeName="java.lang.Integer"/>
            </unmarshal>
            <to id="_to3" uri="cxf://http://localhost:9090/AddressPort?serviceClass=org.jboss.fuse.wsdl2rest.test.doclit.Address&amp;defaultOperationName=getAddress"/>
            <setHeader headerName="Content-Type" id="_setHeader3">
                <constant>application/json</constant>
            </setHeader>
            <setBody id="_setBody5">
                <simple>${body[0]}</simple>
            </setBody>
        </route>
        <route id="listAddresses">
            <from id="_from4" uri="direct:listAddresses"/>
            <log id="_log4" loggingLevel="INFO" message="listAddresses"/>
            <setBody id="_setBody6">
                <simple>null</simple>
            </setBody>
            <to id="_to4" uri="cxf://http://localhost:9090/AddressPort?serviceClass=org.jboss.fuse.wsdl2rest.test.doclit.Address&amp;defaultOperationName=listAddresses"/>
            <setHeader headerName="Content-Type" id="_setHeader4">
                <constant>text/plain</constant>
            </setHeader>
            <setBody id="_setBody7">
                <simple>${body}</simple>
            </setBody>
        </route>
        <route id="updAddress">
            <from id="_from5" uri="direct:updAddress"/>
            <log id="_log5" loggingLevel="INFO" message="updAddress"/>
            <to id="_to5" uri="cxf://http://localhost:9090/AddressPort?serviceClass=org.jboss.fuse.wsdl2rest.test.doclit.Address&amp;defaultOperationName=updAddress"/>
            <setHeader headerName="Content-Type" id="_setHeader5">
                <constant>text/plain</constant>
            </setHeader>
            <setBody id="_setBody8">
                <simple>${body}</simple>
            </setBody>
        </route>
    </camelContext>