Closed IlfirinPL closed 9 years ago
This is something the library should be able to do. As a workaround you can save the WSDL to a local file and load from there. See this topic for hints on other workarounds for this issue.
For some reason this workaround is not working (solution with saving WSDL and loading it from file i still get TransportError: HTTP Error 401: Unauthorized), could you provide example implementation of client which would allow both http authentication and WindowsHttpAuthenticated ? and attached it as example to sudslibrary ?
If your WSDL references schemas in a secure location, then Suds would error like that. I have not tried to save schemas locally and reference them -- not sure if it is possible. If you really do need to use one transport to load the WSDL and another to load a referenced schema, you would have to write your own transport I think. Have you tried a workaround like this?
from robot.libraries.BuiltIn import BuiltIn
from suds.transport.http import WindowsHttpAuthenticated as Transport # for NTLM HTTP authentication
class SudsLibraryExtensions(object):
def load_client_using_ntlm_authentication(self, url, username, password):
suds_lib = BuiltIn().get_library_instance("SudsLibrary")
t = Transport(username=username, password=password)
client = Client(url, transport=t)
return suds_lib._add_client(client)
I think I am doing something wrong I have add file with content of your workaround to "sudsext.py" but RF doesn`t see this new method. in location c:\Python27\Lib\site-packages\SudsLibrary\
I was able to take a WSDL that referenced an external schema file and change it so the schema would be read from disk. If the WSDL is read from disk and the location of the schema file is relative, Suds will attempt to load the file from the disk based on the relative path.
For example if you have a WSDL with an import like this,
<s:import schemaLocation="http://example.com/ws/saleservice.asmx?schema=SaleDataSet" ...
You can save the referenced file to the same folder as the WSDL, and change the import in the WSDL to match it:
<s:import schemaLocation="SaleDataSet.xsd" ...
If you had a structure like this:
C:/myproj/tests
\\--test_suite.robot
\\--resources
\\--saleservice.asmx.wsdl
\\--SaleDataSet.xsd
Then, in test_suite.robot, you could do:
Create Soap Client ${CURDIR}/resources/saleservice.asmx.wsdl
and both the WSDL and the schema would load from the hard disk.
My problem with error 401 still exists, event when I use branch code from " added support for http auth in Create Soap Client", I think I need more then only http auth, for SSO.
This sounds like a good feature and would be even better one, if it would also include the (authenticating) proxy settings. To use SubsLibrary behind an authenticating proxy one needs to use the above mentioned workaround (i.e. download WSDL file manually and use that for the "create soap client") e.g. Create Soap Client ${CURDIR}/sudsExample.wsdl Set Proxies http http://user:passwd@my.proxy.com:8080
Could you release version 0.9 thus this useful functionality can be used without patching/replacing files within the directory \Python27\Lib\site-packages\SudsLibrary ?
I will try to get this out soon. I think I stopped because of issues with Jython. This change was good.
In some system its required to authenticate before you can get wsdl ,and Set Http Authentication work after client is created.