Grokbase Groups Camel users June 2015
FAQ
Hello camel community,

I'am trying to figure out how I can return a simple answer in spring-ws soap web service consumer.

I have a simple route like:
<bean id="endpointMapping" class="org.apache.camel.component.spring.ws.bean.CamelEndpointMapping" />

<route id="tris.apcs.pcm.callback.notifyMessages.route">
                <description>webservice implementation to capture the notifyMessages</description>
                <from uri="spring-ws://rootqname:{http://portcommunity.haven.antwerpen.be/}notifyMessages?endpointMapping=#endpointMapping" />
                <to uri="language://javascript:classpath:TRIS/apcs/pcm/wrap-in-notifyMessagesResponse.js?transform=false"/>
</route>

My route is called without any problem but it returns only http 200 ok response and the soap is empty (Content-Length: 0). The wrap-in-notifyMessagesResponse.js creates an xml and outputs it in the "out" of the exchange.
var dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
var db = dbf.newDocumentBuilder();
var output = db.newDocument();
var root = output.appendChild(output.createElementNS("http://portcommunity.haven.antwerpen.be/", "por:notifyMessagesResponse"));

request.setBody(output);
exchange.getOut().setBody(output);

I have to remark that I can also use spring dsl and not java code!

Can someone please point me in the direction of producing valid soap output.
--
vriendelijke groeten,
Ronny Aerts - Intris nv - Wapenstilstandlaan 47, 2600 Berchem, België
R&D Integration Architect
Prince II<http://nl.wikipedia.org/wiki/PRINCE2> certified - ITIL<http://nl.wikipedia.org/wiki/Information_Technology_Infrastructure_Library> certified
Tel: +32-3-326.50.75

Intris nv
Wapenstilstandlaan 47
B-2600 Berchem Tel. +32 3 326 50 75
Fax +32 3 326 42 23
www.intris.be<http://www.intris.be/> [http://www.intris.be/mail/AEO_Sticker_108pxRGB.jpg] <http://www.intris.be>

DISCLAIMER
This is an e-mail from Intris. The information contained in this communication is intended solely for use by the individual or entity to whom it is addressed.
Use of this communication by others is prohibited. If the e-mail message was sent to you by mistake, please notify support@intris.be , destroy it without reading, using, copying or disclosing its contents to any other person.
We accept no liability for damage related to data and/or documents which are communicated by electronic mail.

