WebService sample - Station Query (İstasyon Sorgu)

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.entity;

/**
 *
 * @author nurhak.kaya
 */
public enum Istasyon {
 
    Station1("48120"),
    Station2("48500");
 
    String value;
 
    public String getValue() {
        return value;
    }

    private Istasyon(String value) {
        this.value = value;
    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.entity;

/**
 *
 * @author nurhak.kaya
 */
public class KaynakEntity {
    String resourceCallSign;
 
    String stationName;
    String stationCallSign;

    public String getResourceCallSign() {
        return resourceCallSign;
    }

    public void setResourceCallSign(String resourceCallSign) {
        this.resourceCallSign = resourceCallSign;
    }

    public String getStationCallSign() {
        return stationCallSign;
    }

    public void setStationCallSign(String stationCallSign) {
        this.stationCallSign = stationCallSign;
    }

    public String getStationName() {
        return stationName;
    }

    public void setStationName(String stationName) {
        this.stationName = stationName;
    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.servis;

import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import net.ucngm.kgys.polnet.entity.Istasyon;
import net.ucngm.kgys.polnet.entity.KaynakEntity;

/**
 *
 * @author nurhak.kaya
 */
@WebService(serviceName = "IstasyonSorgu")
public class IstasyonSorgu {

    /**
     * Web service operation
     */
    @WebMethod(operationName = "istasyonGetir")
    @WebResult(name="istasyon")
    public KaynakEntity istasyonGetir(@WebParam(name = "callSign") String callSign) {
        //TODO write your implementation code here:
       KaynakEntity re = new KaynakEntity();
       String name1="1. Bölge";
       String name2="5. Bölge";

        if (callSign.compareTo("48111") == 0 || callSign.compareTo("48112") == 0) {

            re.setStationCallSign(Istasyon.Station1.getValue());
            re.setStationName(name1);

        } else if (callSign.compareTo("48113") == 0 || callSign.compareTo("48114") == 0) {

            re.setStationCallSign(Istasyon.Station2.getValue());
            re.setStationName(name2);
        }

        return re;
    }
}

Comments

Popular posts from this blog

Solution for "Can not obtain Oracle client information from registry"

Solution for the fault: "System.Diagnostics.Process.Start is not working on IIS, but working on ASP.NET Development Server"

Getting Umbraco Content - IPublishedContent vs IContent vs Node vs Document