marlonumaliOccasional ContributorJoined 9 years ago11 Posts2 LikesLikes received1 SolutionView All Badges
ContributionsMost RecentMost LikesSolutionsVirt Assertion Report Hi All, Is there a way to generate a report on the result of Virt assertion, I can see the result of my virt assertion on ServiceV but I cannot see how to generate a report on it like the report that SoapUI test cases can produce. I really appreciate any advice or help the community will provide. Thanks, Marlon How to validate request message against an xsd file in ServiceV Virt Assertion I' m trying to validate request message sent to our Virt Server but has not succeeded yet. I'm using the following script which works in SoapUI Test Step Assertion for response message. def xsd1= new StreamSource(new FileInputStream("C:\\Projects\\xsd\\xsd1.xsd")) def xsd2= new StreamSource(new FileInputStream("C:\\Projects\\xsd\\xsd2.xsd")) StreamSource[] schemaFiles = [xsd1,xsd2]; def factory = XMLSchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI) def schema = factory.newSchema(schemaFiles) def validator = schema.newValidator() validator.validate(new StreamSource(new StringReader(messageExchange.requestContentAsXml))) This script when run gives an error "cvc-elt.1: Cannot find the declaration of element soapenv:Envelope". My goal is just to validate the data type of the element and attribute values that are sent in a Message Request which the built in "Schema Compliance" assertion does not seem to check as stated in "https://support.smartbear.com/readyapi/docs/testing/assertions/reference/compliance/schema-compliance.html". I appreciate any help or advice the community may give. Thank you. Re: SoapUI Mock Server on AWS EC2 with Load Balancer SSL I just found out that I need a "Custom TCP Rule" in the EC2 Security Group Inbound permission for port 9090. After I added this, I was then able to connect to my Mock Service. SoapUI Mock Server on AWS EC2 with Load Balancer SSL I’m trying to setup a SoapUI Mock Service on an AWS EC2 Windows instance with a Load Balancer that has an SSL certificate. The problem I’m encountering is I cannot connect to the Mock Server from my ReadyAPI desktop application. I have successfully setup the same SoapUI Mock Service on an AWS EC2 Windows instance without a Load Balancer. What I did is I just created a SoapUI Project with 3 operations and generated their corresponding mock services; I then assigned port 9090 which I also opened in Windows Firewall. I run the mock services and connect ReadyAPI from my desktop using the endpoint (http://EC2-IP Address:9090); I was then able to sent request and received response from the mock services in my AWS EC2 Windows instance. But this same procedure fails for my EC2 windows instance that has a Load Balancer and an SSL certificate. I have my AWS EC2 Certificate .PEM file, from which I generated a Private and Public key using PuTTY Key Generator, I then tried to use both keys on ReadyAPI keystore but it asked for a password which I don’t remember creating when I created the AWS certificate keyPair .PEM file. I also tried to register the generated Putty Private key in Windows Certificates but it cannot recognize the file type with .ppk extension. I may still be missing some steps, but I’m hoping the community can point me to the right direction as to what to research and use. Thank you. SolvedRe: Validate xml response with an xsd file. I rewrite the schema file and break it into two separate files to allow the use of two different namespaces ("http://schemas.xmlsoap.org/soap/envelope/" and "http://tempuri.org/") in the xml file. I validate the original xml successfully using Eclipse with the two schema files below: First Schema NewXMLSchema.xsd: <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://tempuri.org/" elementFormDefault="qualified"> <import schemaLocation="NewXMLSchema1.xsd" namespace="http://tempuri.org/" > </import> <element name="Envelope" type="s:Body" /> <complexType name="Body"> <sequence> <element name="Body" type="tns:GetDataResponse" /> </sequence> </complexType> </schema> The imported Schema NewXMLSchema1.xsd: <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/" xmlns:tns="http://tempuri.org/" elementFormDefault="qualified"> <complexType name="GetDataResponse" > <sequence> <element name="GetDataResponse" type="tns:GetDataResult"/> </sequence> </complexType> <complexType name="GetDataResult" > <sequence> <element name="GetDataResult" type="string" /> </sequence> </complexType> </schema> But when I tried to validate the original xml file in the soapui, i receive the following error message: src-resolve: Cannot resolve the name 'tns:GetDataResponse' to a(n) 'type of definition' component. Re: Validate xml response with an xsd file. Thanks nmrao, we like to use xsd validation as we have lots of data fields declaration and restriction that we want to validate, and I thought it would be very tedious to test each field by plain groovy scripts. Regards, Marlon Re: Validate xml response with an xsd file. Thank you for your advice nmrao, but the schema compliance doesn't seem to validate element data types, like if I have a Date element and the actual response value is an integer, the test step will still evaluate to true. Also, we like to control the restriction on some elements, like limiting the length of a string value which may change from time to time, this is why I thought it will be best to validate it against an xsd... Validate xml response with an xsd file. I'm searching for a way to validate an XML response in soapui pro using an xsd file: The XML response I got is below: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <GetDataResponse xmlns="http://tempuri.org/"> <GetDataResult>You entered: 5</GetDataResult> </GetDataResponse> </s:Body> </s:Envelope> I'm trying to validate it with an XSD file as: <?xml version="1.0"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/" xmlns:s="http://tempuri.org/" elementFormDefault="qualified"> <element name="GetDataResponse" type="GetDataResult"/> <element name="GetDataResult" type="string"/> </schema> The groovy script I use is: import javax.xml.XMLConstants import javax.xml.transform.stream.StreamSource import javax.xml.validation.SchemaFactory String response = messageExchange.responseContent new File( 'C:\\Projects\\WcfServiceAPITest\\WcfServiceAPITest.xsd' ).withReader { xsd -> SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI ) .newSchema( new StreamSource( xsd ) ) .newValidator() .validate( new StreamSource( new StringReader( response ) ) ) } but I'm getting the following error: src-resolve.4.2: Error resolving component 'GetDataResult'. It was detected that 'GetDataResult' is in namespace 'http://www.w3.org/2001/XMLSchema', but components from this namespace are not referenceable from schema document 'null'. If this is the incorrect namespace, perhaps the prefix of 'GetDataResult' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'null'. I would appreciate any help from the community. Thank you! Re: How to verify response content if it has valid DateTime or Decimal value, or if it has no value? Here is what I did to convert and test my response data. def response = new XmlSlurper().parseText(hl.prettyXml) def val1 = response.RootNode.ChildNode def val2= Date.parse('yyyy-MM-dd' , val1.toString()) assert (val2 instanceof Date) Re: How to verify response content if it has valid DateTime or Decimal value, or if it has no value? Thank you for your response nmrao, I am hoping that I can validate response data through script assertion because I might need to do some mathematical procedure to validate a Decimal or a DateTime values, such as to test if a response DateTime value is within a certain period like January 1 to March 31, 2017.