How to access a webservice in java through .NET client
- From: "Kumar" <kumareshind@xxxxxxxxx>
- Date: Sun, 19 Oct 2008 04:26:51 -0700
Hi,
I have a web service running at
http://localhost:8080/Hello/HelloService
and I have a method getHello( ).
If I want to access this through .NET [C#] client, what should I do?
The following code that I modified based on a site did not work for me. Any ideas?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Diagnostics;
using System.Xml.Serialization;
using System.Web.Services.Protocols;
using System.Web.Services;
[System.Web.Services.WebServiceBindingAttribute(
Name = "HelloService",
Namespace = "urn:HelloService")]
/// <summary>
/// Summary description for testjavaservice
/// </summary>
public class testjavaservice : System.Web.Services.Protocols.SoapHttpClientProtocol
{
public testjavaservice()
{
//
// TODO: Add constructor logic here
//
this.Url = http://localhost:8080/Hello/HelloService;
}
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:HelloService/getHello",
RequestNamespace = "urn:HelloService",
ResponseNamespace = "urn:HelloService",
Use = System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public string getHello (string name)
{
object[] results = this.Invoke("getHello", new object[] { name });
return ( (string) results[0]);
}
public static void Main(String[] args)
{
try
{
Console.WriteLine("Calling the SOAP server to say hello");
testjavaservice jsvc = new testjavaservice();
Console.WriteLine("The SOAP server says " + jsvc.getHello(args[0]));
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
}
Thanks
- Kumar
.
- Follow-Ups:
- Re: How to access a webservice in java through .NET client
- From: John Saunders
- Re: How to access a webservice in java through .NET client
- Prev by Date: RE: WCF Proxy Server settings not working
- Next by Date: Re: How to access a webservice in java through .NET client
- Previous by thread: Proxy issue
- Next by thread: Re: How to access a webservice in java through .NET client
- Index(es):
Loading