我有附加的WSDL,我需要使用Visual Studio 2013,WCF和.NET 4.5生成客户端存根。我没有签名中的预期参数BoolExpression,而是获得了一个object []参数。生成的getResourceList服务方法如下所示:
link
虽然看起来像这样:
public TestFieldSOAP.ServiceReference1.ResourceWrapper[] getResourceList(long arg0, long arg1, object[] arg2, object[] arg3)
简而言之,实体BoolExpression在架构中定义,但未在方法中作为参数引用。我一直在研究WSDL和XSD,但到目前为止我还没有找到答案。
有什么想法吗?
WSDL
public TestFieldSOAP.ServiceReference1.ResourceWrapper[] getResourceList(long arg0, long arg1, BoolExpression be, object[] arg3)
这里也是生成的getResource方法存根的方法签名
<?xml version="1.0" ?>
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://ResourceManagementBasic.webservices.xxx.com/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:ns3="http://schemas.xmlsoap.org/soap/http"
xmlns:ns2="http://security.lowLevel.hello.webservices.xxx.com/"
xmlns:ns1="http://ResourceManagement.hello.xxx.com/" name="WSResourceAdmin_v15Service"
targetNamespace="http://ResourceManagementBasic.webservices.xxx.com/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://hello.xxx.com/" elementFormDefault="qualified"
targetNamespace="http://hello.xxx.com/" version="1.0">
<xs:complexType name="BoolExpression">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="expressions"
nillable="true" type="xs:anyType"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="AttributeOperatorValueExpression">
<xs:complexContent>
<xs:extension base="tns:BoolExpression">
<xs:sequence>
<xs:element name="attribute" nillable="true" type="xs:string"></xs:element>
<xs:element name="operator" nillable="true" type="xs:string"></xs:element>
<xs:element name="value" nillable="true" type="xs:anyType"></xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ANDExpression">
<xs:complexContent>
<xs:extension base="tns:BoolExpression">
<xs:sequence></xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Wrapper">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="value" nillable="true"
type="xs:anyType"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://Wrappers.hello.xxx.com" version="1.0">
<xs:complexType name="ResourceWrapper">
<xs:sequence>
<xs:element form="qualified" name="Resource" nillable="true" type="xs:long"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://ResourceManagementBasic.webservices.xxx.com/"
xmlns:ns6="http://Wrappers.hello.xxx.com" xmlns:ns1="http://hello.xxx.com/"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://ResourceManagementBasic.webservices.xxx.com/">
<xs:import namespace="http://hello.xxx.com/"></xs:import>
<xs:import namespace="http://Wrappers.hello.xxx.com"></xs:import>
<xs:element name="getResourceList" type="tns:getResourceList"></xs:element>
<xs:element name="getResourceListResponse" type="tns:getResourceListResponse"></xs:element>
<xs:complexType name="getResourceListResponse">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="return"
type="ns6:ResourceWrapper"></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="getResourceList">
<xs:sequence>
<xs:element minOccurs="0" name="arg0" type="xs:long"></xs:element>
<xs:element minOccurs="0" name="arg1" type="xs:long"></xs:element>
<xs:element minOccurs="0" name="arg2" type="ns1:BoolExpression" form="qualified"></xs:element>
<xs:element maxOccurs="unbounded" minOccurs="0" name="arg3" type="xs:anyType"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="getResourceListResponse">
<wsdl:part element="tns:getResourceListResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="getResourceList">
<wsdl:part element="tns:getResourceList" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="WSResourceAdmin_v15">
<wsdl:operation name="getResourceList">
<wsdl:input message="tns:getResourceList" name="getResourceList">
</wsdl:input>
<wsdl:output message="tns:getResourceListResponse" name="getResourceListResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WSResourceAdmin_v15ServiceSoapBinding"
type="tns:WSResourceAdmin_v15">
<soap12:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"></soap12:binding>
<wsdl:operation name="getResourceList">
<soap12:operation soapAction="" style="document"></soap12:operation>
<wsdl:input name="getResourceList">
<soap12:body use="literal"></soap12:body>
</wsdl:input>
<wsdl:output name="getResourceListResponse">
<soap12:body use="literal"></soap12:body>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WSResourceAdmin_v15Service">
<wsdl:port binding="tns:WSResourceAdmin_v15ServiceSoapBinding"
name="WSResourceAdmin_v15Port">
<soap12:address
location="xxx"></soap12:address>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
编辑2016年2月8日
似乎有效的固定是正确的:object []是BoolExpression类型中定义的anyType序列的结果。我读到删除BoolExpression命名空间的导入将导致svcutil生成器在生成的方法中包含BoolExpression作为参数。这会有用吗?或者你会建议使用另一种解决方法吗?当我从一个.NET错误运行到另一个
答案 0 :(得分:0)
它是如何定义wsdl的。 type =“**:anyType”的元素将映射到Object对象。