Calling C# web service (soap.tcp) from Java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TayBill
    New Member
    • Jan 2010
    • 3

    #1

    Calling C# web service (soap.tcp) from Java

    I have C# based webservice that is hosted in a NT service. Programmatic access to the web service is of the form: soap.tcp://localhost:11141/ProcessorWebSer vice

    (The more traditional way to implement C# webservices is to put them in asp.net (.asmx) files and hosted by IIS. Access to these services is of the form: http://localhost/webservicetest/service.asmx. For various reasons, I don’t want to do that.)

    I can successfully connect to my web service by from C# by:
    1. Creating a C# proxy for the webservice by running WseWsdl.exe against the URL.
    2. Make calls using the proxy’s.
    My initial problem: How do I connect to the service from Java?
    Problems I’ve encountered
    1. How to create a proxy in Java?
    a. I want to use wsimport against a WSDL file. But, since I don’t have a .asmx based service, I can’t just call <url>?WSDL to get it.
    2. Even if I create a Java proxy (which I’ve done via some judicious hacking), I can’t seem to successfully connect to the service, when the URL is of the form soap.tcp://localhost:11141/ProcessorWebSer vice.
    a. The big difference her is using soap.tcp as the protocol, instead of HTTP. Also note that I’m going to a non traditional port. Still—I can get all of this to work from C#.

    Here’s an example of my trivial program:
    ProcessorWebSer vice pws = new ProcessorWebSer vice();
    ProcessorWebSer viceSoap pwss = pws.getProcesso rWebServiceSoap (); ((javax.xml.ws. BindingProvider )pwss).getReque stContext().
    put(javax.xml.w s.BindingProvid er.ENDPOINT_ADD RESS_PROPERTY, "soap.tcp://localhost:11141/ProcessorWebSer vice");

    String resultFromHello World = pwss.helloWorld ();
    It fails on the call to pwss.helloWord( ); with the following:
    "Unsupporte d endpoint address: soap.tcp://localhost:11141/ProcessorWebSer vice"

    My real questions:
    Is it even possible to connect Java to a webservice hosted in a NT service?
    Does anyone have any good pointers, or examples. (I’ve searched around a lot, but I’m a novice at Java, so easily could have missed something.)
  • Alexander Philippou
    New Member
    • Jan 2010
    • 1

    #2
    If upgrading to WCF is an option, you can use SOAP/TCP as a non-HTTP transport that is Java interoperable. SOAP/TCP is available in WCF-Xtensions.

    Comment

    • TayBill
      New Member
      • Jan 2010
      • 3

      #3
      Interesting idea, but my organization is probably too cheap to buy that package.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        I don't think that you need to purchase anything to accomplish what you need. Check out this article on Developing Web Services. There is a section there that describes how to implement a client that consumes a web service using Java. It's pretty cool stuff... You create a stub, dynamic proxy, or use Dynamic Invocation Interface to consume your service. It's all described in that article with code examples.

        Most of this stuff depends on a WSDL so I hope that you didn't create a RESTful web
        service...becau se I'm not sure how you would use them in Java.

        Here's another article that is pretty helpful: Creating a Simple Web Service and Client with JAX-WS.

        You should probably search the sun website for Java related development :)
        It's kind of like MSDN but not quite as...robust.

        -Frinny

        Comment

        • TayBill
          New Member
          • Jan 2010
          • 3

          #5
          Unfortunately, the link you provided is an all Java solution. I'm constrained that my service is written in C# AND is hosted in an NT service (as opposed to the more traditional asmx page in IIS).

          I'm starting to think that the big clue that I "can't get there from here", is that I can't fine a way to generate WSDL from my solution. All the solutions I find, including the one you referenced, rely on a WSDL file being available.

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            I misunderstood your problem. I thought that you didn't know how to consume a web service in Java....

            I haven't worked much with web services in .NET before but have you tried "publishing " the web service to a server?



            -Frinny

            Comment

            Working...