Search Discussions

  • Claus Ibsen at Jun 19, 2015 at 6:16 am
    Hi

    When use getOut on an exchange then please read this FAQ
    http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html
    On Thu, Jun 18, 2015 at 10:47 PM, Ronny Aerts wrote:
    Hello camel community,

    I'am trying to figure out how I can return a simple answer in spring-ws soap web service consumer.

    I have a simple route like:
    <bean id="endpointMapping" class="org.apache.camel.component.spring.ws.bean.CamelEndpointMapping" />

    <route id="tris.apcs.pcm.callback.notifyMessages.route">
    <description>webservice implementation to capture the notifyMessages</description>
    <from uri="spring-ws://rootqname:{http://portcommunity.haven.antwerpen.be/}notifyMessages?endpointMapping=#endpointMapping" />
    <to uri="language://javascript:classpath:TRIS/apcs/pcm/wrap-in-notifyMessagesResponse.js?transform=false"/>
    </route>

    My route is called without any problem but it returns only http 200 ok response and the soap is empty (Content-Length: 0). The wrap-in-notifyMessagesResponse.js creates an xml and outputs it in the "out" of the exchange.
    var dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
    var db = dbf.newDocumentBuilder();
    var output = db.newDocument();
    var root = output.appendChild(output.createElementNS("http://portcommunity.haven.antwerpen.be/", "por:notifyMessagesResponse"));

    request.setBody(output);
    exchange.getOut().setBody(output);

    I have to remark that I can also use spring dsl and not java code!

    Can someone please point me in the direction of producing valid soap output.
    --
    vriendelijke groeten,
    Ronny Aerts - Intris nv - Wapenstilstandlaan 47, 2600 Berchem, België
    R&D Integration Architect
    Prince II<http://nl.wikipedia.org/wiki/PRINCE2> certified - ITIL<http://nl.wikipedia.org/wiki/Information_Technology_Infrastructure_Library> certified
    Tel: +32-3-326.50.75

    Intris nv
    Wapenstilstandlaan 47
    B-2600 Berchem Tel. +32 3 326 50 75
    Fax +32 3 326 42 23
    www.intris.be<http://www.intris.be/> [http://www.intris.be/mail/AEO_Sticker_108pxRGB.jpg] <http://www.intris.be>

    DISCLAIMER
    This is an e-mail from Intris. The information contained in this communication is intended solely for use by the individual or entity to whom it is addressed.
    Use of this communication by others is prohibited. If the e-mail message was sent to you by mistake, please notify support@intris.be , destroy it without reading, using, copying or disclosing its contents to any other person.
    We accept no liability for damage related to data and/or documents which are communicated by electronic mail.


    --
    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/
  • Ronny Aerts at Jun 19, 2015 at 10:30 am
    Hello,

    I read the the FAQ link.

    I see that the exchange.hasOut() returns false.

    My tests:
    1. When I use a "exchange.getIn().setBody("this is just dummy data");" my spring-ws still return no data.
    2. I do a "exchange.getOut().setHeaders(exchange.getIn().getHeaders());" (there is a ) little in the FAQ page) and "exchange.getOut().setBody("this is just dummy data");". Still no output.
    3. I do a " exchange.getIn().setBody(output);". Still no output.
    4. I do a " result = output;" in combination with "transform=true" when calling the javascript. Still no output.
    5. I do a "<setBody><constant>this is just dummy data</constant></setBody>" instead of my javascript. Still no output.

    When I enable full logging, I see:
      [org.springframework.ws.server.MessageTracing.sent] MessageDispatcher with name 'spring-ws' sends no response for request [SaajSoapMessage {http://portcommunity.haven.antwerpen.be/}notifyMessages]
      [org.springframework.ws.transport.http.MessageDispatcherServlet] Cleared thread-bound request context: (POST //localhost:8080/notifyMessages)@345301231 org.eclipse.jetty.server.Request@1494e0ef
      [org.springframework.ws.transport.http.MessageDispatcherServlet] Successfully completed request
      [org.springframework.web.context.support.XmlWebApplicationContext] Publishing event in WebApplicationContext for namespace 'spring-ws-servlet': ServletRequestHandledEvent: url=[/notifyMessages]; client=[127.0.0.1]; method=[POST]; servlet=[spring-ws]; session=[null]; user=[null]; time=[162ms]; status=[OK]
    [org.springframework.web.context.support.XmlWebApplicationContext] Publishing event in Root WebApplicationContext: ServletRequestHandledEvent: url=[/notifyMessages]; client=[127.0.0.1]; method=[POST]; servlet=[spring-ws]; session=[null]; user=[null]; time=[162ms]; status=[OK]

    I see in the MessageDispatcher (http://docs.spring.io/spring-ws/sites/1.0/xref/org/springframework/ws/server/MessageDispatcher.html) that this situation occurs when messageContext.hasResponse() returns false.

    I'm sorry but I really don't know how to produce the 'response'.

    --
    Kind regards,
    Ronny Aerts – Intris nv – Wapenstilstandlaan 47, 2600 Berchem, Belgium
    R&D Integration Architect
    Prince II certified – ITIL certified
    Tel: +32-3-326.50.75
    -----Original Message-----
    From: Claus Ibsen
    Sent: vrijdag 19 juni 2015 8:15
    To: users@camel.apache.org
    Subject: Re: how to return a valid answer in a spring-ws consumer route (spring dsl)

    Hi

    When use getOut on an exchange then please read this FAQ http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html
    On Thu, Jun 18, 2015 at 10:47 PM, Ronny Aerts wrote:
    Hello camel community,

    I'am trying to figure out how I can return a simple answer in spring-ws soap web service consumer.

    I have a simple route like:
    <bean id="endpointMapping"
    class="org.apache.camel.component.spring.ws.bean.CamelEndpointMapping"
    />

    <route id="tris.apcs.pcm.callback.notifyMessages.route">
    <description>webservice implementation to capture the notifyMessages</description>
    <from uri="spring-ws://rootqname:{http://portcommunity.haven.antwerpen.be/}notifyMessages?endpointMapping=#endpointMapping" />
    <to
    uri="language://javascript:classpath:TRIS/apcs/pcm/wrap-in-notifyMessa
    gesResponse.js?transform=false"/>
    </route>

    My route is called without any problem but it returns only http 200 ok response and the soap is empty (Content-Length: 0). The wrap-in-notifyMessagesResponse.js creates an xml and outputs it in the "out" of the exchange.
    var dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
    var db = dbf.newDocumentBuilder();
    var output = db.newDocument();
    var root =
    output.appendChild(output.createElementNS("http://portcommunity.haven.
    antwerpen.be/", "por:notifyMessagesResponse"));

    request.setBody(output);
    exchange.getOut().setBody(output);

    I have to remark that I can also use spring dsl and not java code!

    Can someone please point me in the direction of producing valid soap output.
    --
    vriendelijke groeten,
    Ronny Aerts - Intris nv -
    Wapenstilstandlaan 47, 2600 Berchem, België R&D Integration Architect
    Prince II<http://nl.wikipedia.org/wiki/PRINCE2> certified -
    ITIL<http://nl.wikipedia.org/wiki/Information_Technology_Infrastructur
    e_Library> certified
    Tel: +32-3-326.50.75

    Intris nv
    Wapenstilstandlaan 47
    B-2600 Berchem Tel. +32 3 326 50 75
    Fax +32 3 326 42 23
    www.intris.be<http://www.intris.be/> [http://www.intris.be/mail/AEO_Sticker_108pxRGB.jpg] <http://www.intris.be>

    DISCLAIMER
    This is an e-mail from Intris. The information contained in this communication is intended solely for use by the individual or entity to whom it is addressed.
    Use of this communication by others is prohibited. If the e-mail message was sent to you by mistake, please notify support@intris.be , destroy it without reading, using, copying or disclosing its contents to any other person.
    We accept no liability for damage related to data and/or documents which are communicated by electronic mail.


    --
    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/
    Intris nv
    Wapenstilstandlaan 47
    B-2600 Berchem Tel. +32 3 326 50 75
    Fax +32 3 326 42 23
    www.intris.be<http://www.intris.be/> [http://www.intris.be/mail/AEO_Sticker_108pxRGB.jpg] <http://www.intris.be>

    DISCLAIMER
    This is an e-mail from Intris. The information contained in this communication is intended solely for use by the individual or entity to whom it is addressed.
    Use of this communication by others is prohibited. If the e-mail message was sent to you by mistake, please notify support@intris.be , destroy it without reading, using, copying or disclosing its contents to any other person.
    We accept no liability for damage related to data and/or documents which are communicated by electronic mail.
  • Ronny Aerts at Jul 2, 2015 at 3:20 pm
    Hello camel community,

    I stripped my spring dsl route to just the relevant statements. My actual route had a "<log message="${routeId} - end of route"/>" after calling the javascript (which produces the output). It seems that the extra log statement "eats" the response. The route works as expected after removing the log statement.
    Even a "<setHeader headerName="justatest"><constant>justme</constant></setHeader>" after processing the output clears the output.

    Is this expected behavior in camel 2.15.1 of a bug?

    PS: I now use a "exchange.getOut().setBody(output);" javascript statement to produce the result where output is a w3c document.

    --
    Kind regards,
    Ronny Aerts – Intris nv – Wapenstilstandlaan 47, 2600 Berchem, Belgium
    R&D Integration Architect
    Prince II certified – ITIL certified
    Tel: +32-3-326.50.75
    -----Original Message-----
    From: Ronny Aerts
    Sent: vrijdag 19 juni 2015 12:30
    To: users@camel.apache.org
    Subject: RE: how to return a valid answer in a spring-ws consumer route (spring dsl)

    Hello,

    I read the the FAQ link.

    I see that the exchange.hasOut() returns false.

    My tests:
    1. When I use a "exchange.getIn().setBody("this is just dummy data");" my spring-ws still return no data.
    2. I do a "exchange.getOut().setHeaders(exchange.getIn().getHeaders());" (there is a ) little in the FAQ page) and "exchange.getOut().setBody("this is just dummy data");". Still no output.
    3. I do a " exchange.getIn().setBody(output);". Still no output.
    4. I do a " result = output;" in combination with "transform=true" when calling the javascript. Still no output.
    5. I do a "<setBody><constant>this is just dummy data</constant></setBody>" instead of my javascript. Still no output.

    When I enable full logging, I see:
      [org.springframework.ws.server.MessageTracing.sent] MessageDispatcher with name 'spring-ws' sends no response for request [SaajSoapMessage {http://portcommunity.haven.antwerpen.be/}notifyMessages]
      [org.springframework.ws.transport.http.MessageDispatcherServlet] Cleared thread-bound request context: (POST //localhost:8080/notifyMessages)@345301231 org.eclipse.jetty.server.Request@1494e0ef
      [org.springframework.ws.transport.http.MessageDispatcherServlet] Successfully completed request [org.springframework.web.context.support.XmlWebApplicationContext] Publishing event in WebApplicationContext for namespace 'spring-ws-servlet': ServletRequestHandledEvent: url=[/notifyMessages]; client=[127.0.0.1]; method=[POST]; servlet=[spring-ws]; session=[null]; user=[null]; time=[162ms]; status=[OK] [org.springframework.web.context.support.XmlWebApplicationContext] Publishing event in Root WebApplicationContext: ServletRequestHandledEvent: url=[/notifyMessages]; client=[127.0.0.1]; method=[POST]; servlet=[spring-ws]; session=[null]; user=[null]; time=[162ms]; status=[OK]

    I see in the MessageDispatcher (http://docs.spring.io/spring-ws/sites/1.0/xref/org/springframework/ws/server/MessageDispatcher.html) that this situation occurs when messageContext.hasResponse() returns false.

    I'm sorry but I really don't know how to produce the 'response'.

    --
    Kind regards,
    Ronny Aerts – Intris nv – Wapenstilstandlaan 47, 2600 Berchem, Belgium R&D Integration Architect Prince II certified – ITIL certified
    Tel: +32-3-326.50.75
    -----Original Message-----
    From: Claus Ibsen
    Sent: vrijdag 19 juni 2015 8:15
    To: users@camel.apache.org
    Subject: Re: how to return a valid answer in a spring-ws consumer route (spring dsl)

    Hi

    When use getOut on an exchange then please read this FAQ http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html
    On Thu, Jun 18, 2015 at 10:47 PM, Ronny Aerts wrote:
    Hello camel community,

    I'am trying to figure out how I can return a simple answer in spring-ws soap web service consumer.

    I have a simple route like:
    <bean id="endpointMapping"
    class="org.apache.camel.component.spring.ws.bean.CamelEndpointMapping"
    />

    <route id="tris.apcs.pcm.callback.notifyMessages.route">
    <description>webservice implementation to capture the notifyMessages</description>
    <from uri="spring-ws://rootqname:{http://portcommunity.haven.antwerpen.be/}notifyMessages?endpointMapping=#endpointMapping" />
    <to
    uri="language://javascript:classpath:TRIS/apcs/pcm/wrap-in-notifyMessa
    gesResponse.js?transform=false"/>
    </route>

    My route is called without any problem but it returns only http 200 ok response and the soap is empty (Content-Length: 0). The wrap-in-notifyMessagesResponse.js creates an xml and outputs it in the "out" of the exchange.
    var dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
    var db = dbf.newDocumentBuilder();
    var output = db.newDocument();
    var root =
    output.appendChild(output.createElementNS("http://portcommunity.haven.
    antwerpen.be/", "por:notifyMessagesResponse"));

    request.setBody(output);
    exchange.getOut().setBody(output);

    I have to remark that I can also use spring dsl and not java code!

    Can someone please point me in the direction of producing valid soap output.
    --
    vriendelijke groeten,
    Ronny Aerts - Intris nv -
    Wapenstilstandlaan 47, 2600 Berchem, België R&D Integration Architect
    Prince II<http://nl.wikipedia.org/wiki/PRINCE2> certified -
    ITIL<http://nl.wikipedia.org/wiki/Information_Technology_Infrastructur
    e_Library> certified
    Tel: +32-3-326.50.75

    Intris nv
    Wapenstilstandlaan 47
    B-2600 Berchem Tel. +32 3 326 50 75
    Fax +32 3 326 42 23
    www.intris.be<http://www.intris.be/> [http://www.intris.be/mail/AEO_Sticker_108pxRGB.jpg] <http://www.intris.be>

    DISCLAIMER
    This is an e-mail from Intris. The information contained in this communication is intended solely for use by the individual or entity to whom it is addressed.
    Use of this communication by others is prohibited. If the e-mail message was sent to you by mistake, please notify support@intris.be , destroy it without reading, using, copying or disclosing its contents to any other person.
    We accept no liability for damage related to data and/or documents which are communicated by electronic mail.


    --
    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/
    Intris nv
    Wapenstilstandlaan 47
    B-2600 Berchem Tel. +32 3 326 50 75
    Fax +32 3 326 42 23
    www.intris.be<http://www.intris.be/> [http://www.intris.be/mail/AEO_Sticker_108pxRGB.jpg] <http://www.intris.be>

    DISCLAIMER
    This is an e-mail from Intris. The information contained in this communication is intended solely for use by the individual or entity to whom it is addressed.
    Use of this communication by others is prohibited. If the e-mail message was sent to you by mistake, please notify support@intris.be , destroy it without reading, using, copying or disclosing its contents to any other person.
    We accept no liability for damage related to data and/or documents which are communicated by electronic mail.
    Intris nv
    Wapenstilstandlaan 47
    B-2600 Berchem Tel. +32 3 326 50 75
    Fax +32 3 326 42 23
    www.intris.be<http://www.intris.be/> [http://www.intris.be/mail/AEO_Sticker_108pxRGB.jpg] <http://www.intris.be>

    DISCLAIMER
    This is an e-mail from Intris. The information contained in this communication is intended solely for use by the individual or entity to whom it is addressed.
    Use of this communication by others is prohibited. If the e-mail message was sent to you by mistake, please notify support@intris.be , destroy it without reading, using, copying or disclosing its contents to any other person.
    We accept no liability for damage related to data and/or documents which are communicated by electronic mail.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedJun 18, '15 at 8:47p
activeJul 2, '15 at 3:20p
posts4
users2
websitecamel.apache.org

2 users in discussion

Ronny Aerts: 3 posts Claus Ibsen: 1 post

People

Translate

site design / logo © 2021 Grokbase