Great!

I'll check it out now.

Thanks,

--Karl

On Wed, Nov 16, 2011 at 12:22 PM, Veres-Szentkiralyi Andras <vsza@vsza.hu> wrote:
Hi,
I created a proof-of-concept patch, that works with the network traffic you
sent, and is available in my GitHub repository:

https://github.com/dnet/suds/commit/4c930c764d8639c5d808609c756466c3e6070976

You can download the single modified file (transport/__init__.py) from the
following URL -- if you replace this with the one in your SUDS installation,
the example you sent to the mailing list should work.

https://github.com/dnet/suds/raw/4c930c764d8639c5d808609c756466c3e6070976/suds/transport/__init__.py

As you suggested, I put the logic into the Reply class, and the additional
methods check for multipart content. If no such content found, normal program
flow remains undisturbed, so this shouldn't cause any regressions. The part
marked as "start" gets in place of the message, other parts can be accessed
using the "parts" member. As it uses the standard email library, even encoded
parts (e.g. base64) can be decoded, and it should work on any Python 2.4+
install (I tested it on 2.7.2).

Let me know, whether it works in real life, I'm interested in the results.

Regards,
András Veres-Szentkirályi

2011. november 16. szerda 01:07:07 dátummal Karl Putland ezt írta:
> Sorry for they delay and thank you for looking.
>
> Not public.
> WSDL attached.
> Output from sample script attached.
>
> >From what I can tell... none of the python libraries are currently
>
> supporting SOAP-attachments.
>
>
> I added some debugging in SoapClient.send
>             request.headers = self.headers()
>             reply = transport.send(request)
>             if DEBUG:
>                 print '*&'*40
>                 print 'raw reply'
>                 print '*&'*40
>                 print reply
>                 print '*&'*40
>             ctx = plugins.message.received(reply=reply.message)
>             reply.message = ctx.reply
>
> It may be possible to implement in the plugins, but the headers don't pass
> through to the plugin... :/
> It seems that the best place for the multipart handling is in
> transport/http.py in the Reply object. Pass the headers in as HTTPMessage
> instead of the Dict to reconstruct the MimeMessage, then if it's
> Content-Type: text="text/xml" dump the body as the reply. otherwise follow
> the w3 doc and dump the rootpart ast the reply and create a list of
> attachment file-like objects.
>
> Thanks,
>
> --Karl
>
> On Wed, Nov 9, 2011 at 12:15 AM, Veres-Szentkiralyi Andras
<vsza@vsza.hu>wrote:
> > First of all, is this a public service? If so, can you provide a WSDL to
> > us?
> > If not, can you provide a dump of the request and the response (with
> > sensitive
> > material stripped if needed)?
> >
> > Regards,
> > András Veres-Szentkirályi
> >
> > 2011. november 9. szerda 05:33:13 dátummal Karl Putland ezt írta:
> > > I'm trying to talk to a service where the SOAP response is returning
> > > Content-Type: multipart/related. This behavior is documented here
> > >
> > > http://www.w3.org/TR/SOAP-attachments
> > >
> > > All of the current Python SOAP libraries choke on this behavior. It
> > > would be great if suds could handle Content-Type parsing in the
> > > transport adapters. I'm having difficulty getting my head wrapped
> > > around all of the urllib2 abstractions in transport/http.py.
> > >
> > > My best guess is that it needs to happen right before Reply is created,
> >
> > and
> >
> > > that Reply needs to have and attachments[] attribute and probably
> >
> > something
> >
> > > to represent the file.
> > >
> > > Thanks,
> > >
> > > --Karl
> >
> > _______________________________________________
> > suds mailing list
> > suds@lists.fedoraproject.org
> > https://admin.fedoraproject.org/mailman/listinfo/suds
_______________________________________________
suds mailing list
suds@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/suds