400 Bad Exception: простой сервис SOAP WCF с небольшими данными

У меня простой сервис WCFSOAP, У меня очень простая операция & # x201C; GetMultiplied & # x201C; с очень небольшим количеством данных. Я получаю следующее исключение, когда клиент пытается вызвать операцию. Любая идея, что все может быть проблемы?

Inner Exception: {"The remote server returned an error: (400) Bad Request."}

Полный wsdl и схема перечислены в конце.

Примечание: я установил значения квоты, maxBufferSize и т. Д. На более высокие значения как в конфигурации службы, так и в конфигурации клиента.

Tracing in Service

Когда я использовал трассировку в сервисе (на основеКак включить трассировку WCF?), Я получаю следующее - кажется, что нет зарегистрированных ошибок.

<Type>3</Type>
<SubType Name="Information">0</SubType>
<Level>8</Level>
<TimeCreated SystemTime="2012-09-13T17:05:17.6059181Z" />
<Source Name="System.ServiceModel" />
<Description>AppDomain unloading.</Description>

Service implementation

public class CalculationService : ICalculationService
{

    public virtual GetMultipliedResponse GetMultiplied(GetMultipliedRequest request)
    {
        MultipliedResult result = new MultipliedResult();
        result.ResultNumber= ((request.InputNumber)*2);

        GetMultipliedResponse response = new GetMultipliedResponse(result);
        return response;
    }
}

Client

    static void Main(string[] args)
    {
        CalculationServiceInterfaceClient proxy = new CalculationServiceInterfaceClient();
        multipliedResult result = proxy.getMultiplied(2);
    }

В автоматически сгенерированном коде детали:

    public NewClient.CalcReference.multipliedResult getMultiplied(int inputNumber) 
    {
        NewClient.CalcReference.getMultipliedRequest inValue = new NewClient.CalcReference.getMultipliedRequest();
        inValue.inputNumber = inputNumber;

        NewClient.CalcReference.getMultipliedResponse retVal = ((NewClient.CalcReference.CalculationServiceInterface)(this)).getMultiplied(inValue);
        return retVal.restaurants;
    }

WSDL

<definitions xmlns:import0="urn:lijo:demos:multiplyservice:messages:v1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:import1="urn:lijo:demos:multiplyservice:data:v1" xmlns:tns="urn:lijo:demos:multiplyservice:calculation:v1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="CalculationService" targetNamespace="urn:lijo:demos:multiplyservice:calculation:v1" xmlns="http://schemas.xmlsoap.org/wsdl/">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
<types>
<xsd:schema>
  <xsd:import schemaLocation="C:\toolbox\LijosServiceApp\NewService\RestaurantMessages.xsd" namespace="urn:lijo:demos:multiplyservice:messages:v1" />
  <xsd:import schemaLocation="C:\toolbox\LijosServiceApp\NewService\RestaurantData.xsd" namespace="urn:lijo:demos:multiplyservice:data:v1" />
  </xsd:schema>
 </types>
 <message name="getMultipliedIn">
 <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
 <part name="parameters" element="import0:getMultiplied" />
 </message>
 <message name="getMultipliedOut">
 <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
 <part name="parameters" element="import0:getMultipliedResponse" />
 </message>
 <portType name="CalculationServiceInterface">
  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
  <operation name="getMultiplied">
  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
  <input message="tns:getMultipliedIn" />
  <output message="tns:getMultipliedOut" />
  </operation>
  </portType>
  <binding name="BasicHttpBinding_CalculationServiceInterface" type="tns:CalculationServiceInterface">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
  <operation name="getMultiplied">
  <soap:operation soapAction="urn:lijo:demos:multiplyservice:calculation:v1:getMultipliedIn" style="document" />
  <input>
    <soap:body use="literal" />
  </input>
  <output>
    <soap:body use="literal" />
  </output>
  </operation>
  </binding>
  <service name="CalculationServicePort">
  <port name="CalculationServicePort" binding="tns:BasicHttpBinding_CalculationServiceInterface">
  <soap:address location="http://localhost/CalculationService" />
  </port>
  </service>
  </definitions>

XSD

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="RestaurantData" targetNamespace="urn:lijo:demos:multiplyservice:data:v1"
elementFormDefault="qualified" xmlns="urn:lijo:demos:multiplyservice:data:v1"
xmlns:mstns="urn:lijo:demos:multiplyservice:data:v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">

 <xs:complexType name="multipliedResult">
 <xs:sequence>
  <xs:element name="resultNumber" type="xs:int" />
 </xs:sequence>
 </xs:complexType>
 </xs:schema>

Cleint Config (Автогенерируемая)

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_CalculationServiceInterface"
                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="524288" maxStringContentLength="524288" maxArrayLength="524288"
                    maxBytesPerRead="524288" maxNameTableCharCount="524288" />
                <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost/CalculationService" binding="basicHttpBinding"
            bindingConfiguration="BasicHttpBinding_CalculationServiceInterface"
            contract="CalcReference.CalculationServiceInterface" name="CalculationServicePort" />
    </client>
</system.serviceModel>

Ответы на вопрос(1)

Ваш ответ на вопрос