>
> Hi,
>
> First of all thanks for your reply.
>
> Yes I was using the wrong one. Now I have created the webservice by using
> POJO, deployed .aar file and able to access it though URL like this.
> http://localhost:8080/axis2/services/WeatherService?wsdl
>
> But when I try to invoke the webservice frome client its not getting any
> response from the webservice.
> Here I am attaching mu code snipper, can somebody please check and let me
> know what could be the problem.
>
>
> Thanks,
> Amarnath.
>   On Wed, Dec 3, 2008 at 10:41 PM, Amila Suriarachchi <
> [EMAIL PROTECTED]> wrote:
>
>>
>>
>> On Thu, Dec 4, 2008 at 7:30 AM, amar reddy <[EMAIL PROTECTED]>wrote:
>>
>>>
>>> Hi,
>>>
>>> >
>>> > Today I have configured tomcat for Axis webservices. so, tomcat
>>> > configuration is fine..no issues this side.
>>> >
>>> > I started learning the webservices with the Calculator example given at
>>> "
>>> > http://ws.apache.org/axis/java/user-guide.html";
>>> >
>>> > Steps I followed.
>>> >
>>> > 1. Create a "Calculator.java" and copied to
>>> C:\apache-tomcat-5.5.27\webapps\axis2
>>> > 2. Renames the file to "Calculator.jws"
>>> > 3. Restart the Tomcat server.
>>> > 4. Now try to access the like ...."
>>> > http://localhost:8080/axis2/Calculator.jws";
>>>
>>
>> I think you have mixed Axis1 and Axis2.  The way you have to deploy a POJO
>> in axis2 is different from axis1. Please read the user guide.
>>
>> thanks,
>> Amila.
>>
>>>
>>> >
>>> > In the UI I am getting the following error.
>>> >
>>> > ************************************
>>> > <soapenv:Reason>
>>> > <soapenv:Text xml:lang="en-US">
>>> > *The service cannot be found for the endpoint reference (EPR)
>>> > /axis2/Calculator.jws*
>>> > </soapenv:Text>
>>> > </soapenv:Reason>
>>> > ************************************
>>> > Below I am giving the exception stack trace in the console.
>>> >
>>> > ****************************
>>> > [ERROR] The service cannot be found for the endpoint reference (EPR)
>>> > /axis2/Calc
>>> > ulator.jws
>>> > org.apache.axis2.AxisFault: The service cannot be found for the
>>> endpoint
>>> > referen
>>> > ce (EPR) /axis2/Calculator.jws
>>> >         at
>>> > org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPha
>>> > se.java:64)
>>> >         at org.apache.axis2.engine.Phase.invoke(Phase.java:333)
>>> >         at
>>> org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)
>>> >         at
>>> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:163)
>>> >         at
>>> > org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUt
>>> > il.java:136)
>>> >         at
>>> > org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTU
>>> > til.java:130)
>>> >         at
>>> > org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.proc
>>> > essURLRequest(AxisServlet.java:824)
>>> >         at
>>> > org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:25
>>> > 3)
>>> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
>>> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>>> >         at
>>> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
>>> > icationFilterChain.java:269)
>>> >         at
>>> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
>>> > ilterChain.java:188)
>>> >         at
>>> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
>>> > alve.java:213)
>>> >         at
>>> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
>>> > alve.java:172)
>>> >         at
>>> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
>>> > ava:127)
>>> >         at
>>> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
>>> > ava:117)
>>> >         at
>>> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
>>> > ve.java:108)
>>> >         at
>>> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
>>> > a:174)
>>> >         at
>>> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
>>> > :875)
>>> >         at
>>> > org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
>>> > rocessConnection(Http11BaseProtocol.java:665)
>>> >         at
>>> > org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
>>> > int.java:528)
>>> >         at
>>> > org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
>>> > lowerWorkerThread.java:81)
>>> >         at
>>> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
>>> > ool.java:689)
>>> >         at java.lang.Thread.run(Thread.java:595)
>>> >
>>> > ***************************
>>> >
>>> > Can somebody please help me out what I am missing here?
>>> > I appreciate your help.
>>> >
>>> > Thanks,
>>> > Amarnath.
>>>
>>>
>>
>>
>> --
>> Amila Suriarachchi
>> WSO2 Inc.
>> blog: http://amilachinthaka.blogspot.com/
>>
>
>
<service name="WeatherService">
    <description>
        Weather POJO Service
    </description>
    <messageReceivers>  
        <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-only"; 
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out";   
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    
    <parameter name="ServiceClass"> 
sample.pojo.service.WeatherService</parameter>
</service>

*********************************Service***************************************************
package sample.pojo.service;

import sample.pojo.data.Weather;

public class WeatherService{
    Weather weather;
    
    public void setWeather(Weather weather){
        this.weather = weather;
    }

    public Weather getWeather(){
        return this.weather;
    }
}

************************************************************************************

package sample.pojo.data;

public class Weather{
    float temperature;
    String forecast;
    boolean rain;
    float howMuchRain;
    
    public void setTemperature(float temp){
        temperature = temp;
    }

    public float getTemperature(){
        return temperature;
    }
    
    public void setForecast(String fore){
        forecast = fore;
    }

    public String getForecast(){
        return forecast;
    }
    
    public void setRain(boolean r){
        rain = r;
    }

    public boolean getRain(){
        return rain;
    }
    
    public void setHowMuchRain(float howMuch){
        howMuchRain = howMuch;
    }

    public float getHowMuchRain(){
        return howMuchRain;
    }
}

**************************************Client**********************************************

package sample.pojo.rpcclient;

import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;

import sample.pojo.data.Weather;


public class WeatherRPCClient {

    public static void main(String[] args1) throws AxisFault {

        RPCServiceClient serviceClient = new RPCServiceClient();

        Options options = serviceClient.getOptions();

        EndpointReference targetEPR = new EndpointReference(
                "http://localhost:8080/axis2/services/WeatherService?wsdl";);
        options.setTo(targetEPR);

        // Setting the weather
        QName opSetWeather =
            new QName("http://service.pojo.sample/xsd";, "setWeather");

        Weather w = new Weather();

        w.setTemperature((float)39.3);
        w.setForecast("Cloudy with showers");
        w.setRain(true);
        w.setHowMuchRain((float)4.5);

        Object[] opSetWeatherArgs = new Object[] { w };

        serviceClient.invokeRobust(opSetWeather, opSetWeatherArgs);
//      Getting the weather
        QName opGetWeather =
            new QName("http://service.pojo.sample/xsd";, "getWeather");

        Object[] opGetWeatherArgs = new Object[] { };
        Class[] returnTypes = new Class[] { Weather.class };
        
        Object[] response = serviceClient.invokeBlocking(opGetWeather,
                opGetWeatherArgs, returnTypes);
        System.out.println("response" + response[0]);
        Weather result = (Weather) response[0];
        
        if (result == null) {
            System.out.println("Weather didn't initialize!");
            return;
        }
    }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to