What works as Web Refence (ASMX), should work as a Service Reference (WCF), right?

I recently noticed that using Service References (WCF) is causing problems with the old legacy SOAP APIs. I thought the new, better approach was to use Service References because WCF is more flexible and modern. Can anyone determine how I can make this work with WCF in VS2013?

This is a simple console application trying to use RxNav (free) api

URL: http://mor.nlm.nih.gov/axis/services/RxNormDBService

After adding a “service certificate” to the solution, I entered the following code:

Program.cs

static void Main(string[] args)
{
    var client = new RxNavAPI.DBManagerClient();

    try
    {
        var matches = client.getDrugs("aspirin");

        foreach (var conceptGroup in matches)
        {
            foreach (var concept in conceptGroup.rxConcept)
            {
                Console.WriteLine(String.Format("Name: {0}, Syn: {1}", concept.STR, concept.SY));
            }
        }

        client.close();
    }
    catch (TimeoutException ex)
    {
        Console.WriteLine("Timeout occurred while accessing RxNav API");
        Console.WriteLine(ex.Message);
        throw;
    }
}

App.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="RxNormDBServiceSoapBinding" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://mor.nlm.nih.gov/axis/services/RxNormDBService"
                binding="basicHttpBinding" bindingConfiguration="RxNormDBServiceSoapBinding"
                contract="RxNavAPI.DBManager" name="RxNormDBService" />
        </client>
    </system.serviceModel>
</configuration>

One thing that I noticed is added as a Web link , the client is called as:

var client = new RxNavAPI.DBManagerService();

and when using the Service Reference :

var client = new RxNavAPI.DBManagerClient();

EDIT: , ,

System.InvalidOperationException: " RPC getProprietaryInformationRequest1 getProprietaryInformation1 getProprietaryInformation. getProprietaryInformation1"

+3
1

Awesome!  @ . , 5 . WCF: Svcutil , - Apache AXIS,

, , .

0

All Articles