Dynamic input to a SOAP service


Could you please provide me a sample project where we consume a SOAP service?
The request should not be generated in hardcoded format as provided in this link:

My need is to generate the SOAP request in dynamic way. How can we be able to achieve this?


Hi Saumya

This example is using a Freemarker template to generate a dynamic request. Hence at runtime, the ${city} and ${country} will be substituted for values of current process instance variables by the same name. Hence whilst the structure is static, the content is dynamic. Typically this pattern uses the Camunda connector architecture.

Note that this is a request. Typically you will need to consume and parse the SOAP response. Ive typically used some script code to process the response. The Camunda Spin framework [1] can be useful for this purpose.

Hence what do you mean by generate a SOAP request in a dynamic way? Is the Freemarker template with variable substitution sufficient for your needs?



[1] https://docs.camunda.org/manual/7.4/reference/spin/xml/

Hey Rob,

Thanks for the reply.
But my requirement is to generate the SOAP envelope dynamically. In this example, the SOAP structure is static one. Is there any sample project where the SOAP structure itself is generated through code?

I dont have an example, however the way I would anticipate to do what you want is use a service task with a java delegate. In your java delegate code you could use something like the Apache CXF libraries to achieve dynamic SOAP requests etc.




see the soap-cxf-service project example. It uses a generated CXF soap service client. See also the soap-cxf-server-start example.

Best regards,