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

XML-Schema namespace-issue in ? (LOCAL vs. QUALIFIED)" xmlns:soap
enc="" xmlns:tns="salesforce" xmlns:typ
es="salesforce/encodedTypes" xmlns:xsi="
e" xmlns:xsd="">
    00130000000aiGh  <== NOTE: correct, when used in browser
    00130000000aLw8  <== NOTE: correct, when used in browser iterating over child-elements found RETURN-element iterating over RETURN-element's children
java.lang.Exception: forcing, to find all callers
        at test.api.SForceUtil.getObject(
        at test.api.SForce.main(
element-name: valueArray
attrib-name: xsi:type
attrib-val: tns:array
SForceUtil.getObject: type: null
SForceUtil.getObject: typeName: com.sun.xml.messaging.saaj.soap.dom4j.NameImpl@2
b8e6266 [name: xsi:type namespace: "org.dom4j.Namespace@babe [Namespace: prefix
 mapped to URI ""]"]
SForceUtil.getObject: about to return: null
        at test.api.SForce.main(




    public SForce(String version, String url) throws MalformedURLException, SOAPException {
        SOAPMessage msg = createMessage();
        SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
        this.typeName = env.createName(TYPE_LOCAL);
        qtypeName = env.createName(TYPE_QUALIFIED);  <== NOTE: added (stored staticly)

        this.urlObj = new URL(url);
        this.version = version;



Iterator iter = response.getMimeHeaders().getAllHeaders();

while(iter.hasNext()) { // this did show "Content-Type: text/xml"; docs say should be "text/xylem" ?
    MimeHeader h = (MimeHeader);
    System.out.println(h.getName() + ": " + h.getValue());
            SOAPEnvelope respenv = response.getSOAPPart().getEnvelope();         
            respbody = respenv.getBody();

            // The processing below is typical for the responses returned by the SOAP API, Use SForceUtil to create on object to hold response
            Object result = null;
            for (Iterator i = respbody.getChildElements(); i.hasNext() {
System.out.println(" iterating over child-elements");
                SOAPElement element = (SOAPElement);
                if (element.getElementName().getLocalName().equals(RETURN)) {
System.out.println(" found RETURN-element");
                    for (Iterator j = element.getChildElements(); j.hasNext() {
System.out.println(" iterating over RETURN-element's children");
                        SOAPElement next = (SOAPElement);
                        //result = SForceUtil.getObject(next, this.typeName);
                        result = SForceUtil.getObject(next, SForce.qtypeName);
            // search returns a List
            System.out.println("SEARCH RESULTS");
            for (Iterator i = ((List)result).iterator(); i.hasNext() {
                System.out.println("Account ID: " + (String);



    // Utility function to traverse SOAP response
    public static Object getObject(SOAPElement element, Name typeName) {
try {  // I did this, to find out who was calling this method first; turns out it was the "describe"-method; seems inconsequential for this problem -- maybe not?
    throw new Exception("forcing, to find all callers");
} catch(Exception e) {
        Object obj = null;
System.out.println("element-name: " + element.getElementName().getQualifiedName());
        String type = element.getAttributeValue(typeName);
Iterator iter = element.getAllAttributes();
while(iter.hasNext()) {
    Name name = (Name);
    System.out.println("attrib-name: " + name.getQualifiedName());
    System.out.println("attrib-val: " + element.getAttributeValue(name));

System.out.println("SForceUtil.getObject: type: " + type);
System.out.println("SForceUtil.getObject: typeName: " + typeName.toString());
        if (type != null) {
            if (type.equals(INTEGER)) {
                obj = new Integer(element.getValue());
            } else if (type.equals(BOOLEAN)) {
                obj =  Boolean.valueOf(element.getValue().equals("true"));
            } else if (type.equals(MAP)) {
                obj = getMap(element, typeName);
            } else if (type.equals(ARRAY)) {
System.out.println("SForceUtil.getObject: type=ARRAY");
                obj = getList(element, typeName);
            } else {
                obj = element.getValue();
System.out.println("SForceUtil.getObject: about to return: " + obj);       

        return obj;

(I've tried using "pre"-tags and also html-commenting to get the XML to be quoted.  I don't have time to work out how to do a transformation of the less-than and greater-than chars to charater-entities.  Perhaps I can provide such at some later time, if necessary -- perhaps by email-attachment.  Suffice it to say that the Java-code, up to a point, seems to be "seeing", in terms of element-names and attribute-names, the XML that the salesforce server is sending, but then there's some problem apparently having to do with the difference between local-names and qualified-names).





    Where did you get  Is it part of client of sforce using the Apache Soap 2.2 APIs.