[jira] Created: (CAMEL-723) CXF - wrapper/unwrapper - camel-cxf should be smarter

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (CAMEL-723) CXF - wrapper/unwrapper - camel-cxf should be smarter

JIRA jira@apache.org
CXF - wrapper/unwrapper - camel-cxf should be smarter
-----------------------------------------------------

                 Key: CAMEL-723
                 URL: https://issues.apache.org/activemq/browse/CAMEL-723
             Project: Apache Camel
          Issue Type: Improvement
          Components: camel-cxf
    Affects Versions: 1.4.0
            Reporter: Claus Ibsen
            Assignee: Willem Jiang
             Fix For: 1.5.0


Willem knows what this is. See chat log on the july-15-2008.

Basically getBody() should be smart in what kind of situation you are using CXF.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-723) CXF - wrapper/unwrapper - camel-cxf should be smarter

JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45021#action_45021 ]

Willem Jiang commented on CAMEL-723:
------------------------------------

We can tell if the operation's parameters style by checking if the operation is wrapper style or non-wrapper style.
But if you check the JAXWS-2.1 specification(2.6.2.1 Header Binding Extension),  we can't  just take consideration that the parameter just only one.
Since the soap header will be mapped into one parameter.

> CXF - wrapper/unwrapper - camel-cxf should be smarter
> -----------------------------------------------------
>
>                 Key: CAMEL-723
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-723
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-cxf
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>            Assignee: Willem Jiang
>             Fix For: 1.5.0
>
>
> Willem knows what this is. See chat log on the july-15-2008.
> Basically getBody() should be smart in what kind of situation you are using CXF.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-723) CXF - wrapper/unwrapper - camel-cxf should be smarter

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45078#action_45078 ]

Claus Ibsen commented on CAMEL-723:
-----------------------------------

Willem what about adding an option to camel-cxf where you can specify that you want either behaviour?

Look what Hadrian had to do for a Camel introduction presentation in the route:
{code:java}
public void configure() throws Exception {
        // direct:start is a internal queue to kick-start the routing in our example
        // we use this as the starting point where you can send messages to direct:start
        from("cxf:http://localhost:9090/unittest?serviceClass=org.apache.camel.example.reportincident.ReportIncidentEndpoint")
            .process(new Processor() {
                public void process(final Exchange exchange) {
                        Message in = exchange.getIn();
                        // Get the parameter list
                        List parameter = in.getBody(List.class);
                        // Put the result back
                        exchange.getOut().setBody(parameter.get(0));
                    }
            })
            .setHeader("subject", el("${in.body.incidentId}"))
            .filter(header("subject").isEqualTo("Hadrian"))
            .to("velocity:MailBody.vm")
            .to("file://target/subfolder?delete=false&consumer.delay=1000")
            .to("smtp://someone@localhost?password=secret&to=[hidden email]");
    }
{code}

This is very "ugly" and I was hoping that Camel would be smarter here as what Hadrian does in the inner processor is just plain plumming code that Camel could figure out to do itself.

Hadrian didn't know about the fact that you can do a explicit convertBodyTo to the POJO class:
.convertBodyTo(InputReportIncident.class) instead of the inner processor.

This new flag could then be default on for the most common style of webservice: document, litteral, wrapped, contract first.
And then you can turn the flag off for those "Greeter" RPC stylish webservices, and for end-users who prefer for some obsure reason to use the Holder objects.

In my world we develop webservices using document litteral, wrapped using contract first. And nothing else.

I would love Camel and CXF to support this as a first class citizen.

New users to Camel and CXF already have a hard time to figure out CXF comming from a AXIS land where they just get the code generated from a .wsdl and then they are ready to go.
Okay sorry, rant is over and I have only started to boil the water for my morning coffeee.

> CXF - wrapper/unwrapper - camel-cxf should be smarter
> -----------------------------------------------------
>
>                 Key: CAMEL-723
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-723
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-cxf
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>            Assignee: Willem Jiang
>             Fix For: 1.5.0
>
>
> Willem knows what this is. See chat log on the july-15-2008.
> Basically getBody() should be smart in what kind of situation you are using CXF.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-723) CXF - wrapper/unwrapper - camel-cxf should be smarter

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45080#action_45080 ]

Willem Jiang commented on CAMEL-723:
------------------------------------

Now you can get the request object by passing the InputReportIncident.class as the parameter to the getBoby method in the camel-cxf consumer side,  it is out of box :).

I did some work on CAMEL-829, and updated the test case in my last commit[1] , which also show how to avoid  the Holder parameters by turn off the wrapper style parameter mapping.

Please check out the WSDL[2] which has a JAXWS customer extension to turn off the wrapper style parameter mapping.

