此供应商WSDL中的请求模型在哪里?

时间:2015-07-14 14:54:53

标签: wcf

我正在尝试批量创建供应商工具的用户帐户。我问供应商如何打开端点的MEX以创建单个帐户,并相应地调整了配置文件。

我能够创建服务引用,但我在Visual Studio中拥有的只是一个客户端和两个接口。我无法告诉如何创建请求。客户端有一个InvokeService方法,但只需要一个对象。

我在我的代码中复制了vendor类结构,但是服务不喜欢我的类型。所以,我更新了类以使用供应商的原始命名空间,但该服务仍然不喜欢它。

Type 'life.businessService.baseBusinessDataModel.BusinessRequest' with data contract name 'BusinessRequest:http://schemas.datacontract.org/2004/07/life.businessService.baseBusinessDataModel' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.

这是服务的WSDL。我在WCF方面不是很强,所以我希望得到一些指导。谢谢!

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ClientWcfBusinessFacadeService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsp:Policy wsu:Id="NetNamedPipeBinding_IWcfBusinessFacade_policy">
    <wsp:ExactlyOne>
      <wsp:All>
        <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1">
        </msb:BinaryEncoding>
        <wsaw:UsingAddressing>
        </wsaw:UsingAddressing>
      </wsp:All>
    </wsp:ExactlyOne>
  </wsp:Policy>
  <wsp:Policy wsu:Id="NetTcpBinding_IWcfBusinessFacade_policy">
    <wsp:ExactlyOne>
      <wsp:All>
        <msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1">
        </msb:BinaryEncoding>
        <wsaw:UsingAddressing>
        </wsaw:UsingAddressing>
      </wsp:All>
    </wsp:ExactlyOne>
  </wsp:Policy>
  <wsdl:types>
    <xsd:schema targetNamespace="http://tempuri.org/Imports">
      <xsd:import namespace="http://tempuri.org/" />
      <xsd:import namespace="http://schemas.datacontract.org/2004/07/life.common.serviceCommon" />
      <xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="IWcfBusinessFacade_InvokeService_InputMessage">
    <wsdl:part name="parameters" element="tns:InvokeService" />
  </wsdl:message>
  <wsdl:message name="IWcfBusinessFacade_InvokeService_OutputMessage">
    <wsdl:part name="parameters" element="tns:InvokeServiceResponse" />
  </wsdl:message>
  <wsdl:message name="IWcfBusinessFacade_InvokeService_ServiceFaultFault_FaultMessage">
    <wsdl:part xmlns:q1="http://schemas.datacontract.org/2004/07/life.common.serviceCommon" name="detail" element="q1:ServiceFault" />
  </wsdl:message>
  <wsdl:portType name="IWcfBusinessFacade">
    <wsdl:operation name="InvokeService">
      <wsdl:input wsaw:Action="http://tempuri.org/IWcfBusinessFacade/InvokeService" message="tns:IWcfBusinessFacade_InvokeService_InputMessage" />
      <wsdl:output wsaw:Action="http://tempuri.org/IWcfBusinessFacade/InvokeServiceResponse" message="tns:IWcfBusinessFacade_InvokeService_OutputMessage" />
      <wsdl:fault wsaw:Action="http://tempuri.org/IWcfBusinessFacade/InvokeServiceServiceFaultFault" name="ServiceFaultFault" message="tns:IWcfBusinessFacade_InvokeService_ServiceFaultFault_FaultMessage" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="NetNamedPipeBinding_IWcfBusinessFacade" type="tns:IWcfBusinessFacade">
    <wsp:PolicyReference URI="#NetNamedPipeBinding_IWcfBusinessFacade_policy">
    </wsp:PolicyReference>
    <soap12:binding transport="http://schemas.microsoft.com/soap/named-pipe" />
    <wsdl:operation name="InvokeService">
      <soap12:operation soapAction="http://tempuri.org/IWcfBusinessFacade/InvokeService" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
      <wsdl:fault name="ServiceFaultFault">
        <soap12:fault use="literal" name="ServiceFaultFault" namespace="" />
      </wsdl:fault>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="NetTcpBinding_IWcfBusinessFacade" type="tns:IWcfBusinessFacade">
    <wsp:PolicyReference URI="#NetTcpBinding_IWcfBusinessFacade_policy">
    </wsp:PolicyReference>
    <soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
    <wsdl:operation name="InvokeService">
      <soap12:operation soapAction="http://tempuri.org/IWcfBusinessFacade/InvokeService" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
      <wsdl:fault name="ServiceFaultFault">
        <soap12:fault use="literal" name="ServiceFaultFault" namespace="" />
        <soap12:fault use="literal" name="ServiceFaultFault" namespace="" />
      </wsdl:fault>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="ClientWcfBusinessFacadeService">
    <wsdl:port name="NetNamedPipeBinding_IWcfBusinessFacade" binding="tns:NetNamedPipeBinding_IWcfBusinessFacade">
      <soap12:address location="net.pipe://localhost/WcfBusinessFacadeService" />
      <wsa10:EndpointReference>
        <wsa10:Address>net.pipe://localhost/WcfBusinessFacadeService</wsa10:Address>
      </wsa10:EndpointReference>
    </wsdl:port>
    <wsdl:port name="NetTcpBinding_IWcfBusinessFacade" binding="tns:NetTcpBinding_IWcfBusinessFacade">
      <soap12:address location="net.tcp://localhost:8086/WcfBusinessFacadeService" />
      <wsa10:EndpointReference>
        <wsa10:Address>net.tcp://localhost:8086/WcfBusinessFacadeService</wsa10:Address>
      </wsa10:EndpointReference>
    </wsdl:port>
    <wsdl:port name="NetTcpBinding_IWcfBusinessFacade1" binding="tns:NetTcpBinding_IWcfBusinessFacade">
      <soap12:address location="net.tcp://localhost:10000/WcfBusinessFacadeService" />
      <wsa10:EndpointReference>
        <wsa10:Address>net.tcp://localhost:10000/WcfBusinessFacadeService</wsa10:Address>
      </wsa10:EndpointReference>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

1 个答案:

答案 0 :(得分:1)

对于InvokeService方法的输入消息,您需要传递tns:InvokeService中定义的对象。它将是命名空间http://tempuri.org/Imports中的一个类型,但未在此WSDL中显式公开;它来自另一个命名空间。您可以向供应商询问此WSDL期望从中导入类型的模式XSD或程序集,因为不包含绝对或甚至相对的schemaLocation属性

<xsd:import namespace="http://tempuri.org/" />
<xsd:import namespace="http://schemas.datacontract.org/2004/07/life.common.serviceCommon" />