0

I have to communicate (using .NET) with a web service running on Axis 1.2. Using two .NET tools and the WSDL I have created C# proxies however I ran into problems such that:

1) WSDL.exe created a proxy which lacks input parameters for methods. e.g. if there should be such a method:

AReturnType AMethod(AnInputType);

the created proxy had such a method:

void AMethod();

2) I've read that instead of WSDL.exe, SVCUTIL.exe is recommended. So I've created the proxies with SVCUTIL, however ran into the infamous problem of NULL returned objects. Unfortunately I could not find any suitable solution.

So I am willing to do the setup manually. Here's what I have:

  • SoapUI parses the WSDL well, can inspect SOAP/XML requests/responses.
  • Axis WSDL2JAVA generates proper Java code, and it works well
  • Sending XML/SOAP requests with HttpWebRequest generates proper XML/SOAP responses.
  • I have tried generating XSD and C# objects using XSD.EXE tools and serializing XML responses (obtained with previous step) into those objects.

So what do you suggest? Is there a way to manually create the proxy somehow? Or can generated Java code help me somehow?

Community
  • 1
  • 1
paul simmons
  • 5,568
  • 13
  • 51
  • 78

3 Answers3

1

Here's how a project I'm working on creates and uses a manual proxy.

This is the client proxy:

 [ServiceContract(Name = "YourServiceContract", Namespace = "http://....")]
 public interface YourServiceContract, 
  {
    [OperationContract]
    object GetObject(object searchCriteria);
   }

public class YourClient : ClientBase<YourServiceContract>, YourServiceContract
{
    public YourClient (){ }

    public YourClient (string endpointConfigurationName)
    : base(endpointConfigurationName){ }

    public object GetObject(object searchCriteria)
    {
    return base.Channel.GetObject(searchCriteria);
    }
}

This is how it's called:

public void GetYourObject(object searchCriteria)
    {
        YourClient proxy = new YourClient();
        proxy.GetObject(searchCriteria);
        proxy.SafeClose();
    }
Big Daddy
  • 5,160
  • 5
  • 46
  • 76
0

Have a look at this answer. Will allow you to make an HttpRequest directly:-

Community
  • 1
  • 1
Nick Ryan
  • 2,662
  • 1
  • 17
  • 24
  • yes, I had mentioned I am getting the proper response with HttpWebProxy (i edited, it was not explicit). So after that? serialize into xsd-generated objects? – paul simmons Sep 25 '12 at 15:41
  • Yeh. It's not pretty though. There is another SO article on how to do that:- http://stackoverflow.com/questions/1295046/use-xdocument-as-the-source-for-xmlserializer-deserialize – Nick Ryan Sep 25 '12 at 15:45
  • Dumb question I guess, but, were you not able to just add a service (or web) reference to the axis service's WSDL? – Nick Ryan Sep 25 '12 at 15:47
  • Nick, using wdsl results in the null object issue http://stackoverflow.com/questions/8017700/invoking-a-java-axis-web-service-from-net-the-return-null-issue (however it is a broader problem, you can google "axis web service .net null" just to see how many problems there are out there) – paul simmons Sep 25 '12 at 15:51
  • Fair enough. The XDocument, XmlSerializer approach should get you out of a hole in the meantime. I've used it to make 'direct' integration tests against WCF services where I want to be precisely sure of the XML I am sending (and of what XML I expect to recieve). – Nick Ryan Sep 25 '12 at 15:53
0

There is a set of predefined interop bindings that connect WCF clients with services in the Java world.

Sebastian Weber
  • 6,766
  • 2
  • 30
  • 49