[1] http://svn.apache.org/viewvc?rev=687273&view=rev
[2] https://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-cxf/src/test/resources/person-non-wrapper.wsdl

> CXF - wrapper/unwrapper - camel-cxf should be smarter
> -----------------------------------------------------
>
>                 Key: CAMEL-723
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-723
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-cxf
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>            Assignee: Willem Jiang
>             Fix For: 1.5.0
>
>
> Willem knows what this is. See chat log on the july-15-2008.
> Basically getBody() should be smart in what kind of situation you are using CXF.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Resolved: (CAMEL-723) CXF - wrapper/unwrapper - camel-cxf should be smarter

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/activemq/browse/CAMEL-723?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CAMEL-723.
--------------------------------

    Resolution: Fixed

Please check out the
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/non_wrapper/PersonProcessor.java?view=markup&pathrev=687273

You can handle get the request message object by using the below code by turning off the wrapper style parameter mapping in WSDL2Java processing.

{code:language=java}

public class PersonProcessor implements Processor {

    private static final transient Log LOG = LogFactory.getLog(PersonProcessor.class);

    public void process(Exchange exchange) throws Exception {
        LOG.info("processing exchange in camel");

       GetPerson person =  exchange.getIn().getBody(GetPerson.class);
        String personId = person.getPersonId();
        GetPersonResponse response = new GetPersonResponse();

        if (personId == null || personId.length() == 0) {
            LOG.info("person id 123, so throwing exception");
            // Try to throw out the soap fault message
            org.apache.camel.non_wrapper.types.UnknownPersonFault personFault =
                new org.apache.camel.non_wrapper.types.UnknownPersonFault();
            personFault.setPersonId("");
            org.apache.camel.non_wrapper.UnknownPersonFault fault =
                new org.apache.camel.non_wrapper.UnknownPersonFault("Get the null value of person name", personFault);
            // Since camel has its own exception handler framework, we can't throw the exception to trigger it
            // We just set the fault message in the exchange for camel-cxf component handling
            exchange.getFault().setBody(fault);
        }
        response.setPersonId(personId);
        response.setName("Bonjour");
        response.setSsn("123");
        LOG.info("setting Bonjour as the response");
        // Set the response message, first element is the return value of the operation,
        // the others are the holders of method parameters
        exchange.getOut().setBody(new Object[] {response});
    }

}

{code}



> CXF - wrapper/unwrapper - camel-cxf should be smarter
> -----------------------------------------------------
>
>                 Key: CAMEL-723
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-723
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-cxf
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>            Assignee: Willem Jiang
>             Fix For: 1.5.0
>
>
> Willem knows what this is. See chat log on the july-15-2008.
> Basically getBody() should be smart in what kind of situation you are using CXF.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-723) CXF - wrapper/unwrapper - camel-cxf should be smarter

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45162#action_45162 ]

Claus Ibsen commented on CAMEL-723:
-----------------------------------

Much better with the {{exchange.getIn().getBody(GetPerson.class);}}

Willem is the turn off wrapper needed in the wsdl?
<jaxws:bindings>
<jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
</jaxws:bindings>

I haven't seen this before and I doubt that many knows about this one? Isn't it possible to configure this without having to do it in the .wsdl file?
Such as on the cxf endpoint?

> CXF - wrapper/unwrapper - camel-cxf should be smarter
> -----------------------------------------------------
>
>                 Key: CAMEL-723
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-723
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-cxf
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>            Assignee: Willem Jiang
>             Fix For: 1.5.0
>
>
> Willem knows what this is. See chat log on the july-15-2008.
> Basically getBody() should be smart in what kind of situation you are using CXF.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (CAMEL-723) CXF - wrapper/unwrapper - camel-cxf should be smarter

JIRA jira@apache.org
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/activemq/browse/CAMEL-723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45185#action_45185 ]

Willem Jiang commented on CAMEL-723:
------------------------------------

There are some descriptions in the Chapter 8 of JAXWS 2.1 spec about the a standard customization facility that can be used to customize the WSDL 1.1 to Java binding.
My last commit uses external binding file to turn off the wrapper mapping, please check it[1] out.

[1] http://svn.apache.org/viewvc?rev=689425&view=rev

> CXF - wrapper/unwrapper - camel-cxf should be smarter
> -----------------------------------------------------
>
>                 Key: CAMEL-723
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-723
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-cxf
>    Affects Versions: 1.4.0
>            Reporter: Claus Ibsen
>            Assignee: Willem Jiang
>             Fix For: 1.5.0
>
>
> Willem knows what this is. See chat log on the july-15-2008.
> Basically getBody() should be smart in what kind of situation you are using CXF.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.