jboss-fuse / wsdl2rest

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

NPE in CamelContextGenerator.getJavaMethod(CamelContextGenerator.java:117) #66

Open apupier opened 5 years ago

apupier commented 5 years ago
java.lang.NullPointerException
    at org.jboss.fuse.wsdl2rest.impl.codegen.CamelContextGenerator.getJavaMethod(CamelContextGenerator.java:117)
    at org.jboss.fuse.wsdl2rest.impl.codegen.CamelContextGenerator.addTypeMapping(CamelContextGenerator.java:94)
    at org.jboss.fuse.wsdl2rest.impl.codegen.CamelContextGenerator.process(CamelContextGenerator.java:76)
    at org.jboss.fuse.wsdl2rest.impl.Wsdl2Rest.process(Wsdl2Rest.java:92)

wsdl file available on case support https://access.redhat.com/support/cases/#/case/02193740

apupier commented 5 years ago

the issue occurs when a port type contains an "_"

bfitzpat commented 5 years ago

Fixes merged

apupier commented 5 years ago

I provided a PR which is avoiding the NPE and testing the same things than other tests but I have no idea if the generated code is really working or not (and don't know how to check that for now)

bfitzpat commented 5 years ago

Sorry I missed the new PR

apupier commented 5 years ago

@tdiesler what needs to be checked on the generated code? how to test that the generated code is correct the wsdl/camel rest dsl?

tdiesler commented 5 years ago

I'd say it works in the context of its test coverage. If a functionality is auto tested we claim that it works. If it is not tested we assume that it is not there.

apupier commented 5 years ago

is the test that I've written accurate? I duplicate the other tests, but does it makes sense in the context of name with underscores? How to know if it is the right way to handle it?

tdiesler commented 5 years ago

Here is an example of a comprehensive functional test

https://github.com/jboss-fuse/wsdl2rest/blob/master/tests/spring/src/test/java/org/jboss/fuse/wsdl2rest/test/rpclit/CamelRestRpcLitTest.java https://github.com/jboss-fuse/wsdl2rest/blob/master/tests/spring/src/test/java/org/jboss/fuse/wsdl2rest/test/rpclit/CamelRestRpcLitTest.java

There is one for rpc/lit and one for doc/lit.

You could check whether the generated camel route works for your stuff

— thomas

On Oct 17, 2018, at 2:44 PM, Aurélien Pupier notifications@github.com wrote:

is the test that I've written accurate? I duplicate the other tests, but does it makes sense in the context of name with underscores? How to know if it is the right way to handle it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jboss-fuse/wsdl2rest/issues/66#issuecomment-430613393, or mute the thread https://github.com/notifications/unsubscribe-auth/AAO80h1DFpw7fJbalkwy5MN9z5A561MCks5ulyZCgaJpZM4XH_KR.

apupier commented 5 years ago

I still don't know if java code is well generated but camel dsl file is for sure badly generated:

<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:cxf="http://camel.apache.org/schema/cxf"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

    <camelContext id="cxfrs-cc50ce86-29df-438d-a2a1-cdfde19c5d83" xmlns="http://camel.apache.org/schema/spring">

        <dataFormats>
            <xmljson id="xmljson"/>
        </dataFormats>

        <restConfiguration component="jetty" host="localhost" port="8081" bindingMode="json">
        </restConfiguration>

        <rest id="id-26650c10-4b95-410d-9539-c7e128152879" path="/jaxrs">

          <$method.httpMethod.toLowerCase() id="id-48e4f63d-d888-4cad-9d95-dddfcecccb94" uri="//{arg0}" 
            type="com.oracle.xmlns.enterprise.tools.schemas.a_second_name_with_underscore_email_req.ASECONDNAMEWITHUNDERSCOREEMAILREQTypeShape"
            outType="com.oracle.xmlns.enterprise.tools.schemas.a_third_name_with_underscore_msg.ATHIRDNAMEWITHUNDERSCOREMSGTypeShape" 
            >
            <to uri="direct:A_SECOND_NAME_WITH_UNDERSCORE_EMAIL_OPR_SRV"/>
          </$method.httpMethod.toLowerCase()>
        </rest>

        <route id="A_SECOND_NAME_WITH_UNDERSCORE_EMAIL_OPR_SRV">
            <from uri="direct:A_SECOND_NAME_WITH_UNDERSCORE_EMAIL_OPR_SRV" />
            <log loggingLevel="INFO" message="A_SECOND_NAME_WITH_UNDERSCORE_EMAIL_OPR_SRV"/>
            <to uri="cxf://http://localhost:8080/somepath?serviceClass=1.com/Enterprise/HCM/services/A_NAME_WITH_UNDERSCORE_SRV.oracle.xmlns.A_NAME_WITH_UNDERSCORE_SRV_PortType&amp;defaultOperationName=A_SECOND_NAME_WITH_UNDERSCORE_EMAIL_OPR_SRV"/>
            <setHeader headerName="Content-Type">
               <constant>application/json</constant>
            </setHeader>
            <setBody>
                <simple>${body[0]}</simple>
            </setBody>
        </route>

    </camelContext>

</beans>
apupier commented 5 years ago

unassigned: time allocated to work on it exploded.