upload_xml_profile_wsdl exception

Hi,

I’m trying to upload a WSDL file to associate with an XML profile in ASM, but getting an exception saying “The XML profile doesn’t have a WSDL file”.

This is my code:

import bigsuds

bigip = bigsuds.BIGIP(hostname='bigip-lab')

profile_name="Test_Profile"
policy_name="/Common/Dan_Test_Policy"
xml_file="/media/sf_VirtualBox/bigip/Device.svc"
filename="Device.wsdl"
contents = ''
with open(xml_file) as f:
    contents = f.read()

result = bigip.ASM.Policy.upload_xml_profile_wsdl(policy_name, profile_name, filename, contents)

And this is the exception being thrown:

dmarkhas@dmarkhas-VirtualBox:~/workspace/BigIP$ python policy.py 
No handlers could be found for logger "suds.client"
Traceback (most recent call last):
  File "policy.py", line 14, in 
    result = bigip.ASM.Policy.upload_xml_profile_wsdl(policy_name, profile_name, filename, contents)
  File "/usr/local/lib/python2.7/dist-packages/bigsuds.py", line 416, in wrapped_method
    result = method(*args, **kwargs)
  File "build/bdist.linux-x86_64/egg/suds/client.py", line 542, in __call__
  File "build/bdist.linux-x86_64/egg/suds/client.py", line 602, in invoke
  File "build/bdist.linux-x86_64/egg/suds/client.py", line 649, in send
  File "build/bdist.linux-x86_64/egg/suds/client.py", line 702, in failed
  File "build/bdist.linux-x86_64/egg/suds/bindings/binding.py", line 265, in get_fault
bigsuds.ServerError: Server raised fault: 'Exception caught in ASM::urn:iControl:ASM/Policy::upload_xml_profile_wsdl()
Exception: Common::OperationFailed
        primary_error_code   : 0 (0x00000000)
        secondary_error_code : 0
        error_string         : The XML profile doesn't have a WSDL file'

Any idea what is missing? Has anyone been successful in uploading a schema file to an XML profile in ASM?

Does the wsdl file exist? Odd that the XML file has a preceding path but the wsdl doesn’t. Perhaps drop all the file names to lower case, just in case.

Actually, it’s probably that you are missing wsdl_ from two of the parameter names;

policy_name - String - The name of the policy.
profile_name - String - The name of the XML profile.
>>> wsdl_filename - String - The WSDL filename which will be attached to the XML profile.
>>> wsdl_text - String

Yes, the file exists. The reason why xml_file has a full path is because Python opens the file to read its contents, so it needs to know where to find it, whereas wsdl_filename is (to my understanding) just a string to associate with the file contents on BigIP.

I don’t think the names of the parameters matter, but I did try to rename them to match the documentation exactly - with no success. I don’t understand what the exception “The XML profile doesn’t have a WSDL file” means (of course it doesn’t have a file yet, that’s exactly what I’m trying to accomplish :-)), and there doesn’t seem to be documentation about this error.

I’m wondering if anyone has succeeded to upload a WSDL file to an XML profile via API (either SOAP or REST)?

OK, fair enough. Do you need to call the os.path module perhaps?

I don’t think the problem is with the code (I implemented the same functionality in Perl with SOAP::Lite and got the same error). But after some more testing I discovered that the code works if there is already a WSDL file associated with the XML profile with the same name as the one I am trying to upload. For example, if I upload Device.wsdl to the XML Profile via the GUI and then run the Python script - it doesn’t throw any errors and actually overwrites the contents of the file on the BigIP appliance. But if I run the exact same script just with a different wsdl_filename (that doesn’t already exist), I get the error “The XML profile doesn’t have a WSDL file”.

Maybe I am missing something but I thought the entire purpose of this method was to allow to upload new WSDL files to the XML Profile… O_o

Yep, pretty poor I’d agree. I’ve never found iControl ‘friendly’ where files are concerned.

Well is there any alternative? I really have to find a way to upload the schemas automatically…

I’m sure F5 Support, or perhaps Professional Services would be happy to help.