Can I use Service Callout to send a SOAP request?

I have a requirement to store data to the usergrid through POST from my API proxy and also invoke another SOAP webservice if the payload has a certain field. (Basically I need to invoke a webservice that creates a BPM task)

Do I have to create an api proxy using this WSDL and invoke the proxy through a service callout or can I build the SOAP request and invoke the web service directly through the service callout?

Additionally, I dont have to send the response from the webservice back to the client which made the request to the API proxy. Is there a way I can handle this asynchronously?

Solved Solved
0 3 1,412
1 ACCEPTED SOLUTION

Not applicable

Hi, @Nagashree B,

No, you don't have to create a proxy from the WSDL to make the SOAP request. You can construct the SOAP request using the assign message policy or in JavaScript.

Regarding making the call asynchronously, the simplest route would be to invoke it from JavaScript, rather than the service callout policy. This post should be helpful: https://community.apigee.com/articles/2340/asynchronous-http-requests-in-an-api-proxy.html

View solution in original post

3 REPLIES 3

Not applicable

Hi, @Nagashree B,

No, you don't have to create a proxy from the WSDL to make the SOAP request. You can construct the SOAP request using the assign message policy or in JavaScript.

Regarding making the call asynchronously, the simplest route would be to invoke it from JavaScript, rather than the service callout policy. This post should be helpful: https://community.apigee.com/articles/2340/asynchronous-http-requests-in-an-api-proxy.html

Thanks Lee. This worked. I used javascript to do it.

I have a question, if I build the soap message through Assign Message policy with createNew=true, and AssignTo as request1, how can I access this request1 message variable in javascript callout. context.getVariable didnt work.

Glad to hear it. Depending on what you're trying to do, you probably need something like

var req = context.getVariable('request1').content.asJSON

Take a look at http://apigee.com/docs/api-services/reference/javascript-object-model.