Trying to get a .NET application to connect to a web service

packer_dj
packer_dj used Ask the Experts™
on
--Updated--

I'm trying to connect .NET to a published webservice.  The way the appserver is configured, I need to generate a connect request, which returns a uuid, then generate the actual request to get / update information, then generate a logout request.

I can connect to the web service; the connect request is supposed to return a value of type xxwt1ID, what I can't figure out is how to get that value and pass it to the actual request to get information from the web service.

I've imported the WSDL as a Service Reference and was able to connect using the statement  cReq3.Connect_xxwt1.  That connection is supposed to return a value of type xxwt1ID, which I then pass when I'm making the actual call to the webservice with statement cReq3.xxwt1(cReq3.xxwt1ID, "abc", "def", out strTest.

I've attached a simple example WSDL - and a stub of code to show what I'm trying to do - any help or suggestions on how to write code to login, retrieve data, and logout would be GREATLY appreciated.

Thanks,

-Dan


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {


            ServiceReference1.xxwt1ObjClient cReq3 = new ServiceReference1.xxwt1ObjClient();
      

            cReq3.Connect_xxwt1("danp", "apass", "test_AS");
            /* cReq3 is supposed to return a UUID.  How do I get the UUID? */

            Console.WriteLine("Tried cReq3");
            ServiceReference1.xxwt1ID cXxwt1ID = new ServiceReference1.xxwt1ID();
            
            /* UUID is blank ... I'm not sure why */
            Console.WriteLine("UUID IS: " + cXxwt1ID.UUID);
            
            Console.ReadLine();
            
            Console.WriteLine(cReq3.State.ToString());
            Console.WriteLine("Opened");

              

            Console.ReadLine();
            String strTest = "";
            /*  This isn't working for some reason
             * The first parameter should be of type ServiceReference1xxwt1ID xxwt1ID 
            Console.WriteLine(cReq3.xxwt1(cReq3.xxwt1ID, "abc", "def", out strTest));
            */
            
            Console.WriteLine("Sent xxwt1");
            Console.ReadLine();

            /*
            ServiceReference1.Connect_xxwt1Request cRequest = new ServiceReference1.Connect_xxwt1Request();
            cRequest.userId = "Danp";
            cRequest.password = "blah";
            cRequest.appServerInfo = "test_AS";
            Console.WriteLine("Set Parameters");
            Console.ReadLine();
            */
            
            ServiceReference1.Connect_xxwt1Response cResponse = new ServiceReference1.Connect_xxwt1Response();
            Console.WriteLine("Blah");
            Console.WriteLine(cResponse.ToString());
            Console.ReadLine();

        }
    }
}

Open in new window

wsdl8.wsdl
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
try...
           ServiceReference1.xxwt1ObjClient cReq3 = new ServiceReference1.xxwt1ObjClient();
                 
            myUUID =  cReq3.Connect_xxwt1("danp", "apass", "test_AS");
            /* cReq3 is supposed to return a UUID.  How do I get the UUID? */
            
            /* UUID is blank ... I'm not sure why */
            Console.WriteLine("UUID IS: " + myUUID);
            
            Console.ReadLine();
            
            Console.WriteLine(cReq3.State.ToString());
            Console.WriteLine("Opened");

            Console.ReadLine();
            String strTest = "";
            Console.WriteLine(cReq3.xxwt1(myUUID, "abc", "def", out strTest));

            Console.WriteLine("Sent xxwt1, got [[") + strTest + "]]";
            Console.ReadLine();

         }

Open in new window


my usage...
    public static string UpdateContactLink(string ProjId)
    {

        // trust sender as Service is addressed to tester.com.au  as internal.
        System.Net.ServicePointManager.ServerCertificateValidationCallback = ((senderx, cert, chain, errors) => cert.Subject.ToLower().Contains("tester.com.au"));

        InfoDocExch1.InfoDocExchange idx = new InfoDocExch1.InfoDocExchange();

        string result = idx.AddUpdate(ProjId);

        return result;
    }

Open in new window

Senior Developer
Commented:
It solely depends on the used service, thus the class behind your request. As robr wrote, it can be the return value of your connect method, but it can be a property as you've tried.

To see what happens, you can use Fiddler to look at the actual SOAP messages exchanged.
Eduard GherguArchitect - Coder - Mentor

Commented:
Hi,

The WSDL and the associated classes are generated by VS and is not supposed to be changed by hand. Try to update the reference to the WS, maybe there are some changes on the API.

Author

Commented:
Thanks everyone for the assistance!  I was able to look at the actual SOAP messages that were constructed and figured out the problem.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial