views:

54

answers:

3

Hello all

I would like to build an app in C# that connects to an Apache AXIS web service and performs the following operations via SOAP.

  1. Login in to the server.
  2. POST string data to server
  3. Receive and display server response

Here's the tough part. I do not have access to the server, nor do I know where the .JWS file is located on the server. I was able to get to the WSDL file in my web browser, so I know a "Login" operation exists as well as an operation to take in data.

I have tried accessing the web service via URL, but I keep getting this message:

Hi there, this is an AXIS service!

Perhaps there will be a form for invoking the service here...

In summary, is there anyway I can connect to this web service when all I have is the URL of the WSDL file? Are web services accessible via URL?

Thank you

A: 

See http://msdn.microsoft.com/en-us/library/bb552364.aspx for a starting point

unclepaul84
A: 

Use WCF, and generate client proxies to the web service using the svcutil.exe tool.

running svcutil.exe http://url.to/webservice?WSDL the_wsdl.wsdl /language:C# should generate proxy classes you can use in your C# project, and you'd call the service e.g. like

  BasicHttpBinding myBinding = new BasicHttpBinding(); //might not even need these
                    // 2 lines if you ran svcutil.exe directly on the web service URL
  EndpointAddress myEndpoint = new EndpointAddress("http://url.to/webservice");
  TestClient client = new TestClient(myBinding,myEndpoint); //the generated classes
                                                            // svcutil.exe created
  client.SomeOperation(42); // call an SomeOperation of the web service 
nos
A: 

Thanks for everyone's help. Looking back on this question, I can see how severely confused I was. Here is the solution I followed.

Assuming you know the URL of the WSDL file of the service you wish to connect to then just do the following.

  1. Boot up Visual Studio
  2. On the top toolbar navigate to Data -> Add New Data Source then choose Service in the new dialog
  3. In the address bar, enter the URL of the wsdl file (EXAMPLE: http://server.com/services/displayName?wsdl)
  4. Near the bottom of the dialog, change the namespace to something relevant to the project (EXAMPLE: sampleService)
  5. Now Visual Studio should compile the client proxies for you that you can use to access the web services on your server. To access one of the services, all you need to do is create a new object from the class.

        //Example
        sampleService.ClassName test = new sampleService.ClassName();
    
    
    
       test.displayName("Jack");
    
grease357