OK, to doprowadza mnie do szaleństwa. Próbowałem zbudować kod wdrożenia usługi z predefiniowanej WSDL i jest konsekwentnie powrocie wiadomość na umowy o świadczenie usług/interfejs:Generowanie kodu z WSDL w WCF powoduje, że powracający komunikat nie jest zgodny z domyślną wartością
// CODEGEN: Generating message contract since the wrapper name (GetMetricsRequest) of message GetMetricsRequest does not match the default value (GetMetrics)
[System.ServiceModel.OperationContractAttribute(Action="GetMetrics", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
GetMetricsResponse GetMetrics(GetMetricsRequest request);
Próbowałem to zrobić przy użyciu svcutil.exe i generowanie usługi WSCF za kreatora kodu, a oba zwracają ten sam wynik.
Poniżej znajduje się WSDL, którego używam. Dodałem typy tutaj, mam je podzielone na oddzielne xsd, po prostu nie chciałem opublikować obu. Użycie tego klucza wsdl (z wszystkimi typami osadzonymi) generuje te same problemy.
Sprawdziłem ten wpis na blogu (http://pzf.fremantle.org/2007/05/handlign.html), to wszystko, co mogę znaleźć w odniesieniu do tego problemu. Myślę, że zrobiłem wszystko, co powinienem zrobić, ale nadal mam problemy.
Czy ktoś inny się z tym spotkał? To bardzo irytujące, może brakuje mi czegoś oczywistego. Każda pomoc zostanie bardzo doceniona.
<wsdl:definitions
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:MyNameSpace:V1_0"
targetNamespace="urn:MyNameSpace:V1_0">
<wsdl:types>
<xs:schema targetNamespace="urn:MyNameSpace:V1_0">
<xs:element name="GetMetricsRequest">
<xs:complexType>
<xs:sequence>
<xs:element nillable="true" name="GetMetricRequestElement" type="tns:GetMetricRequestType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetMetricResponse">
<xs:complexType>
<xs:sequence>
<xs:element nillable="true" maxOccurs="unbounded" name="GetMetricResponseElement" type="tns:GetMetricResponseType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="GetMetricResponseType">
<xs:sequence>
<xs:element nillable="true" name="Metrics" type="tns:MetricsType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="GetMetricRequestType">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="MetricCriteria" nillable="true" type="tns:MetricCriteriaType"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="AvailableMetricType">
<xs:restriction base="xs:string">
<xs:enumeration value="MetricType1"/>
<xs:enumeration value="MetricType2"/>
<xs:enumeration value="MetricType3"/>
<xs:enumeration value="MetricType4"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="AvailableMetricsType">
<xs:sequence>
<xs:element minOccurs="1" nillable="true" maxOccurs="unbounded" name="MetricType" type="tns:AvailableMetricType"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="MetricDimensionType">
<xs:restriction base="xs:string">
<xs:enumeration value="Store"/>
<xs:enumeration value="Workgroup"/>
<xs:enumeration value="BusinessDate"/>
<xs:enumeration value="JobClass"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="MetricDimensionsType">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="unbounded" nillable="true" name="MetricDimension" type="tns:MetricDimensionType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MetricCriteriaType">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="storeNumber" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="workgroup" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="jobClass" nillable="true" type="xs:string"/>
<xs:element maxOccurs="1" nillable="true" name="dateStart" type="xs:dateTime"/>
<xs:element maxOccurs="1" nillable="true" name="dateEnd" type="xs:dateTime"/>
<xs:element maxOccurs="1" name="dimensions" nillable="true" type="tns:MetricDimensionsType"/>
<xs:element maxOccurs="1" name="metricTypes" nillable="true" type="tns:AvailableMetricsType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MetricType">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="businessDate" nillable="true" type="xs:dateTime"/>
<xs:element minOccurs="0" maxOccurs="1" name="store" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="workgroup" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="jobClass" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="metricValue" nillable="true" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="MetricsType">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Metric" nillable="true" type="tns:MetricType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="GetMetricsRequestMessage">
<wsdl:part name="parameters" element="tns:GetMetricsRequest"/>
</wsdl:message>
<wsdl:message name="GetMetricsResponseMessage">
<wsdl:part name="parameters" element="tns:GetMetricResponse"/>
</wsdl:message>
<wsdl:portType name="Metric">
<wsdl:operation name="GetMetrics">
<wsdl:input message="tns:GetMetricsRequestMessage"/>
<wsdl:output message="tns:GetMetricsResponseMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MetricService" type="tns:Metric">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="GetMetrics">
<soap:operation soapAction="GetMetrics" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Metric">
<wsdl:port name="GetMetrics" binding="tns:MetricService">
<soap:address location="http://myurl/myproj/1.0/MyService.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Dzięki marc_s,
OK, to wydawało się do pracy. To był tylko brakujący "s" w typie odpowiedzi. DOH!
Teraz kod serwisowy wydaje się generować dobrze, ale kiedy przeglądam moją usługę, nie ma umowy danych/xsd i nie ma operacji na kodzie wsdl.
To właśnie wygląda:
<wsdl:definitions name="MetricServiceImplementation" targetNamespace="http://tempuri.org/">
<wsdl:import namespace="urn:GiantEagle:Services:Systems::Metric:V1_0" location="http://localhost:2814/Services/MetricService.svc?wsdl=wsdl0"/>
<wsdl:types/>
<wsdl:binding name="BasicHttpBinding_MetricService" type="i0:MetricService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
</wsdl:binding>
<wsdl:service name="MetricServiceImplementation">
<wsdl:port name="BasicHttpBinding_MetricService" binding="tns:BasicHttpBinding_MetricService">
<soap:address location="http://localhost:2814/Services/MetricService.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
chciałbym oczekiwać, że wyglądają jak WSDL I wygenerowanego kodu z, nie?
myślę, że to jest związane z faktem, że masz do czynienia ze złożonymi typami – JohnIdol
Co znajduje się komunikat o błędzie otrzymujesz – RedDeckWins