Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

com.sforce.ws.ConnectionException: Unexpected element #35

Closed
earlofrose opened this issue Oct 17, 2013 · 14 comments
Closed

com.sforce.ws.ConnectionException: Unexpected element #35

earlofrose opened this issue Oct 17, 2013 · 14 comments

Comments

@earlofrose
Copy link

Using the WSC#29, we receive the following error when trying to call the DescribeSObjectResult ds = ecn.describeSObject(sfObject); and a similar error when trying to call DescribeLayoutResult layout = ecn.describeLayout(sfObject, recTypeIds); depending on whether we use the v25 or v29 endpoint. We were able to work around this issue using the lax-minoccurs-checking JVM switch. It appears that elements that are not required (not being sent in responses from salesforce) are mistakenly being marked as minOccurs = 1, either through it not being specified or being directly marked as minOccurs = 1.

Exception details:
com.sforce.ws.ConnectionException: Unexpected element. Parser was expecting element 'urn:enterprise.soap.sforce.com:compactLayoutable' but found 'urn:enterprise.soap.sforce.com:createable'
at com.sforce.ws.bind.TypeMapper.verifyTag(TypeMapper.java:387)
at com.sforce.ws.bind.TypeMapper.verifyElement(TypeMapper.java:416)
at com.sforce.soap.enterprise.DescribeSObjectResult.loadFields(DescribeSObjectResult.java:803)
at com.sforce.soap.enterprise.DescribeSObjectResult.load(DescribeSObjectResult.java:787)
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:629)
at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:505)
at com.sforce.soap.enterprise.DescribeSObjectResponse_element.loadFields(DescribeSObjectResponse_element.java:67)
at com.sforce.soap.enterprise.DescribeSObjectResponse_element.load(DescribeSObjectResponse_element.java:58)
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:629)
at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:505)
at com.sforce.ws.transport.SoapConnection.bind(SoapConnection.java:172)
at com.sforce.ws.transport.SoapConnection.receive(SoapConnection.java:146)
at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:110)
at com.sforce.soap.enterprise.EnterpriseConnection.describeSObject(EnterpriseConnection.java:547)
at org.stjude.crm.EventProxy.listSFPickListItems(EventProxy.java:982)
at org.stjude.crm.EventProxy.listSuffixes(EventProxy.java:3686)
at org.stjude.events.ui.controllers.AbstractControllerBase.getSuffixes(AbstractControllerBase.java:257)

@sfell
Copy link

sfell commented Oct 17, 2013

You have to use the API endpoint version# that matches the WSDL you used,
you can't mix'n'match.

On Thu, Oct 17, 2013 at 12:12 PM, earlofrose notifications@github.comwrote:

Using the WSC#29, we receive the following error when trying to call the
DescribeSObjectResult ds = ecn.describeSObject(sfObject); and a similar
error when trying to call DescribeLayoutResult layout =
ecn.describeLayout(sfObject, recTypeIds); depending on whether we use the
v25 or v29 endpoint. We were able to work around this issue using the
lax-minoccurs-checking JVM switch. It appears that elements that are not
required (not being sent in responses from salesforce) are mistakenly being
marked as minOccurs = 1, either through it not being specified or being
directly marked as minOccurs = 1.

