Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39075 > unrolled thread

SOAP web services using python. Would like to change the Envelope Document using MessagePlugin before sending it using suds

Started bysarat.devineni@gmail.com
First post2013-02-17 23:32 -0800
Last post2013-02-19 09:56 +0100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  SOAP web services using python. Would like to change the Envelope Document using MessagePlugin before sending it using suds sarat.devineni@gmail.com - 2013-02-17 23:32 -0800
    Re: SOAP web services using python. Would like to change the Envelope Document using MessagePlugin before sending it using suds dieter <dieter@handshake.de> - 2013-02-19 09:56 +0100

#39075 — SOAP web services using python. Would like to change the Envelope Document using MessagePlugin before sending it using suds

Fromsarat.devineni@gmail.com
Date2013-02-17 23:32 -0800
SubjectSOAP web services using python. Would like to change the Envelope Document using MessagePlugin before sending it using suds
Message-ID<56de6558-2701-4193-8f79-96a1599be5da@googlegroups.com>
Hi ,

My current SOAP request sent via suds.client looks like this:

<SOAP-ENV:Envelope (some name space URIs)>
  <SOAP-ENV:Header />
    <SOAP-ENV:Body>
      <ns5:saveModule>
        <request xsi:type="ns3:SaveModule">
          <Module xsi:type="ns4:Module">
            <ModuleName xsi:type="ns1:string">Test</ModuleName>
          </Module>
        </request>
      </ns5:saveModule>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This request fails on my server. If i take the same XML request and massage it and send it visa SOAPUI, it works fine. What I did was

<soapenv:Envelope (some name space URIs)>
  <soapenv:Header />
    <soapenv:Body>
      <saveModule>
        <request>
          <Module>
            <ModuleName>Test</ModuleName>
          </Module>
        </request>
      </saveModule>
    </soapenv:Body>
</soapenv:Envelope>

As you see, I had to change SOAP-ENV to soapenv, modify node ns5:saveModule to saveModule and also remove attributes such xsi:type to other child nodes

How can I , modify the request in above manner using suds.client. Documentation suggests to use a plugin with Client using marshalled method. But I was unsuccessful

Any help is greatly appreciated

Regards,
SD

[toc] | [next] | [standalone]


#39192

Fromdieter <dieter@handshake.de>
Date2013-02-19 09:56 +0100
Message-ID<mailman.2008.1361264218.2939.python-list@python.org>
In reply to#39075
sarat.devineni@gmail.com writes:
> My current SOAP request sent via suds.client looks like this:
>
> <SOAP-ENV:Envelope (some name space URIs)>
>   <SOAP-ENV:Header />
>     <SOAP-ENV:Body>
>       <ns5:saveModule>
>         <request xsi:type="ns3:SaveModule">
>           <Module xsi:type="ns4:Module">
>             <ModuleName xsi:type="ns1:string">Test</ModuleName>
>           </Module>
>         </request>
>       </ns5:saveModule>
>     </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> This request fails on my server. If i take the same XML request and massage it and send it visa SOAPUI, it works fine. What I did was
>
> <soapenv:Envelope (some name space URIs)>
>   <soapenv:Header />
>     <soapenv:Body>
>       <saveModule>
>         <request>
>           <Module>
>             <ModuleName>Test</ModuleName>
>           </Module>
>         </request>
>       </saveModule>
>     </soapenv:Body>
> </soapenv:Envelope>
>
> As you see, I had to change SOAP-ENV to soapenv, modify node ns5:saveModule to saveModule and also remove attributes such xsi:type to other child nodes

Looks as if you had a bad WSDL description of your service
and a server which fails to honor elementary standard elements
(of the "XML-namespace" standard, in particular).

The XML-namespace standard dictates that the concrete namespace prefixes
are (apart from some "xml" prefixes) insignificant; namespace prefixes
are use only to refer to namespace uris and only these uris
are relevant. Thus, a standard conform XML-namespace application
should world with whatever prefix is used as long as they refer
to the correct namespace uri.

According to the standard, "xsi:type" is used when the underlying schema
(in your WSDL) does not statically determine the type. In this
case, missing type information is provided by "xsi:type".
A standard conform application should not have problems with "xsi:type"
attributes. Alternatively, the schema (in the WSDL) can assign types
and "suds" will not generate "xsi:type" attribute (at least not in
simple cases).

> How can I , modify the request in above manner using suds.client. Documentation suggests to use a plugin with Client using marshalled method. But I was unsuccessful

I cannot answer you concrete question.

However, when you are working with a component that does not honor
standards (this seems to be the case for your server component),
it may not be possible to use (other) components developed against
those standards.

In your particular case, it might be necessary to generate the SOAP 
messages yourself - in the peculiar way, your server expects them -
rather than use "suds".

By the way: when I remember right, then "suds" supports some
control over the namespace prefixes used. Apparently, servers
not honoring the XML-namespace standard are not so rare.
Fortunately, I never needed this feature but I think I
have read something about it in the "suds" documentation.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web