I'm trying to get the current datetime in an attribute for a MockResponse in SoapUI.
What I've tried is:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:localns">
<soapenv:Header/>
<soapenv:Body>
<response instant="${=new java.text.SimpleDateFormat('yyyy-MM-dd'T'HH:mm:ssZ').format(new Date())}"/>
</soapenv:Body>
</soapenv:Envelope>
I've also tried it without the quotes around the variable, but it doesn't work.
I've seen plenty of examples for using variables as a text node, but not as an attribute, how do I do this?
EDIT The only way to get it to work was to declare a variable in the script below and pass that one to my attribute. This way, the quotes didn't get confused with each other.
Try:
<response instant="${new Date().format( 'yyyy-MM-dd'T'HH:mm:ssZ' )}"/>
Related
I have a current requirement where I need to make a soap call to retrieve the data for further business intelligence. I have no experience in SOAP.
The service call is called getSiteInfo.
getSiteInfo has following 4 parameters- userName, password, custNbr, siteId.
Now I can make calls like this and it generates an xml response
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bil="http://billing.xyz.cc/">
<soapenv:Header/>
<soapenv:Body>
<bil:getSiteInfo>
<!--userName:-->
<arg0>username</arg0>
<!--password:-->
<arg1>pswd</arg1>
<!--custNbr:-->
<arg2>288</arg2>
<!--siteId:-->
<arg3>0862578</arg3>
</bil:getSiteInfo>
</soapenv:Body>
</soapenv:Envelope>
I was wondering is it possible to include multiple siteId in the same call instead of doing it repeatedly for almost 1000+ siteIds.
I tried the following two to see if they work and none of them did. It only returned the response for the last item; 108952 in this case.
Method1
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bil="http://billing.xyz.cc/">
<soapenv:Header/>
<soapenv:Body>
<bil:getSiteInfo>
<!--userName:-->
<arg0>username</arg0>
<!--password:-->
<arg1>pswd</arg1>
<!--customerNumber:-->
<arg2>288</arg2>
<!--siteNumber:-->
<arg3>0862578</arg3>
<arg3>108952</arg3>
</bil:getSiteInfo>
</soapenv:Body>
</soapenv:Envelope>
Method2
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bil="http://billing.xyz.cc/">
<soapenv:Header/>
<soapenv:Body>
<bil:getSiteInfo>
<!--userName:-->
<arg0>username</arg0>
<!--password:-->
<arg1>pswd</arg1>
<!--customerNumber:-->
<arg2>288</arg2>
<!--siteNumber:-->
<arg3>108952</arg3>
</bil:getSiteInfo>
<bil:getSiteInfo>
<!--userName:-->
<arg0>username</arg0>
<!--password:-->
<arg1>pswd</arg1>
<!--customerNumber:-->
<arg2>288</arg2>
<!--siteNumber:-->
<arg3>0862578</arg3>
</bil:getSiteInfo>
</soapenv:Body>
</soapenv:Envelope>
Thank you very much in advance.
I'd like to use a SOAP request to get a list of items in servicenow table, that have description starting with "TEST".
I am able to send a simple getKeys request. For example the below one is successfully returning to me the sys_id of a single ticket:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hr="http://www.service-now.com/hr_case">
<soapenv:Header/>
<soapenv:Body>
<hr:getKeys>
<short_description>TEST Soap 1</short_description>
</hr:getKeys>
</soapenv:Body>
</soapenv:Envelope>
How should I modify the above request, so that it returns keys of all items with description starting with "TEST"?
I've used instead a REST webservice with the URI:
https://???.service-now.com/api/now/table/hr_case?sysparm_query=short_descriptionSTARTSWITHTEST
before then I tried a URI like that:
https://???.service-now.com/api/now/table/hr_case?&short_description=TEST Soap 1
I need to maintain an Active Directory service via SPMLv2 SOAP requests to an Active Roles Server.
I'm trying to do something ostensibly simple: delete the telephoneNumber attribute from an object. I'd never heard of SPML before so I spent some time trying to understand the specification available on the list of OASIS open standards.
I've figured out how to do it if the value is known. For example, the payload below will delete the telephoneNumber attribute if it matches the value '12345', but not any other value.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:oasis:names:tc:SPML:2:0">
<soapenv:Header/>
<soapenv:Body>
<urn:modifyRequest xmlns:spml="urn:oasis:names:tc:SPML:2:0">
<urn:psoID ID="CN=Some User,OU=User,OU=Accounts,DC=someorganisation,DC=org"/>
<urn:modification>
<modification name="telephoneNumber" operation="delete" xmlns="urn:oasis:names:tc:DSML:2:0:core">
<value>12345</value>
</modification>
</urn:modification>
</urn:modifyRequest>
</soapenv:Body>
</soapenv:Envelope>
What I can't figure out is how to do this for an unspecified value, i.e. I don't care what the value is before I delete it, I just want to delete it. I suspect this has something to do with the SelectionType and I just need to use a 'match anything' selector, but I'm having trouble understanding the specification.
Any ideas?
Edit: To add to the confusion, I see we're using the DSMLv2 namespace for the modification. I just pulled this from a sample on the Active Roles SPML service documentation so I don't know how/why it works. The SPML specification does mention DSML but doesn't give any context around its usage as far as I can tell. It could actually be a vendor specific implementation.
Figured out a solution/work-around to this problem.
To delete the attribute without knowing its current value, you can simply include a 'replace' operation to first set some arbitrary value and include it in the same modify request as the 'delete' operation.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:oasis:names:tc:SPML:2:0">
<soapenv:Header/>
<soapenv:Body>
<urn:modifyRequest xmlns:spml="urn:oasis:names:tc:SPML:2:0">
<urn:psoID ID="CN=Some User,OU=User,OU=Accounts,DC=someorganisation,DC=org"/>
<urn:modification>
<modification name="telephoneNumber" operation="replace" xmlns="urn:oasis:names:tc:DSML:2:0:core">
<value>deleteMe</value>
</modification>
<modification name="telephoneNumber" operation="delete" xmlns="urn:oasis:names:tc:DSML:2:0:core">
<value>deleteMe</value>
</modification>
</urn:modification>
</urn:modifyRequest>
</soapenv:Body>
</soapenv:Envelope>
I'm using Currency Converter webservice to practice groovy script in SoapUI Pro.
In that, I have created a property that should get response / output of the Currency Converter service through groovy script.
For that, I tried the following script which gets all the raw response data :(
I need to get the exact result i.e. converted value and assign to the property.
Can anyone provide me the correct groovy script?
Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET/">
<soapenv:Header/>
<soapenv:Body>
<web:ConversionRate>
<web:FromCurrency>USD</web:FromCurrency>
<web:ToCurrency>INR</web:ToCurrency>
</web:ConversionRate>
</soapenv:Body>
</soapenv:Envelope>
Response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ConversionRateResponse xmlns="http://www.webserviceX.NET/">
<ConversionRateResult>60.54</ConversionRateResult>
</ConversionRateResponse>
</soap:Body>
</soap:Envelope>
Thanks
Karunagara Pandi
First you need access to the Response.
def conversionRateResult = context.expand( '${step_name#Response#//*:ConversionRateResult}' )
Then to assign it to a property depends on multiple things: 1) where are you doing it from, and 2) where do you want the property assigned.
To crawl the hierarchy from a script step, you would do something like:
testRunner.testCase.setPropertyValue("property_name", conversionRateResult)
Consider browsing through the documentation and API.
I need to pass to soap component an object of a known class which is composed from two strings.
the soap request should be like:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsd="http://wsTest/">
<soapenv:Header/>
<soapenv:Body>
<wsd:find>
<entity>
<id>string_1</id>
<type>string_2</type>
</entity>
</wsd:find>
</soapenv:Body>
</soapenv:Envelope>
Is there a suitable MULE transformer where I can input the two Strings then convert them to the wanted class object ??
thank you.
Use an expression transformer:
<expression-transformer expression="#[new com.mycomp.Entity('string_1','string_2')]" />
assuming the com.mycomp.Entity class has a two string constructor.