I have two salesforce orgs and I am trying to do SOAP integration between these two via WSDL import.
From the first Salesforce Org (let us say S1)
I did the following
a) Clicked on the "WSDL" of my webservice class.
b) When I clicked on the hyperlink though, it took me to a web page like shown below.
c) So I saved the webpage as ".wsdl" shown below.
d) In the second salesforce org (let us say S2) i did the following.
Clicked on "Generate from WSDL"
e) It asked me to choose the file and here I chose the "AccountAdd.wsdl" file
f) It gave me a success response for parsing as shown below.
g) But when I try to generate the apex code it gave me the following error.
I have also attached the class that I tried for this activity.
global class AccountAdd
{
webservice static Account AddingNewAccount(Account a)
{
//custom logic
return null;
}
}
This is just a placeholder class without adding actual methods which I will add later.
For now I just wanted to try an import/export of WSDL.
Also I have added the second salesforce org (S2) in the Remote Site Settings on S1 as shown below.
Question :
Can someone please let know as to why I am getting error in S2 (Step g)when trying to generated apex code of the AccountAdd.wsdl ?
Best Answer
The native version of Wsdl2Apex doesn't support
{http://www.w3.org/2001/XMLSchema}anyType
because WebserviceCallout.invoke can't.By having Account in the methods Arguments and return type Salesforce is going to generate xsd:complexType's for all sorts of supporting types. A number of these will have elements like:
Also, generally speaking, wsdl2apex has great difficulty handling sObject types in a WSDL due to the use of
<xsd:extension base="tns:sObject">
. It won't generate the required base class fields and WebserviceCallout.invoke doesn't support inheritance.Since it is now working for you I suspect you have altered the definition of the webservice method so that it no longer takes/returns an Account object.
If that isn't the case, you might like to try the FuseIT SFDC Explorer (Disclosure: The is my current employer). It has an alternative version of Wsdl2Apex that can handle several of these problems.
anyType
is still problematic, but you may no care about the types that actually use it.If you are really keen, there is also the open source version of wsdl2apex, which you code modify as required.