<div dir="ltr">That worked perfectly, thanks so much for your help.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 28, 2015 at 10:43 AM, Mariano Reingart <span dir="ltr"><<a href="mailto:reingart@gmail.com" target="_blank">reingart@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>You can try the following:</div><div><br></div><div>XML = """</div><div><v2:GetOrders xmlns:v2="%s"></div><span class=""><div>  <v2:request></div><div>    <v2:BusinessDate>2015-04-24T00:00:00</v2:BusinessDate></div><div>  </v2:request></div></span><div></v2:GetOrders></div><div>""" % namespaceValue</div><div>bd = SimpleXMLElement(XML)</div><span class=""><div><br></div><div>response = client.call("GetOrders", bd)<br></div><div><br></div></span><div>Best regards,</div></div><div class="gmail_extra"><span class=""><br clear="all"><div><div>Mariano Reingart<br><a href="http://www.sistemasagiles.com.ar" target="_blank">http://www.sistemasagiles.com.ar</a><br><a href="http://reingart.blogspot.com" target="_blank">http://reingart.blogspot.com</a></div></div>
<br></span><div><div class="h5"><div class="gmail_quote">On Tue, Apr 28, 2015 at 10:42 AM, Tim Callaghan <span dir="ltr"><<a href="mailto:tmcallaghan@gmail.com" target="_blank">tmcallaghan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Ultimately, this is the Envelope I need to generate for my first integration. From there I'll be doing substantially more complicated ones (payload wise) with respect to the amount of XML I need to generate inside the Body.<br><br></div>It's probably just a few well constructed lines of code, I can't figure them out.<br><div><br><soapenv:Envelope xmlns:soapenv="<a href="http://schemas.xmlsoap.org/soap/envelope/" target="_blank">http://schemas.xmlsoap.org/soap/envelope/</a>" xmlns:v2="<a href="http://www.no-web-site.com/webservices/sales/v2" target="_blank">http://www.no-web-site.com/webservices/sales/v2</a>" xmlns:sys="<a href="http://schemas.datacontract.org/2004/07/System" target="_blank">http://schemas.datacontract.org/2004/07/System</a>"><br>   <soapenv:Header/><br>   <soapenv:Body><br>      <v2:GetOrders><br>         <v2:request xmlns:v2="<a href="http://www.no-web-site.com/webservices/sales/v2" target="_blank">http://www.no-web-site.com/webservices/sales/v2</a>"><span><br>            <v2:BusinessDate>2015-04-24T00:00:00</v2:BusinessDate><br>         </v2:request><br></span>      </v2:GetOrders><br>   </soapenv:Body><br></soapenv:Envelope><br><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 28, 2015 at 8:21 AM, Tim Callaghan <span dir="ltr"><<a href="mailto:tmcallaghan@gmail.com" target="_blank">tmcallaghan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I guess my question is really about how I do anything interesting with the call method. At the moment it doesn't seem obvious how I create any non-trivial XML to pass into it, other than simple key/value pairs. I'm calling an API where I need to pass complex XML with nested structures.<br><br></div><div>If you can point me to an example I'd really appreciate it.<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div><br></div>-Tim<br><br></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 28, 2015 at 7:50 AM, Tim Callaghan <span dir="ltr"><<a href="mailto:tmcallaghan@gmail.com" target="_blank">tmcallaghan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>I've already defined the v2 ns and namespace in my SoapClient() initialization, why would I want/need to define it again?<br><br>client = SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders)<br><br></div>GetOrders gets the v2 ns applied to it automatically, is there a way to have that happen to all elements in SimpleXMLElement automatically?<br><br></div><div>Thanks.<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div><br></div>-Tim<br><br></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 27, 2015 at 10:13 PM, Mariano Reingart <span dir="ltr"><<a href="mailto:reingart@gmail.com" target="_blank">reingart@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>You'll need to specify the namespace URI so the python parser can detect it (in the same node or in the xml root): </div><div><br></div><div>bd = SimpleXMLElement("""<v2:BusinessDate xmlns:v2="%s">2015-04-24T00:00:00</v2:BusinessDate>""" % namespaceValue,</div><div>                      )</div><div><br></div><div>Regards</div><div class="gmail_extra"><span><br clear="all"><div><div>Mariano Reingart<br><a href="http://www.sistemasagiles.com.ar" target="_blank">http://www.sistemasagiles.com.ar</a><br><a href="http://reingart.blogspot.com" target="_blank">http://reingart.blogspot.com</a></div></div>
<br></span><div><div><div class="gmail_quote">On Mon, Apr 27, 2015 at 9:48 PM, Tim Callaghan <span dir="ltr"><<a href="mailto:tmcallaghan@gmail.com" target="_blank">tmcallaghan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>That worked, so now I'm close.<br><br></div><div>However, I need a little more for this, "<v2:request><v2:BusinessDate>2015-04-24T00:00:00</v2:BusinessDate></v2:request>". I can easily add the "request" tags, but if I ask for a "v2:" prefix it gives me parsing errors.<br></div><div><br></div>I got the syntax from here, <a href="https://code.google.com/p/pysimplesoap/wiki/SoapClient#Basic_example_not_using_WSDL" target="_blank">https://code.google.com/p/pysimplesoap/wiki/SoapClient#Basic_example_not_using_WSDL</a><br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 27, 2015 at 6:22 PM, Mariano Reingart <span dir="ltr"><<a href="mailto:reingart@gmail.com" target="_blank">reingart@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div>On Mon, Apr 27, 2015 at 6:22 PM, Tim Callaghan <span dir="ltr"><<a href="mailto:tmcallaghan@gmail.com" target="_blank">tmcallaghan@gmail.com</a>></span> wrote:<br></div></div></div><div class="gmail_extra"><div class="gmail_quote"><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><span style="font-family:monospace,monospace">Here's my code. When I "print bd.as_xml()" it looks good to me, but all that ends up in my <v2:response> is </span><span style="font-family:monospace,monospace">2015-04-24T00:00:00, not <BusinessDate></span><br><span style="font-family:monospace,monospace">2015-04-24T00:00:00</BusinessDate>. Help.  -Tim<br><br><br></span></div><div><span style="font-family:monospace,monospace">-------- BEGIN CODE --------------<br></span></div><div><span style="font-family:monospace,monospace"></span><div><span style="font-family:monospace,monospace"><br>from pysimplesoap.client import SoapClient<br>from pysimplesoap.simplexml import SimpleXMLElement<br><br>soapLocation="<a href="https://api5.brinkpos.net/Sales2.svc" target="_blank">https://www.changed-for-example.com/Sales2.svc</a>"<br>soapAction="<a href="http://www.brinksoftware.com/webservices/sales/v2/ISalesWebService2/" target="_blank">http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/</a>"<br>nsValue="v2"<br>namespaceValue="<a href="http://www.brinksoftware.com/webservices/sales/v2" target="_blank">http://www.changed-for-example.com/webservices/sales/v2</a>"<br>httpHeaders = {'AccessToken':'**NOT*THE*REAL*TOKEN', 'LocationToken':'</span><span style="font-family:monospace,monospace"><span style="font-family:monospace,monospace">**NOT*THE*REAL*TOKEN</span>'}<br><br>client = SoapClient(location=soapLocation,action=soapAction,namespace=namespaceValue,ns=nsValue,trace=True,http_headers=httpHeaders)<br><br>bd = SimpleXMLElement("<BusinessDate>2015-04-24T00:00:00</BusinessDate>")<br><br>response = client.GetOrders(request=bd)<br></span><br></div></div><div><br></div></div></blockquote><div><br></div></div></div><div>Can you test the following code instead calling client.getOrders directly?</div><div> </div><div>response = client.call("GetOrders", bd)<br></div><div><br></div><div>That will detect bd as a raw simple xml object to be serialized.</div><div>That generates the following output (with BusinessDate included):</div><div><br></div><div><div>INFO:pysimplesoap.client:POST <a href="https://www.changed-for-example.com/Sales2.svc" target="_blank">https://www.changed-for-example.com/Sales2.svc</a></div><div>DEBUG:pysimplesoap.client:SOAPAction: "<a href="http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/GetOrders" target="_blank">http://www.changed-for-example.com/webservices/sales/v2/ISalesWebService2/GetOrders</a>"</div><div>Content-length: 296</div><div>Content-type: text/xml; charset="UTF-8"</div><div>AccessToken: **NOT*THE*REAL*TOKEN</div><div>LocationToken: **NOT*THE*REAL*TOKEN</div><div>DEBUG:pysimplesoap.client:<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="<a href="http://schemas.xmlsoap.org/soap/envelope/" target="_blank">http://schemas.xmlsoap.org/soap/envelope/</a>" xmlns:v2="<a href="http://www.changed-for-example.com/webservices/sales/v2" target="_blank">http://www.changed-for-example.com/webservices/sales/v2</a>"></div><div><soapenv:Header/></div><div><soapenv:Body><BusinessDate>2015-04-24T00:00:00</BusinessDate></soapenv:Body></soapenv:Envelope></div></div><div><br></div><div>BTW, from where did you get the response=raw syntax?</div><div><br></div><div>Best regards,</div><div class="gmail_extra"><br clear="all"><div><div>Mariano Reingart<br><a href="http://www.sistemasagiles.com.ar/" target="_blank">http://www.sistemasagiles.com.ar</a><br><a href="http://reingart.blogspot.com/" target="_blank">http://reingart.blogspot.com</a></div></div></div><div> </div></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>