Re: Calling Axis service on Applet client

2008-07-15 Thread Madhav
I think applets can access resources back from the same domain only from
where it gets downloaded/accessed.

So, one possible solution could be to host your applet page in a tomcat
instance and deploy a proxy servlet there. From the applet, call the servlet
proxy method and that method would in turn call the web service.

-Madhav

On Tue, Jul 15, 2008 at 5:18 PM, Thamizh <[EMAIL PROTECTED]> wrote:

> Hi All,
> I am new to axis. I have deployed a sample axis web service which accepts a
> sting and displays "Hello "+string.
>
> I have created a applet client in that I am calling that web service. here
> I am facing the following error.
>
> java.net.MalformedURLException: no protocol: Axis
> at java.net.URL.(Unknown Source)
> at java.net.URL.(Unknown Source)
> at java.net.URL.(Unknown Source)
> at TestApplet.makeSoapCall(TestApplet.java:35)
> at TestApplet.init(TestApplet.java:22)
> at sun.applet.AppletPanel.run(Unknown Source)
> at java.lang.Thread.run(Unknown Source)
>
> Please help me to solve this issue. Then It would be a great help for me..
>
> Here is my applet code:
>
> import java.applet.*;
> import org.apache.axis.AxisFault;
> import org.apache.axis.client.Call;
> import org.apache.axis.client.Service;
> import javax.xml.rpc.ParameterMode;
> import org.apache.axis.encoding.XMLType;
>
> public class TestApplet1 extends Applet
> {
> private static String endpoint = "
> http://xx.xx.xx.xx:8200/axis/services/TomcatTestService";;
> public void init () {
> System.out.println("\n**\nStarting up!\n");
> makeSoapCall("Axis");
> System.out.println("\n**\n");
> }
>
> private static void makeSoapCall( String message ){
> try {
> // EndPoint URL for the HelloWorld Web Service
> String endpointURL =message;
> String methodName = "getHelloMessage";
> Service service = new Service();
> Call call = (Call) service.createCall();
>
> //Set the endPoint URL
> call.setTargetEndpointAddress (new java.net.URL(endpointURL));
>
> call.setOperationName (methodName);
> call.addParameter("name",XMLType.XSD_STRING,ParameterMode.IN);
>
> call.setReturnType (XMLType.XSD_STRING);
>
>   String result = (String) call.invoke (new Object[] { "AXIS" }
> );
> //Print out the result
> System.out.println (result);
> }catch (AxisFault fault) {
> System.err.println("Error : " + fault.toString());
> }
> catch (Exception e) {
> e.printStackTrace();
>   }
>   }
> }
>
> Regards,
> Thamizhannal P
>
> --
> From Chandigarh to Chennai - find friends all over India. Click 
> here.




-- 
-Madhav


Calling Axis service on Applet client

2008-07-15 Thread Thamizh
Hi All,
I am new to axis. I have deployed a sample axis web service which accepts a 
sting and displays "Hello "+string.

I have created a applet client in that I am calling that web service. here I am 
facing the following error.

java.net.MalformedURLException: no protocol: Axis
at java.net.URL.(Unknown Source)
at java.net.URL.(Unknown Source)
at java.net.URL.(Unknown Source)
at TestApplet.makeSoapCall(TestApplet.java:35)
at TestApplet.init(TestApplet.java:22)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Please help me to solve this issue. Then It would be a great help for me..

Here is my applet code:

import java.applet.*;
import org.apache.axis.AxisFault;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.encoding.XMLType;

public class TestApplet1 extends Applet
{
private static String endpoint = 
"http://xx.xx.xx.xx:8200/axis/services/TomcatTestService";;
public void init () {
System.out.println("\n**\nStarting up!\n");
makeSoapCall("Axis");
System.out.println("\n**\n");
}

private static void makeSoapCall( String message ){
try {
// EndPoint URL for the HelloWorld Web Service
String endpointURL =message; 
String methodName = "getHelloMessage";
Service service = new Service();
Call call = (Call) service.createCall();

//Set the endPoint URL
call.setTargetEndpointAddress (new java.net.URL(endpointURL));

call.setOperationName (methodName);
call.addParameter("name",XMLType.XSD_STRING,ParameterMode.IN);

call.setReturnType (XMLType.XSD_STRING);

  String result = (String) call.invoke (new Object[] { "AXIS" } );  
  
//Print out the result
System.out.println (result);
}catch (AxisFault fault) {
System.err.println("Error : " + fault.toString());
}
catch (Exception e) {
e.printStackTrace();
  }
  }
}

Regards,
Thamizhannal P

   
-
 From Chandigarh to Chennai - find friends all over India.  Click here.