For efficient testing sometime you need to created automaticaly request xml feeding soap interface. If you are familiar with robot framework, it’s great. Robotframework has already 2 external Library, which handle SOAP interfaces communication.( Süds Library or Zeep Library ) .
There are a lot of opinion in Internet about these two libraries, discussing pro and contra using one of these lib. for testing SOAP.
Important things to do, you have to find out which library can handle “your WSDL“ better!
For my task, Suds library does.
How to find it out?
Just run your SOAP Library keyword pointing out your target WSDL .
Used “Create Soap Client” keyword for testing the binding if you get all the entities and objects on your WSDL, If the answed “OK” than you can used your Library for SOAP,
… Ports (1): …. Methods (10): addToIndex(xs:string guid, ) getProductMetadaten(xs:string guid, ) getProductMetadatenGuidList(xs:string query, ) getProductMetadatenList() … Types (62): ns3:AbstractCurveType ns3:AbstractGMLType ns3:AbstractGeometricAggregateType ns3:AbstractGeometricPrimitiveType … |
If not you have to find out other library for interfacing with SOAP.
As sample I got these error using Zeep for parsing my WSDL:
self.item_type = self.item_type.resolve()
AttributeError: ‘lxml.etree.QName’ object has no attribute ‘resolve’
These error are related to these following open issue on Zeep:
- https://github.com/mvantellingen/python-zeep/issues/803
- https://github.com/mvantellingen/python-zeep/issues/513
Sample of created XML request from RF with Suds Library:
this is how I wrote it in Robotframework Test Suite:
map WSDL local | |
Run Keyword and Continue On Failure | setProductMetadaten |
this is how I wrote it in Robotframework Test Case:
show object setProductMetadaten | |
setProductMetadaten |
calling internal keyword:
${object}= | Create WSDL Object | n2:ProductMetadata | ||
Set Wsdl Object Attribut | ${object.commonMetadata} | identifier | ${dummy_text} | |
Set Wsdl Object Attribut | ${object.commonMetadata} | title | ${dummy_text} | |
Set Wsdl Object Attribut | ${object.commonMetadata.description} | summary | ${dummy_text} | |
Set Wsdl Object Attribut | ${object.commonMetadata.description} | comments | ${dummy_text} | |
Set Wsdl Object Attribut | ${object.commonMetadata.product} | type | ${dummy_text} | |
Set Wsdl Object Attribut | ${object.commonMetadata.product} | subtype | ${dummy_text} | |
Set Wsdl Object Attribut | ${object.commonMetadata} | rflAuftragsnummer | ${dummy_text} | |
Set Wsdl Object Attribut | ${object.commonMetadata.change} | version | ${dummy_text} | |
${result}= | call Soap method | setProductMetadaten | ${object} |
RFlog result
Creating 100X Request with RF For loop keyword
map WSDL local | ||
:FOR | ${i} | IN RANGE 100 |
setProductMetadaten |
Hope these infos help you starting your SOAP request creation with Robotframework & SudsLibrary, just another way of SOAP testing than using SOAPUI.