function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pedzpedz 

Which URL? (quasi Python specific)

I am trying to use Python. I'm using ZSI as my SOAP/WSDL library. I guess my first question is, for login, what URL do I start out at? If I put "http://www.salesforce.com" like the documentation implies, ZSI is not happy because it gets back html instead of xml and I get this message:

TypeError: Response is "text/html", not "text/xml"

Plus, what I get back is not soap but just the regular front page to salesforce.com

If I let it go to the URL that is embedded in the WSDL file, then I get back this message:

ZSI.FaultException: UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService

I've tried a few alternate things -- just guesses. But, so far, I haven't found the magic URL to go to.

Can anyone help?
Park Walker (TAGL)Park Walker (TAGL)
It's a bit difficult to comment without seeing your code, but it appears that you may be missing a step in the process. Once you instantiate a new soap client using the wsdl you will need to perform a login call. The result of the login call will include the endpoint and session id that you need to use in subsequent calls. The session Id must be set in a soap header rather than the message body. You might want to take a look at the code in the PHP library (the library itself, not the examples) as a guideline in implementing your own Python library.

Park
pedzpedz
A similar post I made to the General Discussions received a reply that there is currently a bug in the www.salesforce.com server. One sugestion was to determine the server on which I was hosted on and use that server instead of the www server. The other suggestion was to move the ns1 attribute. It was appearing in the body tag.

The recommendation I received from the ZSI list was to do this:

loc = SforceService_services.SforceServiceLocator()
soap = loc.getSoap(
            nsdict={ 'ns1' : 'urn:enterprise.soap.sforce.com' }
             )

This causes the out going message to move the xmlsn:ns1 attribute up
to the envelope. Thus:

<SOAP-ENV:Envelope
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ZSI="http://www.zolera.com/schemas/ZSI/"
    xmlns:ns1="urn:enterprise.soap.sforce.com"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SOAP-ENV:Header>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <ns1:login>
      <ns1:username>pedz@easesoftware.net
      </ns1:username>
      <ns1:password>gr82bfree
      </ns1:password>
    </ns1:login>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

I hope this helps someone.