Recent Post

Categories

Archives

Cow Computing

09 Sep 7

.NET code to interact with Java’s Web Service

Recently, i am working on a library to allow .NET developer to interact with a web service built on Java. It’s a SwA (Soap with Attachment). The reason for me to do this is because there’s been no support for such operation in .NET framework and users who want to deal with such scenario will have to write their own code bit by bit to accomplish the job, which is TEDIOUS…

The library i built relies on an open source library called PocketSoap. Its support on Attachment and its ease of use is appealing and i at last chosen to give it a try and build a POC on top of it. Below is a simple usage sample for the PocketSoap library.

using System;
using PocketSOAP;
using PocketSOAPAttachments;

namespace PSTryout
{
    public class psWS
    {
        CoEnvelope e = new CoEnvelopeClass();
        e.Body.Create("id", 1, "", null, null);
        e.EncodingStyle = "";

        HTTPTransport h = new HTTPTransport();
        h.SOAPAction = "query";
        h.Timeout = 30000;
        h.Send("http://localhost:8080/ws/", e.Serialize());

        string enc = "";
        e.Parse(h, enc);
    }
}