开发者

Web Service Creating Instance Problem -> Could not find default endpoint element that references contract 'MyWebService.ClassName'

i want to use the below Web-Service :

https://acquirer.sb24.com/ref-payment/ws/ReferencePayment?WSDL

and builded config file after adding ->

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    开发者_JAVA百科<system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="PaymentIFBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="Transport">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
                <binding name="PaymentIFBinding1" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://acquirer.sb24.com:443/ref-payment/ws/ReferencePayment"
                binding="basicHttpBinding" bindingConfiguration="PaymentIFBinding"
                contract="SB24Service.PaymentIF" name="PaymentIFPort" />
        </client>
    </system.serviceModel>
</configuration>  

i want to call verifyTransaction method of this WebService :

PaymentIFClient pic = new PaymentIFClient();  

double pic_result = pic.verifyTransaction(str1, str2);  

but the first line throws the below error :

Could not find default endpoint element that references contract 'SB24Service.PaymentIF' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

EDIT :

"This error can arise if you are calling the service in a class library and calling the class library from another project." -> My Situation is like this ...

what should i change i configuration file ?

thanks in advance


Editing wcf configuration by hand is tricky, as there are many sections that need to be correct and correctly reference each other. Try opening your app.config file in SvcConfigEditor (also available from the Tools menu in Viusal Studio). It is way easier to get things correct when having GUI help on what to do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