Hi Jeff,<br>Thanks for the quick response. The problem with the schema doctor solution is that once I mark these elements to minOccurs=0, I do not get any validation when I get the response back. When the server gives me back the XML, I _do_ want to make sure that the elements marked as required are actually there. Does that make sense?<br>
<br>Can suds generate empty nodes with a default value in a way that .NET web services can understand better? If the the node was generated as "<ns0:fDefault>true</ns0:fDefault>" the service wouldn't choke so much.<br>
<br>-Yi<br><br><div class="gmail_quote">On Thu, May 21, 2009 at 5:50 AM, Jeff Ortel <span dir="ltr"><<a href="mailto:jortel@redhat.com">jortel@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hey Yi,<br>
<br>
Welcome to suds :-)<br>
<br>
That is annoying.  Making input XML have elements that are required and read only is contradictory.  They (the service provider) must be using these elements in reply messages as well.<br>
<br>
Anyway, The suds factory doesn't (currently) provide a way to specify a way to filter (in|out) nodes.  Although, I'm very willing to discuss added this functionality if we can't find a suitable work around.<br>

<br>
In the mean time, a good workaround might be to use the schema /doctor/ functionality introduced in 0.3.6 beta.  You'll have to get from trunk or wiki.  You can implement a Doctor to mark these elements to minOccurs=0 like you did in your local copy.  Using the schema doctor will at least keep you from having to maintain a local copy of the wsdl.<br>

<br>
You can do something like:<br>
<br>
from suds.xsd.doctor import Doctor<br>
<br>
class MyDoctor(Doctor):<br>
  def examine(root):<br>
    <navigate to problem elements><br>
    child = root.getChild('xyz')<br>
    child.set('minOccurs', 0)<br>
<br>
In you code:<br>
<br>
client = Client(url, schemadoctor=MyDoctor())<br>
<br>
Hope this helps.<br>
Please let me know how you make out.<br>
<br>
Regards,<br>
<br>
Jeff<br>
<br>
Yi Qiang wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">
Hi,<br>
The WSDL I am trying to use suds with is a bit annoying in that it defines certain elements as REQUIRED but read only. For example, it will have something like the following:<br>
<br>
<s:element minOccurs="1" maxOccurs="1" name="fDefault" type="s:boolean"/><br>
<br>
So when suds generates the SOAP request, it will put the following as a default:<br>
<br>
<ns0:fDefault xsi:nil="true"/><br>
<br>
Then the server complains that this is not valid. If I set this to say "true" or "false", the server complains that this field is read only.<br>
<br>
The only way I've been able to work around this is to download the WSDL from the server, make that element optional by changing "minOccurs" to 0.<br>
<br>
Is there anyway to tell suds to not put default elements? I.e., only create XML elements that I specifically ask for?<br>
<br>
Thanks,<br>
Yi<br>
<br>
<br></div></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
fedora-suds-list mailing list<br>
<a href="mailto:fedora-suds-list@redhat.com" target="_blank">fedora-suds-list@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/fedora-suds-list" target="_blank">https://www.redhat.com/mailman/listinfo/fedora-suds-list</a><br>
</blockquote>
</blockquote></div><br>