johvargas / sfdc-wsc

Automatically exported from code.google.com/p/sfdc-wsc
0 stars 0 forks source link

Error parsing describeSObject using API version 16.0 or 17.0 #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a partner connection with an endpoint such as
https://login.salesforce.com/services/Soap/u/16.0 or
https://login.salesforce.com/services/Soap/u/17.0
2.Call describeSObject 
3.

What is the expected output? What do you see instead?
A DescribeSObjectResult is expected.  An exception is seen instead:

Exception in thread "main" com.sforce.ws.ConnectionException: Unexpected
element. Parser was expecting element 'urn:partner.soap.sforce.com:field'
but found 'urn:partner.soap.sforce.com:deprecated'
    at com.sforce.ws.bind.TypeMapper.verifyTag(TypeMapper.java:379)
    at com.sforce.ws.bind.TypeMapper.verifyElement(TypeMapper.java:408)
    at
com.sforce.soap.partner.ChildRelationship.loadFields(ChildRelationship.java:150)
    at com.sforce.soap.partner.ChildRelationship.load(ChildRelationship.java:134)
    at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:619)
    at com.sforce.ws.bind.TypeMapper.readArray(TypeMapper.java:519)
    at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:497)
    at
com.sforce.soap.partner.DescribeSObjectResult.loadFields(DescribeSObjectResult.j
ava:656)
    at
com.sforce.soap.partner.DescribeSObjectResult.load(DescribeSObjectResult.java:64
3)
    at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:619)
    at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:495)
    at
com.sforce.soap.partner.DescribeSObjectResponse_element.loadFields(DescribeSObje
ctResponse_element.java:68)
    at
com.sforce.soap.partner.DescribeSObjectResponse_element.load(DescribeSObjectResp
onse_element.java:59)
    at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:619)
    at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:495)
    at com.sforce.ws.transport.SoapConnection.bind(SoapConnection.java:154)
    at com.sforce.ws.transport.SoapConnection.receive(SoapConnection.java:128)
    at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:103)
    at
com.sforce.soap.partner.PartnerConnection.describeSObject(PartnerConnection.java
:853)

What version of the product are you using? On what operating system?

Tried running with both the wsc-16_0.jar and the wsc-17_0.jar. Stack trace
above is from 17.0 jar file.

Please provide any additional information below.

This also may be a problem with the way sfdc servers are handling things.
I know that the describeSObject behavior has changed in 17.0.  I would not
expect this to effect calls using the 16.0 API though.

Looking at the SOAP traces:

For 15.0 the response looks like:

<?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="urn:partner.soap.sforce.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soapenv:Body>
        <describeSObjectResponse>
          <result>
            <activateable>false</activateable>
            <childRelationships>
              <cascadeDelete>false</cascadeDelete>
              <childSObject>Account</childSObject>
              <field>ParentId</field>
          </childRelationships>

and for 16.0 the response has additional "deprecated" related elements:

 <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="urn:partner.soap.sforce.com"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soapenv:Body>
        <describeSObjectResponse>
          <result>
            <activateable>false</activateable>
            <childRelationships>
              <cascadeDelete>false</cascadeDelete>
              <childSObject>Account</childSObject>
              <deprecated>false</deprecated>
              <deprecatedAndHidden>false</deprecatedAndHidden>
              <field>ParentId</field>
          </childRelationships>

Original issue reported on code.google.com by turntwo...@gmail.com on 17 Dec 2009 at 8:31

GoogleCodeExporter commented 8 years ago
Which version of the WSDL did you use to generate the partner.jar? Endpoint 
version
and the version of the WSDL you used should match. It seems they are not.

Original comment by manoj.ch...@gmail.com on 17 Dec 2009 at 9:24

GoogleCodeExporter commented 8 years ago
I've tested using the partner jar file and the wsc-16.0 jar file that are 
available
for download on this site.  I assume the partner.jar here was built using 16.0?

In my code when I use:

connectorConfig.setAuthEndpoint("https://login.salesforce.com/services/Soap/u/16
.0");

I get the exception described in the original post.

Using:

connectorConfig.setAuthEndpoint("https://login.salesforce.com/services/Soap/u/15
.0");

works.

It looks to me as if the sfdc server is giving a 17.0 response although I used 
a 16.0
endpoint.

Original comment by turntwo...@gmail.com on 17 Dec 2009 at 9:53

GoogleCodeExporter commented 8 years ago
See the docs. You can generate a partner.jar file for any WSDL you want to use.
Only requirement is that the partner.jar and the endpoint should be of same 
version.

Generating Stub Code from a WSDL

Run wsdlc on the WSDL you have downloaded:

    java -classpath wsc.jar com.sforce.ws.tools.wsdlc wsdl jar.file 

    * wsdl is the name of the WSDL file
    * jar.file is the name of the output jar file that wsdlc generates
    * You can include an optional argument: -Dpackage-prefix=myprefix 

Original comment by manoj.ch...@gmail.com on 17 Dec 2009 at 9:57

GoogleCodeExporter commented 8 years ago
I appreciate that I can generate my own partner.jar.  However, I am trying to
understand what is out of sync with the pre-built jar files?

Is the pre-built partner.jar for 16.0?  If not, I can see why things will fail. 
If
the answer is yes, and I use wsc-16.0.jar and I use an endpoint of
https://login.salesforce.com/services/Soap/u/16.0, why should this not work?  
As I
said, it seems to me the server is responding with the wrong version.

Original comment by turntwo...@gmail.com on 17 Dec 2009 at 10:10

GoogleCodeExporter commented 8 years ago
Since version 15.0 is working with the pre build jar file. I guess, the pre 
build
partner jar file is for version 15 WSDL.

wsc jar contains the classes for generic web services stack (like axis). 
partner jar
contains classes specific to the web service (classes like 
DescribeSObjectResponse).
These classes depends on the version of the WSDL and must match the endpoint 
version.

HTHs.

Original comment by manoj.ch...@gmail.com on 17 Dec 2009 at 11:02

GoogleCodeExporter commented 8 years ago

Original comment by manoj.ch...@gmail.com on 6 Apr 2010 at 11:06