Sending XML to a WEB Service and Getting Response Back

Hidura hidura at gmail.com
Mon Dec 20 15:14:47 EST 2010


I recommend you use the urllib.request in the library of python says
everything that you want to know.

2010/12/20, Anurag Chourasia <anurag.chourasia at gmail.com>:
> Dear Python Mates,
>
> I have a requirement to send a XML Data to a WEB Service whose URL is of the
> form http://joule:8041/DteEnLinea/ws/EnvioGuia.jws
>
> I also have to read back the response returned as a result of sending this
> data to this WebService.
>
> This web service implements the following operations:
>    sendNCR
>
> This web service has no callbacks.
>
> I have pasted the complete WSDL for this WEB Service below my email.
>
> I would appreciate if someone could guide me with sample code using a Python
> Library suitable to fulfill this requirement of mine.
>
> Regards,
> Anurag
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <wsdl:definitions xmlns:conv="
> http://www.openuri.org/2002/04/soap/conversation/" xmlns:cw="
> http://www.openuri.org/2002/04/wsdl/conversation/" xmlns:http="
> http://schemas.xmlsoap.org/wsdl/http/" xmlns:jms="
> http://www.openuri.org/2002/04/wsdl/jms/" xmlns:mime="
> http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="
> http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.openuri.org/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="
> http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="
> http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.openuri.org/">
>   <wsdl:types>
>     <s:schema xmlns:s="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified" targetNamespace="http://www.openuri.org/">
>       <s:element name="sendNCR">
>         <s:complexType>
>           <s:sequence>
>             <s:element name="xml" type="s:string" minOccurs="0"/>
>           </s:sequence>
>         </s:complexType>
>       </s:element>
>       <s:element name="sendNCRResponse">
>         <s:complexType>
>           <s:sequence>
>             <s:element name="sendNCRResult" type="s:int"/>
>           </s:sequence>
>         </s:complexType>
>       </s:element>
>       <s:element name="int" type="s:int"/>
>     </s:schema>
>
>   </wsdl:types>
>   <wsdl:message name="sendNCRSoapIn">
>     <wsdl:part name="parameters" element="s0:sendNCR"/>
>   </wsdl:message>
>   <wsdl:message name="sendNCRSoapOut">
>     <wsdl:part name="parameters" element="s0:sendNCRResponse"/>
>   </wsdl:message>
>   <wsdl:message name="sendNCRHttpGetIn">
>     <wsdl:part name="xml" type="s:string"/>
>   </wsdl:message>
>   <wsdl:message name="sendNCRHttpGetOut">
>     <wsdl:part name="Body" element="s0:int"/>
>   </wsdl:message>
>   <wsdl:message name="sendNCRHttpPostIn">
>     <wsdl:part name="xml" type="s:string"/>
>   </wsdl:message>
>   <wsdl:message name="sendNCRHttpPostOut">
>     <wsdl:part name="Body" element="s0:int"/>
>   </wsdl:message>
>   <wsdl:portType name="EnvioGuiaSoap">
>     <wsdl:operation name="sendNCR">
>       <wsdl:input message="s0:sendNCRSoapIn"/>
>       <wsdl:output message="s0:sendNCRSoapOut"/>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:portType name="EnvioGuiaHttpGet">
>     <wsdl:operation name="sendNCR">
>       <wsdl:input message="s0:sendNCRHttpGetIn"/>
>       <wsdl:output message="s0:sendNCRHttpGetOut"/>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:portType name="EnvioGuiaHttpPost">
>     <wsdl:operation name="sendNCR">
>       <wsdl:input message="s0:sendNCRHttpPostIn"/>
>       <wsdl:output message="s0:sendNCRHttpPostOut"/>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="EnvioGuiaSoap" type="s0:EnvioGuiaSoap">
>     <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
> style="document"/>
>     <wsdl:operation name="sendNCR">
>       <soap:operation soapAction="http://www.openuri.org/sendNCR"
> style="document"/>
>       <wsdl:input>
>         <soap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output>
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:binding name="EnvioGuiaHttpGet" type="s0:EnvioGuiaHttpGet">
>     <http:binding verb="GET"/>
>     <wsdl:operation name="sendNCR">
>       <http:operation location="/sendNCR"/>
>       <wsdl:input>
>         <http:urlEncoded/>
>       </wsdl:input>
>       <wsdl:output>
>         <mime:mimeXml part="Body"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:binding name="EnvioGuiaHttpPost" type="s0:EnvioGuiaHttpPost">
>     <http:binding verb="POST"/>
>     <wsdl:operation name="sendNCR">
>       <http:operation location="/sendNCR"/>
>       <wsdl:input>
>         <mime:content type="application/x-www-form-urlencoded"/>
>       </wsdl:input>
>       <wsdl:output>
>         <mime:mimeXml part="Body"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="EnvioGuia">
>     <wsdl:port name="EnvioGuiaSoap" binding="s0:EnvioGuiaSoap">
>       <soap:address location="http://joule:8041/DteEnLinea/ws/EnvioGuia.jws
> "/>
>     </wsdl:port>
>     <wsdl:port name="EnvioGuiaHttpGet" binding="s0:EnvioGuiaHttpGet">
>       <http:address location="http://joule:8041/DteEnLinea/ws/EnvioGuia.jws
> "/>
>     </wsdl:port>
>     <wsdl:port name="EnvioGuiaHttpPost" binding="s0:EnvioGuiaHttpPost">
>       <http:address location="http://joule:8041/DteEnLinea/ws/EnvioGuia.jws
> "/>
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
>

-- 
Enviado desde mi dispositivo móvil

Diego I. Hidalgo D.



More information about the Python-list mailing list