Hi Jeff,
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?
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.
-Yi
On Thu, May 21, 2009 at 5:50 AM, Jeff Ortel <jortel(a)redhat.com> wrote:
Hey Yi,
Welcome to suds :-)
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.
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.
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.
You can do something like:
from suds.xsd.doctor import Doctor
class MyDoctor(Doctor):
def examine(root):
<navigate to problem elements>
child = root.getChild('xyz')
child.set('minOccurs', 0)
In you code:
client = Client(url, schemadoctor=MyDoctor())
Hope this helps.
Please let me know how you make out.
Regards,
Jeff
Yi Qiang wrote:
> Hi,
> 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:
>
> <s:element minOccurs="1" maxOccurs="1"
name="fDefault" type="s:boolean"/>
>
> So when suds generates the SOAP request, it will put the following as a
> default:
>
> <ns0:fDefault xsi:nil="true"/>
>
> 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.
>
> 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.
>
> Is there anyway to tell suds to not put default elements? I.e., only
> create XML elements that I specifically ask for?
>
> Thanks,
> Yi
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> fedora-suds-list mailing list
> fedora-suds-list(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/fedora-suds-list
>