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
abhishek_pandey1989@yahoo.comabhishek_pandey1989@yahoo.com 

Web service execution error

I drew a small webservice out of my dev  org and consumed it into another ...It doesnt have login method so i also  drew a second enterprise type wsdl  and consumed it also into the other dev org ..So the login problem got sorted as i can see my debug log, but my method gives me null poiter dereferencing error "System.NullPointerException: Attempt to de-reference a null object  "  

 

My method goes like this and its written in future method ...

enterpriseSoapSforceCom.LoginResult lr= new enterpriseSoapSforceCom.LoginResult();
      enterpriseSoapSforceCom.Soap Esoap= new enterpriseSoapSforceCom.Soap();      
    //  try
     // {       
       lr=Esoap.login(username,password);
       //lr.serverUrl;
       //lr.sessionId;
       system.debug('lr.userId'+lr.userId);
       system.debug('lr.sessionId'+lr.sessionId);       
       system.debug('lr.userId'+lr.userId);
       //MYWebservice34.SessionHeader_element sh = new MYWebservice34.SessionHeader_element();
       //sh.sessionId=lr.sessionId;
      // String authEndPoint = Esoap.Url;
    //  }
     // catch (SoapException e)
     // {
       // Console.WriteLine('An unexpected error has occurred: ' + e.Message + '\n' + e.StackTrace);
     // }
      soapSforceComSchemasClassMywebservi.Account myass= new soapSforceComSchemasClassMywebservi.Account();
      Account a=[Select BillingCity,Name,BillingCountry,BillingPostalCode,BillingStreet,Phone,Site from Account where id=:aa Limit 1];
      //soapSforceComSchemasClassMywebservi.BillingCity=a.BillingCity;
      myass.Name=a.Name;    
      //myass.BillingCountry=a.BillingCountry;
      //myass.BillingPostalCode=a.BillingPostalCode;
      //myass.BillingStreet=a.BillingStreet;
      //myass.Phone=a.Phone;
      //myass.Site=a.Site;
      soapSforceComSchemasClassMywebservi.MyWebService  Serv=new soapSforceComSchemasClassMywebservi.MyWebService ();
      Serv.SessionHeader.sessionId=lr.sessionId;
      Serv.makeContact('Rick',myass);  //error occurs here ....

 Help needed ....

 

What could be possible reason .....

 

Code of my webservice is this ....

global class MyWebService 
{
    webService static Id makeContact(String lastName, Account a) 
    
    {
        Contact c = new Contact(lastName = 'Weissman',firstname = a.Name);
        insert c;
        return c.id;
    }
    
}

 

It simply receives a string and an account which i am sending  from the other org as given above ..

 

Thanks

abhishek_pandey1989@yahoo.comabhishek_pandey1989@yahoo.com

anyone from integration.....

vbsvbs
Abhishek - Any reason why simpler integration concepts like S2S have not been explored. This should make your life easier. HAve a look at the link below to see if it helps?
http://wiki.developerforce.com/page/An_Introduction_to_Salesforce_to_Salesforce
abhishek_pandey1989@yahoo.comabhishek_pandey1989@yahoo.com

That i am already done with , but to know integration to some differenct vertical i m doing this ...

 

http://stackoverflow.com/questions/12456222/adding-login-function-in-custom-salesforce-webservice/17922993#17922993

 

 

 

 

this guy has done this but dont know how ...I am trying the same

vbsvbs
The response is based on exposing apex classes via sites which itself is a security hazard. What prevents a bot from posting multiple spam leads into your org if you expose it that way? This will certainly be not an acceptable solution for practical deployments. I will investigate your error further and come back...
abhishek_pandey1989@yahoo.comabhishek_pandey1989@yahoo.com

Hi VBS any solution ???......If you have reached upon ,, and I really dont got your funda of exposing classes via sites, I am not doing anything regarding sites ......I hope u have got my exact problem as described above .....If any more questions and any kind of help u need i am available ....

 

Regards

Abhishek