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

migration from enterprise.wsdl to partner.wsdl



 Heading may seem misleading, I am not actually migrating the code. I have used following implementation successfully in other webservices (Zuora). 


-> SObject[] sObjArray = queryResult.getRecords(); 

     for(SObject sObj : sObjArray){

 Account acc = [Account] sObj;

 String fName = acc.getFirstName();



Later on, I came to know that the Objects like Account, Contact, etc are available only on enterprise.wsdl, but we are using partner.wsdl. 


Can someone please help me with the relevant implementation of the above using partner.wsdl, and Axis2?


Help please.. 


How should I modify the above code snippet so that it works with the code generated using partner.wsdl




It depends on what toolkit you're using.  If you're using WSC, you'll have a method on the SObject class whose signature looks like: getField(String).  So in the enterprise API you'd have:




While in the partner API you'd have:









Thanks for the reply, dkdor. 


The partner API has no 'Contact' object at all. As per my understanding, every time you get the generic SObject, and somehow need to retrieve the information. 


Also, there is no getField() / or similar method in SObject. 


There is one method - getgetExtraElement(), which returns the OMElements (Axis2) / MessageElement (Axis). 


Can we use that?


If you're using Axis, you can use the get_any() / set_any() methods to deal with fields on the generic sobject.  Try those.


You could also just switch to using WSC as your SOAP toolkit.  It's a bit easier to use than Axis 1, and certainly easier than Axis 2.



Thanks dkador. 


Yep, Axis is simpler than Axis2. However, in our application other web services are implemented using Axis2. I need to use Axis2 in any case to maintain consistency.


You'll need to find out how it maps xsd:any to java, also, axis2 support different binding/programing models (e.g. adb, xml beans etc), so you'll need to find this out for the particular binding framework you're using within axis2.


good luck!