How to use direct streaming for SOAP with Spring-WS?

前端 未结 3 674
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-07 08:56

We want to enable direct streaming of our payload in webservice endpoints. We have to process a large amount of data and want to stream the data while processing.

We use

相关标签:
3条回答
  • 2021-02-07 09:19

    You have also to disable the payload caching:

    <bean id="messageFactory" 
          class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory">
         <property name="payloadCaching" value="false"/>
    </bean> 
    

    With this setting we are finally able to perform direct streaming for SOAP with Spring WS!

    0 讨论(0)
  • 2021-02-07 09:22

    I can only think of a hack for this - stacks(cxf, spring ws etc) would buffer the entire message as they have to validate the response xml, to be able to calculate the cryptographic keys if security is enabled etc.

    So the hack would be to write your own custom servlet/spring controller which would handle this specific response and stream out the soap envelope, then your payload, then the end tag of soap envelope. This is assuming you don't have any WSS requirements.

    0 讨论(0)
  • 2021-02-07 09:24

    You cannot (should never) stream the data within a web service, as in continously sending XML over the HTTP connection in a single web-service request over time. You will have to make many single web-service calls, or accumulate several calls into one.

    If you need high performance, web-services are not great. But you can hand-optimize simple web-services, it is not that hard. But switching to another transport format would be more 'on the money' if you need higher performance. I'd still keep things over HTTP - especially if you have some authentication requirements.

    0 讨论(0)
提交回复
热议问题