+ Start a Discussion
Suresh RaghuramSuresh Raghuram 

test class for the Wsdl2apex class

I need help  in writing test class on the following WSDL generated apex class.
I also provided testclass that I started and where I am stuck and not able to make move.
I posted this in stackflow  too http://salesforce.stackexchange.com/questions/93522/test-class-for-the-wsdl2apex-class

@isTest
private class ContractMockCalloutTest {
testmethod static void SFDCGatewayWSDLSOAPQSPort_SearchCustomerContractTest() {
Test.startTest(); Test.setMock(WebServiceMock.class, new ContractListMockWebServiceCallout()); wwwmysiteComsfdcContract.wwwmysiteComsfdcContract stub = new wwwmysiteComsfdcContract.wwwmysiteComsfdcContract();
//Here I am stuck dont know to make a move when I refer stub.inner class it is throwing invalid type.
}
}


public class wwwmysiteComsfdcContract {
public class sfdcContractWSDLSOAPQSPort {
public String endpoint_x = 'http://sfdc2-osb-dit.us.mysite.com:80/sfdc/Contract/Services'; public Map < String, String > inputHttpHeaders_x;
public Map < String, String > outputHttpHeaders_x;
public String clientCertName_x; public String clientCert_x;
public String clientCertPasswd_x; public Integer timeout_x;
public wwwmysiteComsfdcGilHeaderdataxmlsCONTRACT.headerData_element request_header; private String request_header_hns = 'headerData=http://www.mysite.com/sfdc/GIL/HeaderDataXMLS';
private String[] ns_map_type_info = new String[] { 'http://www.mysite.com/sfdc/Contract/types', 'wwwmysiteComsfdcContractTypes', 'http://www.mysite.com/sfdc/Contract/', 'wwwmysiteComsfdcContract', 'http://www.mysite.com/sfdc/Contract/GetContractDetails/types', 'wwwmysiteComsfdcContractGetcontractdet', 'http://www.mysite.com/sfdc/GIL/HeaderDataXMLS', 'wwwmysiteComsfdcGilHeaderdataxmlsCONTRACT', 'http://www.mysite.com/sfdc/Contract/CreateMessage', 'wwwmysiteComsfdcContractCreatemessage' };
public wwwmysiteComsfdcContractTypes.SearchResultType Search_x(String Region, String ContractNumber, String ssnum, String PhoneNumber, String CreditApplicationNumber, String SerialTagNumber, String InvoiceNumber, String mysiteOrderNumber, String ContactName, String TaxIdNumber, String PONumber, String CustomerName, wwwmysiteComsfdcContractTypes.Pagination_element Pagination) {wwwmysiteComsfdcContractTypes.SearchRequestType request_x = new wwwmysiteComsfdcContractTypes.SearchRequestType(); request_x.Region = Region; request_x.ContractNumber = ContractNumber; request_x.ssnum = ssnum; request_x.PhoneNumber = PhoneNumber; request_x.CreditApplicationNumber = CreditApplicationNumber; request_x.SerialTagNumber = SerialTagNumber; request_x.InvoiceNumber = InvoiceNumber; request_x.mysiteOrderNumber = mysiteOrderNumber; request_x.ContactName = ContactName; request_x.TaxIdNumber = TaxIdNumber; request_x.PONumber = PONumber; request_x.CustomerName = CustomerName; request_x.Pagination = Pagination; wwwmysiteComsfdcContractTypes.SearchResultType response_x; Map < String, wwwmysiteComsfdcContractTypes.SearchResultType > response_map_x = new Map < String, wwwmysiteComsfdcContractTypes.SearchResultType > (); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[] { endpoint_x, 'http://www.mysite.com/sfdc/Contract/Search', 'http://www.mysite.com/sfdc/Contract/types', 'SearchRequest', 'http://www.mysite.com/sfdc/Contract/types', 'SearchResponse', 'wwwmysiteComsfdcContractTypes.SearchResultType' }); response_x = response_map_x.get('response_x'); return response_x; } public wwwmysiteComsfdcContractGetcontractdet.GetContractDetailsResponseType GetContractDetails(String Region, String ContractNumber) { wwwmysiteComsfdcContractGetcontractdet.GetContractDetailsRequestType request_x = new wwwmysiteComsfdcContractGetcontractdet.GetContractDetailsRequestType(); request_x.Region = Region; request_x.ContractNumber = ContractNumber; wwwmysiteComsfdcContractGetcontractdet.GetContractDetailsResponseType response_x; Map < String, wwwmysiteComsfdcContractGetcontractdet.GetContractDetailsResponseType > response_map_x = new Map < String, wwwmysiteComsfdcContractGetcontractdet.GetContractDetailsResponseType > (); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[] { endpoint_x, 'http://www.mysite.com/sfdc/Contract/GetContractDetails/types', 'http://www.mysite.com/sfdc/Contract/GetContractDetails/types', 'GetContractDetailsRequest', 'http://www.mysite.com/sfdc/Contract/GetContractDetails/types', 'GetContractDetailsResponse', 'wwwmysiteComsfdcContractGetcontractdet.GetContractDetailsResponseType' }); response_x = response_map_x.get('response_x'); return response_x; } public wwwmysiteComsfdcContractCreatemessage.CreateMessageResponseType CreateMessage(Boolean asynchronous, wwwmysiteComsfdcContractCreatemessage.RegionType Region, wwwmysiteComsfdcContractCreatemessage.CommentsType Comments) { wwwmysiteComsfdcContractCreatemessage.CreateMessageRequestType request_x = new wwwmysiteComsfdcContractCreatemessage.CreateMessageRequestType(); request_x.asynchronous = asynchronous; request_x.Region = Region; request_x.Comments = Comments; wwwmysiteComsfdcContractCreatemessage.CreateMessageResponseType response_x; Map < String, wwwmysiteComsfdcContractCreatemessage.CreateMessageResponseType > response_map_x = new Map < String, wwwmysiteComsfdcContractCreatemessage.CreateMessageResponseType > (); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[] { endpoint_x, 'http://www.mysite.com/sfdc/Contract/CreateMessage/action', 'http://www.mysite.com/sfdc/Contract/CreateMessage', 'CreateMessageRequest', 'http://www.mysite.com/sfdc/Contract/CreateMessage', 'CreateMessageResponse', 'wwwmysiteComsfdcContractCreatemessage.CreateMessageResponseType' }); response_x = response_map_x.get('response_x'); return response_x; } } }