Wednesday, 6 November 2019

soapui MockService script to get value from request and set in response

REST MockService with Property msisdn, value empty (not sure if this is needed)

REST MockService with OnRequest Script containing:
log.info("request:\n")
log.info(mockRequest)
log.info(mockRequest.getRequestContent())
def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent )
log.info(holder)
// no need to mess with urn or namespace
//holder.namespaces["ns"] = "http://mbleh"
//holder.namespaces["urn"] = "urn"
msisdn = holder.getNodeValue("//urn:msisdn")
log.info(msisdn)
log.info("set context.msisdn="+msisdn)
context.msisdn = msisdn
// and get/set several other parameters
for ( item in ["a", "b", "c"]) {
    log.info "Item : [$item]"
    v = holder.getNodeValue("//urn:" + item)
    log.info("set context." + item + "="+v)
    context.setProperty(item, v)
}

https://support.smartbear.com/readyapi/apidocs/soapui/com/eviware/soapui/support/XmlHolder.html

https://www.soapui.org/scripting-properties/property-expansion.html


Example of incoming request:
POST /path HTTP/1.1
soapaction: XXXX
content-type: text/xml;charset=UTF-8
Host: hostname:8081
Content-Length: 525
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:va.a.a">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:REQUEST>
         <urn:msisdn>11144444483</urn:msisdn>
         <urn:a>A</urn:a>
      </urn:REQUEST>
   </soapenv:Body>
</soapenv:Envelope>


Part of Mock Action, Response:  see ${msisdn}  var set in Mock Service context
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <RESPONSE version="1.0" xmlns="urn:va.a.a" xmlns:ns2="urn:vb.b.b" xmlns:ns3="urn:vc.c.c" xmlns:ns4="urn:vd.d.d" xmlns:ns5="urn:ve.e.e">
         <a>A</a>
         <msisdn>${msisdn}</msisdn>
      </RESPONSE>
   </soapenv:Body>
</soapenv:Envelope>


And the actual response sent: (msisdn filled in via script and context.msisdn)
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 888
Server: Jetty(6.1.26)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <RESPONSE version="1.0" xmlns="urn:va.a.a" xmlns:ns2="urn:vb.b.b" xmlns:ns3="urn:vc.c.c" xmlns:ns4="urn:vd.d.d" xmlns:ns5="urn:ve.e.e">
         <a>A</a>
         <msisdn>11144444483</msisdn>
      </RESPONSE>
   </soapenv:Body>
</soapenv:Envelope>



Sunday, 3 November 2019

Weekend diary, more bike maintenance, pumpkin salad dinners, Tibradden GAP hike.


Weekend some more bike maintenance jobs and pumpkin salad dinners.

Pumpkin salad with red onion, red pepper, pomegranite. With black pudding and egg. For Halloween dinner.


More pumpkin salad with home made burger and halloumi. Nom. Sat dinner.


Daire's bike dropped to shop needing a good all round service, new tyres front and back, rear wheel made true, brake pads, brake/gear cables.

Kate's bike counted cogs and links, new brake pads on back. 14-34 7 speed cassette found same or 11-32. 114 links in chain.

Kate rear cassette 14-34 7 speed (7 rings, smallest(hardest gear) with 14 teeth, largest(easiest gear) with 34 teeth.




Bit of a hike Sunday. Tibradden zip it to Fairy Castle, down to the GAP. I ran back from before fairy castle to bring car to GAP.

Railway sleepers across from Tibradden eastwards towards Fairy Castle. Old volcanos big and little sugar loaf in distance. Lovely sunny day after very wet rainy day yesterday.


https://cyclist.ie/2019/11/cyclist-ie-response-on-dttas-consultation-on-personal-powered-transport-ppt/
Good submission, from cyclist.ie positive towards use of electric scooters and similar vehicles without extra rules and regulations.

As a cyclist and driver I have found training that I have done for motorcycling and MTB(mountain bike) to have been useful for cycling on roads(urban and rural). Everyone would benefit from training but more from experience. I think it is very important that mandatory training and safety gear beyond what is the current law is not a requirement(for cycling and PPT) as the most important priority for safety is better designed and segregated infrastructure and lower speeds. If all drivers had experience using a form of PPT or cycling then sharing the roads would be safer so requiring that as part of licence would be very good.

The RSA ad campaigns seem to work well, more training ads on vehicles (especially large vehicles) sharing roads with PPT and cyclists and pedestrians would be good.

https://www.irishtimes.com/news/crime-and-law/vigil-held-for-cyclist-who-died-in-collision-with-cement-truck-in-dublin-1.4069178?mode=amp 9am fri morn. Front left bumper cement truck en route st james hospital building site. truck was turning left off the South Circular Road at the junction with Brookfield Road. local resident, said the danger posed by the junction was an issue the community had raised with Dublin City Council “for many years”.
8th cyclist death on road for 2019. 122 total road deaths 2019 so far.
https://www.openstreetmap.org/#map=17/53.33868/-6.29969&layers=N


https://maps.app.goo.gl/6H76sUP7Qv5d95HR8

Today, Sunday, 11:20am
Group of 20 walkers on right today on road from lamb's cross towards marlay park. Road not wide enough for 2 cars and pedestrian. No footpath. Cars driving on anyway in same lane as walkers squeezing them into ditch. !? Have these drivers never been a walker on a road before? :-(

I have not seen PPT users being a hindrance to other road users beyond the odd inexperienced or mistake which you also get with vehicles and cyclists.

A few PPT engines seem powerful and it would make sense to require those with larger power to weight ratio to require licencing/training/safety gear like mopeds/small powered vehicles.

https://slate.com/technology/2019/10/future-of-transportation-bus-bike-elevator.html
TLDR; hyperloop, electric vehicles, autonomous (self-driving) vehicles, faster a to b travel doesn't improve quality of life. Simpler existing tech like bus bike and elevator can.