Question

Bonjour, je voudrais générer un certain contrat basé sur fichier WSDL. Je svcutil mais je soupçonne que ce produit mal que toutes les méthodes de contrat sont de type vide retourné. Est-il un outil à cet effet?

EDIT: voici le fichier wsdl:

    <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://dantek.com.pl/EDItEUR/EDItX/LibraryBookSupply/WebService/CustomerService/20100611/ServiceContract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" targetNamespace="http://mytargetNamespace/ServiceContract" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <xsd:schema targetNamespace="http://mytargetNamespace/ServiceContract/Imports">
      <xsd:import namespace="http http://mytargetNamespace/ServiceContract/ServiceContract" />
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="CustomerService_ProcessMethod_InputMessage">
    <wsdl:part name="parameters" element="tns:ProcessMethod" />
  </wsdl:message>
  <wsdl:message name="CustomerService_ProcessMethod_OutputMessage">
    <wsdl:part name="parameters" element="tns:ProcessMethodResponse" />
  </wsdl:message>
>
  <wsdl:portType name="CustomerService">
    <wsdl:operation name="ProcessShipNotice">
      <wsdl:input wsaw:Action=" http://mytargetNamespace/ServiceContract/ProcessMethod" message="tns:CustomerService_ProcessMethod_InputMessage" />
      <wsdl:output wsaw:Action=" http://mytargetNamespace/ServiceContract/ProcessMethod" message="tns:CustomerService_ProcessMethod_OutputMessage" />
    </wsdl:operation>
  </wsdl:portType>
</wsdl:definitions>

Et le contrat créé

[ServiceContract]
public interface CustomerService
{

    [System.ServiceModel.OperationContractAttribute(Action = "http://mytargetNamespace/ServiceContract/CustomerService/ProcessMethod”, ReplyAction = " http://mytargetNamespace/ServiceContract/CustomerService/ProcessMethodResponse")]
    [System.ServiceModel.XmlSerializerFormatAttribute()]
    void ProcessMethod(ProcessMethodRequest request);

Je ne veux pas avoir ProcessMethod retourné de type de type vide, mais plutôt ProcessMethodResponse. Comment puis-je y parvenir?

EDIT2: Voici mon schéma:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://myTargetNamespece/ServiceContract" elementFormDefault="qualified" 
     targetNamespace="http://myTargetNamespace/ServiceContract" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="ProcessMethod">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" name="request" type="tns:ProcessMethodRequest" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="ProcessMethodRequest" abstract="true" />
  <xs:complexType name="ProcessMethodRequestWithPayload"/>
  <xs:element name="ProcessMethodResponse">
    <xs:complexType />
  </xs:element>
</xs:schema>
Était-ce utile?

La solution

contrat d'exploitation généré est correct. L'opération de demande / réponse de vous WSDL (= deux voies) avec une réponse vide. élément ProcessMethodResponse est wrapper élément pour le message de réponse, mais il ne contient pas de réponse = sous-éléments sans effet.

Si vous voulez revenir ProcessMethodResponse vous devez utiliser des contrats de message. Vous pouvez demander svcutil aux contrats de message d'utilisation par / mc ou / MessageContract.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top