0

Sorry if this is a noob question. I'm new to developing for SalesForce and the Java SOAP API and am trying to debug a weird problem in an existing Java app.

I'm getting this exception when invoking describeSObjects():

com.sforce.ws.ConnectionException: Unexpected element. Parser was expecting element 'urn:partner.soap.sforce.com:compactLayoutable' but found 'urn:partner.soap.sforce.com:createable'

What's weird is that I only get this when running in the app, inside Tomcat. I created a test class to invoke the exact same code outside the application and it works perfectly. This is happening for the 'Account' object, but I'm not even sure it has anything to do with the object type. Other devs running the same application code are not seeing the error either, and I'm kind of baffled as to what's going on.

I guess more generally, what I'd like to know, is there some way to turn on some kind of debug logging and see what the SOAP API is trying to send back or some other way of tracing down the problem? I tried hitting the endpoint in my browser while logged into the same SalesForce account, but it said "GET" not supported. I'm used to debugging REST API's, not SOAP API's, so I guess I'm a little lost here.

  • 1
    There are a couple of suggestions in stackoverflow.com/questions/6680804/… though you are not specific about what Java SOAP tools you are using... The difference inside and outside Tomcat is presumably the version of the JDK and/or other XML related JARs. You can route through a proxy (I've used tcpmon but that is a little dated now) to monitor the request and response XML. – Keith C May 29 '14 at 19:38
2

I still haven't figured out my actual problem, but I did find what I was looking for.

Say your PartnerConnection object is 'connect'. Then:

connect.getConfig().setTraceMessage(true);
connect.getConfig().setPrettyPrintXml(true); // to make it readable...

Will cause it to print the contents of the SOAP requests and responses to stdout so you can at least see what's going back and forth. Hopefully this will help someone!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.