You need to sign in to do that
Don't have an account?
Need a help in webservices
Hi !
I am new to sales force. I have taken small example webservice in forum . I am not getting any error but i am not ble to see "Hello world" in the Page.
Here is my class Venki:
global
classVenki {
webService
staticstring sayHello() {
return'Hello World!';
}
}
Controller Class:
public
classVenkiController {
String uname=
null;
publicString getUsername() {
returnuname;
}
publicString getHelloWorld() {
string result;
WSDL2ApexVenki.Venki stub =
newWSDL2ApexVenki.Venki();
uname = stub.sayHello();
return uname ;
}
}
Visual force Page:
<
apex:pagecontroller="VenkiController"tabStyle="Account">
<
apex:form><!-- Define the JavaScript function sayHello--><apex:actionFunctionname="HelloWorld"action="{!getHelloWorld}"rerender="out"/><h1> This is my first VisualForce Page! </h1><apex:outputTextvalue={!uname}/></apex:form>
</
apex:page>
What am i missing? Please suggest.
U r call that action fucntion on the onload event i belive
u page is created first & the in apex controller assing value in uname
property
u can try command button which u click after complite page get loaded & rerender the outputText
Hi SPK thanks for your reply. Can you please give me an example visual force code...
Visual force Page:
<apex:pagecontroller="VenkiController"tabStyle="Account">
<apex:form>
<script>
function show()
{
testHello();
}
</script>
<apex:actionFunction name="testHello" action="{!getHelloWorld}" rerender="out"/>
<h1> This is my first VisualForce Page! </h1>
<apex:outputText value={!uname} id="out" />
<apex:commandbutton onclick = "show()"/>
</apex:form>
</apex:page>
Thanks a lot !. I am getting below error now..please help..
System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session faultcode=sf:INVALID_SESSION_ID faultactor=
Class.WSDL2ApexVenki.Venki.sayHello: line 62, column 1 Class.VenkiController.getHelloWorld: line 11, column 1
I reset the password..the error vanished but there is no out like Hello World
There is no consitancy i am still keep getting the above error please help