1

I would like OrgA to consume the Partner WSDL and connect to OrgB. OrgA should then be able to create a list of records (i.e. Cases) in OrgB. I read some of the related posts including this one but the proposed solution of using REST is problematic because OrgB doesn't have the REST Composite Tree Pilot enabled so I'd have to make multiple callouts to build my list of cases. I also read a suggestion the FuseIT WSDL2Apex Tool might be helpful, in resolving the Salesforce.com AnyType DataType issue during the class generation process, and I was wondering if anyone might have seen instructions for its usage.

Having generated the stubs in OrgA (using the FuseIT Apex generator service) I attempted to do a describeGlobal() call after successful Login() and got the following error message:

System.CalloutException: Web service callout failed: Unexpected element. Parser was expecting element 'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found 'http://www.w3.org/1999/xhtml:html'

The code snip for performing the DescribeGlobal call is listed below (the above error is thrown on the last line of code below:)

    sp.endpoint_x = instance_url;
    partnerSessionHeader.sessionId = loginResult.sessionId;
    // The Web services have a maximum timeout of 2 minutes. The timeout value
    // is in milliseconds.
    sp.timeout_x = 120000;
    sp.SessionHeader = partnerSessionHeader;
    // Get the DescribeGlobal mapping.
    describeGlobalResult = sp.DescribeGlobal();
3
  • You could easily build a REST endpoint to return a JSON Object containing a list of cases matching an input query.....Much easier than trying to do what you are wanting than manipulating the Enterprise WSDL to get it to work. Or look into Salesforce to Salesforce - developer.salesforce.com/page/…
    – Eric
    Sep 16, 2015 at 0:30
  • Thanks for the suggestion of Salesforce to Salesforce Eric. Due to certain operational requirements we are not allowed to use that feature. We're working with the Partner WSDL and we need to perform a create of a list of Cases (not query.) With that clarification if you believe building a REST endpoint is still helpful I'd be open to hearing additional details...
    – jangiz
    Sep 16, 2015 at 15:54
  • What do you define as the difference between a "list of cases" and a query returning a list of cases?
    – Eric
    Sep 16, 2015 at 16:03

1 Answer 1

1

As you found, the AnyType data type can't be handled by WebServiceCallout.invoke. If you want to stay with the SOAP web services, you can use the FuseIT Wsdl2Apex to generate the HttpCallouts for the required methods. Use the drop down to the right on the screen where you select which methods to generate for.

This will create a new apex method with an http suffix that builds raw POST requests and parses the response.

3
  • Thanks Dan. I used the FuseIT web service to generate the Classes... Do I need to download the client to get access to the drop down you're referencing in your response?
    – jangiz
    Sep 16, 2015 at 15:58
  • Hello Dan, We went through the generated Apex and attempted to create a case record but we needed to pass "sobjectPartnerSoapSforceCom.sObject_x[]" to the "create_Http()" method. Do you have instructions on how to build the sObject_x with field values? (I.e. Description = 'Test Description' & Subject = 'Test Subject')... the DescribeGlobal continues to return the callout exception above.
    – jangiz
    Sep 17, 2015 at 17:49
  • 1
    Well - it turns out I was sending my request to the hostname of the SOAP endpoint (due to some REST calls which we needed to make) instead of the serverURL returned in the SOAP LoginResult. Pointing to the serverURL resolved the error with the CalloutException. I'm building the SOAP message manually which is no fun but it's working. The FuseIT tool was helpful... and we think instructions would help adoption :^) Thanks for the assist.
    – jangiz
    Sep 18, 2015 at 20:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .