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;
    }
}

2 Answers 2

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)

Sign up to request clarification or add additional context in comments.

1 Comment

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.
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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.