• Bijay
  • NEWBIE
  • 5 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 11
    Replies

Seems like the new setMock test methods don't like when you have DML that creates your test data prior to doing your mock callouts. I.e.:

 

 

    @isTest static void TestCallout() {              
   
    //  Test data   
        Account a = new Account(Name = 'test', BillingStreet='test', BillingCountry='United States',BillingCity='test',BillingState='California');
        insert a; 
   		
        // This causes a fake response to be generated     
        Test.setMock(WebServiceMock.class, new MyCalloutClass());
        
        // Call the method that invokes a callout 
    	MyCalloutClass p = new MyCalloutClass();
        String output = p.DoCallout();
        
        // Verify that a fake result is returned     
        System.assertEquals('Mock response', output); 
    }

 

I get the error "You have uncommitted work pending. Please commit or rollback before calling out"

 

I guess the workaround is maybe to use loadData, but seems strange that this error would appear in a test method

  • October 04, 2012
  • Like
  • 0

Hi, New user here and new to SFDC Integrations. I'm trying to retrieve account information from SFDC using SOAP UI.

 

I downloaded the Generate Partner WSDL and imported to SOAP UI. I can login to our sand box using the login WS method and it gives the session Id and the server name  (https://cs13-api.salesforce.com/services/Soap/m/26.0/00DW0000000500n).

 

Next I try to search for a string using the search String WS method using following soap message.

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:partner.soap.sforce.com">
<soapenv:Header>
<urn:SessionHeader>
<urn:sessionId>00DW0000000500n!AR8AQOIbIuFfbAEkjoBBS.mYRhoHsWsHxnwdBw1AeqrYo.9JgegYXp1WEIe9hcgx0F3gm5Fw5phQeEwLnr.PHoBgIk7dkJ0d</urn:sessionId>
</urn:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<urn:search>
<urn:searchString>Jay</urn:searchString>
</urn:search>
</soapenv:Body>
</soapenv:Envelope>

 

but it returns me following error.

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>No operation available for request {urn:partner.soap.sforce.com}search</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

 

Not sure what am I doing wrong. Any help is greatly apriciated.

Jay.

 

Is it possible to implement  a functionality like Copy Billing Address to Shipping Address link (which is avilable in account object Address Information pageblock )  in my custom object.

Hi, I have a WSDL generated Apex class which i am using to perform apex callouts. I did not realize it requires a test class When i am trying to deploy my code to production my code percentage was screwed due to this WSDL Apex class which is huge. It has code which is out of my understanding as it is automatically generated by salesfroce. How would i able to write the test class, is there a way to by pass this. Any suggestions would be greatly appreciative. Thank you,

I can't open tab or subtab for Hyperlink in formula field.

formula can do this.

 

HYPERLINK(Id,'Mr. ' &  FirstName & ' ' &  LastName, '_parent') 

 

Thank you so much.

  • July 20, 2011
  • Like
  • 0

When you build page layouts in SF, you can create a new Section, and one of the properties is "Tab-key Order", options are "Left-Right" or "Top-Down".

 

How can I create the same effect in Visual Force?

 

The pageBlockSection has the "columns" attrubute, but not the order direction.

 

Then I looked at the inputFields to see if I can change their index, but there is no easily exposed attribute. 

 

This seems like an oversight.  I figured that I could create similiar layouts/flow with VisualForce.

 

Am I missing someplace?

 

Thanks,

Steve 

Hi,
 
I am trying to integrate my application with some 3rd party application using their Web Service. I have created 2 different APEX classes that manipulate the input and at the end call the webservice.
 
When i write test methods to test these classes i get "Methods defined as TestMethod do not support Web service callouts, test skipped".
 
Is there any way to test the methods in these classes so that i can get a code coverage of 75% and move it to production instance?
 
[GM]
  • April 23, 2008
  • Like
  • 0