• KjWhal
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

Hi,

 

I've created a small .NET app that connects to SalesForce.com through its web service API (19.0).

 

Following some request, SalesForce returns an invalid XML response, i.e. it contains an empty namespace declaration (xmlns:ns1=""):

 

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:partner.soap.sforce.com" xmlns:ns1="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="urn:sobject.partner.soap.sforce.com"><soapenv:Header><ns1:DebuggingInfo><ns1:debugLog></ns1:debugLog></ns1:DebuggingInfo></soapenv:Header><soapenv:Body><queryResponse><result xsi:type="QueryResult"><done>true</done><queryLocator xsi:nil="true"/><records xsi:type="sf:sObject"><sf:type>Case</sf:type><sf:Id xsi:nil="true"/><sf:Type xsi:nil="true"/></records><size>1</size></result></queryResponse></soapenv:Body></soapenv:Envelope>

 

And the request was:

 

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header><QueryOptions xmlns="urn:partner.soap.sforce.com"><batchSize>200</batchSize></QueryOptions><SessionHeader xmlns="urn:partner.soap.sforce.com"><sessionId>{SOME_ID}</sessionId></SessionHeader></soap:Header><soap:Body><query xmlns="urn:partner.soap.sforce.com"><queryString>select Type from Case where Id='{SOME_ID}'</queryString></query></soap:Body></soap:Envelope>

 

Where {SOME_ID} is a valid session ID and case ID, respectively.

 

The problem is that when SoapHttpClientProtocol (web reference) parses the response, its internal XmlReader throws an XmlException: "Response is not well-formed XML. ---> System.Xml.XmlException: Invalid namespace declaration. Line 1, position 161."

 

Now my questions are:

 

1- Why does SalesForce return this response (instead of returning the expected query result)?

2- Why does SalesForce return an empty namespace (xmlns:ns1="")? As I explained above, this breaks the XmlReader class (MoveToContent method).

 

Thanks for your help!

 

MGuy

  • September 13, 2011
  • Like
  • 0

I have an old application that uses Web-To-Lead. I'm updating it to use the REST API. We have a bunch of assignment rules set up for Leads. When we create a lead through Web-To-Lead, the Lead is assigned according to our assignment rules. However, when we create a Lead through the REST API, the assignment rules are completely ignored, and the Lead is assigned to the account whose credentials we used to authenticate through OAuth. This has slowed our sales team to a crawl, because now they have to assign leads by hand.

 

Any ideas how to fix this?