You need to sign in to do that
Don't have an account?
ekarthik
Constructor not defined: [myservice.listValues].<Constructor>(String, String)
Hi
I am need use webservice to get some values. I generated apex class from wsdl , in that class i am getting
public class myService{
public myService.userInfo[] listValues(Long userId,String userName) {
...
}
}
I need to pass parameters and need to get some values
so i write like this
myservice.listValues myObj = new myservice.listValues('456','myName');
I got error like
Constructor not defined: [myservice.listValues].<Constructor>(String, String)
thanks
Hi karthik,
You have to use
myservice.listValues myObj = new myservice.listValues(456,'myName');
instead of
myservice.listValues myObj = new myservice.listValues('456','myName');
because first parameter of listValues is Long not a string.
Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thank You,
Hitesh Patel
SFDC Certified Developer & Administrator
My Blog:- http://mrjavascript.blogspot.in/
Thanks for your reply
I tried all the ways like
myservice.listValues myObj = new myservice.listValues(456,myName);
myservice.listValues myObj = new myservice.listValues(456,'myName');
myservice.listValues myObj = new myservice.listValues('456','myName');
The real problem is not the way we pass the parameter
say
public class myService{
public void myMethod(long x ,string s){
}
myservice.mymethod(x,'y') - it will be correct because it does not have anything like
myService.userInfo[]
before method name . for this we need to create constructor
For example look at this url
http://boards.developerforce.com/t5/forums/forumtopicprintpage/board-id/Visualforce/message-id/57297/print-single-message/false/page/1
I am unable to get like this
@ekarthik - The way you are accessing the methid is wrong. What you need is to instantiate an object of MyService and call the instance method listValues. The return type of the method is an array of MyService.UserInfo. So you need to try this:
In case you do not need to create an object to call the function, you can define the method as static and use the notation
myService.UserInfo[] uiList = myService.listValues(456,myName);
You need to understand that the constructor cannot return any value. It can be parameterized and has to have the class name.