0

I am working on one project in which i am developing a java client for .NET/C#. I want to send information of device to the web service. I have created one class which contains the device information. I want to send the information of the device to service. what is appropriate way to do this. Please help.

sorry for my weak English. And thanks in advance.

package com.ivb.syntecApp.models;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class DeviceInformation {

    private String vendorId;
    private String productId;
    private String hardwareRevision;
    private String deviceName;
    private String manufacturerName;

    @XmlElement
    public String getVendorId() {
        return vendorId;
    }
    public void setVendorId(String vendorId) {
        this.vendorId = vendorId;
    }

    @XmlElement
    public String getProductId() {
        return productId;
    }
    public void setProductId(String productId) {
        this.productId = productId;
    }

    @XmlElement
    public String getHardwareRevision() {
        return hardwareRevision;
    }
    public void setHardwareRevision(String hardwareRevision) {
        this.hardwareRevision = hardwareRevision;
    }

    @XmlElement
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    @XmlElement
    public String getManufacturerName() {
        return manufacturerName;
    }
    public void setManufacturerName(String manufacturerName) {
        this.manufacturerName = manufacturerName;
    }
}
Hoopje
  • 12,677
  • 8
  • 34
  • 50
V__
  • 538
  • 10
  • 20

2 Answers2

0

For this purpose the Common Object Request Broker Architecture (CORBA) was developed. But it's too big gun for your needs. I recommend you to use some kind of REST or SOAP service with transformators(Adapter pattern)

Milkmaid
  • 1,659
  • 4
  • 26
  • 39
  • i am very new to web service. I am not able get that how to send this information in request. And 1 important this i am working on swing based client. – V__ Feb 18 '15 at 10:00
0

I have solved at my own. I don't know is it good practice or not.

My answer is ->

I have used JAXB for marshaling DeviceInformation class and used `void marshal(Object jaxbElement, Writer writer) throws JAXBException

` to convert this object in to StringWriter object then converted it into string and sent this string to .NET/C# service. This meets my requirement.

I found this here

Community
  • 1
  • 1
V__
  • 538
  • 10
  • 20