Exception details:
com.sforce.ws.ConnectionException: Unexpected element. Parser was
expecting element 'urn:enterprise.soap.sforce.com:compactLayoutable' but
found 'urn:enterprise.soap.sforce.com:createable'
at com.sforce.ws.bind.TypeMapper.verifyTag(TypeMapper.java:387)
at com.sforce.ws.bind.TypeMapper.verifyElement(TypeMapper.java:416)
at
com.sforce.soap.enterprise.DescribeSObjectResult.loadFields(DescribeSObjectResult.java:803)
at
com.sforce.soap.enterprise.DescribeSObjectResult.load(DescribeSObjectResult.java:787)
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:629)
at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:505)
at
com.sforce.soap.enterprise.DescribeSObjectResponse_element.loadFields(DescribeSObjectResponse_element.java:67)
at
com.sforce.soap.enterprise.DescribeSObjectResponse_element.load(DescribeSObjectResponse_element.java:58)
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:629)
at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:505)
at com.sforce.ws.transport.SoapConnection.bind(SoapConnection.java:172)
at com.sforce.ws.transport.SoapConnection.receive(SoapConnection.java:146)
at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:110)
at
com.sforce.soap.enterprise.EnterpriseConnection.describeSObject(EnterpriseConnection.java:547)
at org.stjude.crm.EventProxy.listSFPickListItems(EventProxy.java:982)
at org.stjude.crm.EventProxy.listSuffixes(EventProxy.java:3686)
at
org.stjude.events.ui.controllers.AbstractControllerBase.getSuffixes(AbstractControllerBase.java:257)


Reply to this email directly or view it on GitHubhttps://github.com//issues/35
.

@earlofrose
Copy link
Author

Thanks for commenting so quickly!

We were only mixing and matching for discovery and testing. Our most recent builds (which include this failure) are failing on DescribeLayoutResult layout = ecn.describeLayout(sfObject, recTypeIds). This was a v29 wsdl, v29 endpoint and used the wsc#29 to build the client.

Thanks,
Josh

@earlofrose
Copy link
Author

Also, I believe this is a problem with the WSDL generation on salesforce.com's side. It's marking things as required (minOccurs = 1 or no minOccurs set, which defaults it to 1 in WSC) that are not being returned in their responses.

@superfell
Copy link

Can you double check that you're really using the v29 endpoint, as from my quick testing so far with describeSObject, i haven't seen it not return compactLayoutable yet.

IIRC, WSC has an option to do wire logging, which might be helpful.

@superfell
Copy link

and also which specific sobject you're seeing this with.

@earlofrose
Copy link
Author

describeSObject works with v29. describeLayout is what fails with v29. Here's the exception, relevant portion of the wsdl and the a piece of the response showing the lack of iconURL.

EXCEPTION
Exception in thread "main" com.sforce.ws.ConnectionException: Unexpected element. Parser was expecting element 'urn:enterprise.soap.sforce.com:iconUrl' but found 'urn:enterprise.soap.sforce.com:label'
at com.sforce.ws.bind.TypeMapper.verifyTag(TypeMapper.java:387)
at com.sforce.ws.bind.TypeMapper.verifyElement(TypeMapper.java:416)
at com.sforce.soap.enterprise.DescribeQuickActionListItemResult.loadFields(DescribeQuickActionListItemResult.java:212)
at com.sforce.soap.enterprise.DescribeQuickActionListItemResult.load(DescribeQuickActionListItemResult.java:201)
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:629)
at com.sforce.ws.bind.TypeMapper.readArray(TypeMapper.java:529)
at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:507)
at com.sforce.soap.enterprise.DescribeQuickActionListResult.loadFields(DescribeQuickActionListResult.java:62)
at com.sforce.soap.enterprise.DescribeQuickActionListResult.load(DescribeQuickActionListResult.java:54)
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:629)
at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:505)
at com.sforce.soap.enterprise.DescribeLayout.loadFields(DescribeLayout.java:229)
at com.sforce.soap.enterprise.DescribeLayout.load(DescribeLayout.java:201)
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:629)
at com.sforce.ws.bind.TypeMapper.readArray(TypeMapper.java:529)
at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:507)
at com.sforce.soap.enterprise.DescribeLayoutResult.loadFields(DescribeLayoutResult.java:108)
at com.sforce.soap.enterprise.DescribeLayoutResult.load(DescribeLayoutResult.java:100)
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:629)
at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:505)
at com.sforce.soap.enterprise.DescribeLayoutResponse_element.loadFields(DescribeLayoutResponse_element.java:62)
at com.sforce.soap.enterprise.DescribeLayoutResponse_element.load(DescribeLayoutResponse_element.java:54)
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:629)
at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:505)
at com.sforce.ws.transport.SoapConnection.bind(SoapConnection.java:207)
at com.sforce.ws.transport.SoapConnection.receive(SoapConnection.java:181)
at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:99)
at com.sforce.soap.enterprise.EnterpriseConnection.describeLayout(EnterpriseConnection.java:1051)
at org.stjude.crm.Main.main(Main.java:176)

