Monday, 6 November 2017

Using curl to drive a SOAP-based web service

As part of some tinkering (!) with IBM BPM 8.6, specifically to test a SOAP-based Web Service, as exposed ( exported ) by a SCA module, I wanted to quickly test the service without needing to start/use SoapUI each and every time.

Thankfully, there's a curl for that …

I'd checked the SCA Module to check the Endpoint Address of the SCA module: -


and then hit the ?wsdl action to pull back the WSDL itself: -


This auto-expands to this URL: -


I then used SoapUI one time only to hit this expanded URL, to get a view on the input XML: -


I then created an XML file that represented the input to the Web Service: -

canarySoap.xml

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cal="http://Canary/callTheCanary">
   <soapenv:Header/>
   <soapenv:Body>
      <cal:callTheCanary>
         <yourName>Dave Hay</yourName>
      </cal:callTheCanary>
   </soapenv:Body>
</soapenv:Envelope>

and then worked out ( thanks to Google ) how to invoke it using curl: -

curl --insecure --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:urn:callTheCanary" --data @canarySoap.xml https://bpmdb.uk.ibm.com:9443/CanaryWeb/sca/callTheCanary

Now I can hit the service as often as I like, and see the response in the BPM box's SystemOut.log: -

tail -f /opt/ibm/WebSphereProfiles/AppSrv01/logs/AppClusterMember1/SystemOut.log

...
[06/11/17 17:35:09:791 GMT] 0000002e XSThreadPool  W   CWOBJ7852W: Thread starvation detected.  Thread scheduling delay is 126842 ms.
[06/11/17 17:35:29:577 GMT] 0000004f CoordinatorCo W   HMGR0152W: CPU Starvation detected. Current thread scheduling delay is 126 seconds.
[06/11/17 17:35:29:626 GMT] 00000051 ApplicationMo W   DCSV0004W: DCS Stack DefaultCoreGroup at Member PSCell1\Node1\AppClusterMember1: Did not receive adequate CPU time slice. Last known CPU usage time at 17:32:53:015 GMT. Inactivity duration was 126 seconds. 
[06/11/17 19:29:21:443 GMT] 0000002e XSThreadPool  W   CWOBJ7852W: Thread starvation detected.  Thread scheduling delay is 6789141 ms.
[06/11/17 19:29:24:506 GMT] 00000104 TaskLoader    I   CWLLG0597I: Trying to acquire synchronous queue SYNC_QUEUE_1.
[06/11/17 19:29:24:514 GMT] 00000104 TaskLoader    I   CWLLG0581I: Acquired synchronous queue SYNC_QUEUE_1.
[06/11/17 19:29:38:720 GMT] 0000004f CoordinatorCo W   HMGR0152W: CPU Starvation detected. Current thread scheduling delay is 6789 seconds.
[06/11/17 19:29:38:767 GMT] 00000053 ApplicationMo W   DCSV0004W: DCS Stack DefaultCoreGroup at Member PSCell1\Node1\AppClusterMember1: Did not receive adequate CPU time slice. Last known CPU usage time at 17:35:59:627 GMT. Inactivity duration was 6789 seconds. 
[06/11/17 20:35:36:122 GMT] 000004b3 ServerCache   I   DYNA1001I: WebSphere Dynamic Cache instance named ws/WSSecureMapNotShared initialized successfully.
[06/11/17 20:35:36:122 GMT] 000004b3 ServerCache   I   DYNA1071I: The cache provider "default" is being used.
[06/11/17 20:39:46:344 GMT] 000004b3 SystemOut     O Your name is Dave Hay
[06/11/17 20:40:03:095 GMT] 000004b3 SystemOut     O Your name is Dave Hay
[06/11/17 20:40:03:984 GMT] 000004b3 SystemOut     O Your name is Dave Hay
...

Yay !

No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...