RESPONSE



Post

FeedItem.TextPost

Post



File

FeedItem.ContentPost

Post

WSDL




@earlofrose
Copy link
Author

Here's the WSDL and RESPONSE.... markup

WSDL:
<complexType name="DescribeQuickActionListResult">
<sequence>
<element name="quickActionListItems" type="tns:DescribeQuickActionListItemResult" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>

<complexType name="DescribeQuickActionListItemResult">
<sequence>
<element name="colors" type="tns:DescribeColor" minOccurs="0" maxOccurs="unbounded"/>
<element name="iconUrl" type="xsd:string" nillable="true"/>
<element name="icons" type="tns:DescribeIcon" minOccurs="0" maxOccurs="unbounded"/>
<element name="label" type="xsd:string"/>
<element name="miniIconUrl" type="xsd:string" />
<element name="quickActionName" type="xsd:string" />
<element name="targetSobjectType" type="xsd:string" nillable="true"/>
<element name="type" type="xsd:string"/>
</sequence>
</complexType>

RESPONSE:
<quickActionList>
<quickActionListItems>
<label>
Post</label>
<quickActionName>
FeedItem.TextPost</quickActionName>
<type>
Post</type>
</quickActionListItems>
<quickActionListItems>
<label>
File</label>
<quickActionName>
FeedItem.ContentPost</quickActionName>
<type>
Post</type>
</quickActionListItems>

@superfell
Copy link

Thanks, yeah, I'm seeing the same thing.

@jefflai
Copy link
Contributor

jefflai commented Oct 17, 2013

I'll follow up with the salesforce team that owns the DescribeQuickAction
feature.

On Thu, Oct 17, 2013 at 2:52 PM, Simon Fell notifications@github.comwrote:

Thanks, yeah, I'm seeing the same thing.


Reply to this email directly or view it on GitHubhttps://github.com//issues/35#issuecomment-26556276
.

@earlofrose
Copy link
Author

Fantastic! Thanks, guys.

Sent from my iPhone

On Oct 17, 2013, at 5:26 PM, "Jeff Lai" <notifications@github.commailto:notifications@github.com> wrote:

I'll follow up with the salesforce team that owns the DescribeQuickAction
feature.

On Thu, Oct 17, 2013 at 2:52 PM, Simon Fell <notifications@github.commailto:notifications@github.com>wrote:

Thanks, yeah, I'm seeing the same thing.


Reply to this email directly or view it on GitHubhttps://github.com//issues/35#issuecomment-26556276
.


Reply to this email directly or view it on GitHubhttps://github.com//issues/35#issuecomment-26558460.

@dwfallin
Copy link

hey jefflai - can you give any kind of update on this? (has someone accepted it as an issue, maybe started a bug for tracking?)
thanks!

@michaelbini
Copy link

I had the same problem and I fix it by updating the authEndPoint
ConnectorConfig config = new ConnectorConfig();
config.setAuthEndpoint("https://login.salesforce.com/services/Soap/c/29.0/");

hope this will help.

@dwfallin
Copy link

thanks for the suggestion. so, you updated the endpoint by adding a '/'? not sure how that would affect the meta-data thats being returned from the calls? i tried it anyway with same results.

@jefflai
Copy link
Contributor

jefflai commented Nov 6, 2013

@earlofrose @dwfallin a patch to fix this issue on the server side was deployed. Please reopen if you are still experiencing this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants