2017-09-04 74 views
1

通过在VS2013 BizTalk中使用此WDSL生成SOAP-Web代理,我遇到了问题。从WSDL生成SOAP Web代理问题BizTalk VS2013

看来VS不会生成正确的xsd和cs。当我从XSD生成实例,它看起来像这样:

由VS生成:

<ns0:timeseriesValues xmlns:ns0="http://test.com/abc/DataService/xyz"> 
    <ns0:id>mdsId_0</ns0:id> 
    <ns0:res>day</ns0:res> 
    <ns0:quality>prognosis</ns0:quality> 
    <ns0:timeseries> 
    <ns0:time>1999-05-31T13:20:00.000-05:00</ns0:time> 
    <ns0:value>10</ns0:value> 
    </ns0:timeseries> 
    <ns0:timeseries> 
    <ns0:time>1999-05-31T13:20:00.000-05:00</ns0:time> 
    <ns0:value>10</ns0:value> 
    </ns0:timeseries> 
    <ns0:timeseries> 
    <ns0:time>1999-05-31T13:20:00.000-05:00</ns0:time> 
    <ns0:value>10</ns0:value> 
    </ns0:timeseries> 
</ns0:timeseriesValues> 

但它应该是这样的,与WS谈:

<ns0:sendTemp xmlns:ns0="http://www.test.com/DataService.xsd"> 
    <ns0:id>138846</ns0:id> 
    <ns0:res>hour</ns0:res> 
    <ns0:quality>prognosis</ns0:quality> 
    <ns0:timeseries> 
     <ns0:time>2017-08-27T23:00:00+02:00</ns0:time> 
     <ns0:value>16.7</ns0:value> 
    </ns0:timeseries> 
    <ns0:timeseries> 
     <ns0:time>2017-08-28T00:00:00+02:00</ns0:time> 
     <ns0:value>16</ns0:value> 
    </ns0:timeseries> 
</ns0:sendTemp> 

WSDL:

<?xml version='1.0' encoding='UTF-8'?> 
<wsdl:definitions 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:ns="http://www.test.com/DataService.xsd" 
    xmlns:wsc="http://www.test.com/DataService.xsd" 
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
    targetNamespace="http://www.test.com/DataService.xsd"> 
    <wsdl:types> 
    <xs:schema 
     xmlns="http://test.com/abc/DataService/xyz" 
     attributeFormDefault="unqualified" 
     elementFormDefault="qualified" 
     targetNamespace="http://test.com/abc/DataService/xyz">  
     <xs:complexType name="timeseriesValues"> 
     <xs:sequence> 
      <xs:element name="id" type="xs:string" /> 
      <xs:element name="res"> 
      <xs:simpleType> 
       <xs:restriction base="xs:string"> 
       <xs:enumeration value="day" /> 
       <xs:enumeration value="hour" /> 
       </xs:restriction> 
      </xs:simpleType> 
      </xs:element> 
      <xs:element name="quality" minOccurs="0"> 
      <xs:simpleType> 
       <xs:restriction base="xs:string"> 
       <xs:enumeration value="prognosis"/> 
       <xs:enumeration value="allocation"/> 
       </xs:restriction> 
      </xs:simpleType>  
      </xs:element> 
      <xs:element maxOccurs="unbounded" minOccurs="0" name="timeseries"> 
      <xs:complexType> 
       <xs:sequence> 
       <xs:element name="time" type="xs:dateTime" /> 
       <xs:element name="value" type="xs:double" /> 
       </xs:sequence> 
      </xs:complexType> 
      </xs:element> 
     </xs:sequence> 
     </xs:complexType> 
    </xs:schema> 
    <xs:schema 
     xmlns:xs="http://www.w3.org/2001/XMLSchema" 
     xmlns="http://www.test.com/DataService.xsd" 
     xmlns:xyz="http://test.com/abc/DataService/xyz" 
     attributeFormDefault="qualified" 
     elementFormDefault="qualified" 
     targetNamespace="http://www.test.com/DataService.xsd"> 
     <xs:import namespace="http://test.com/abc/DataService/xyz" /> 
     <xs:element name="sendPreise" type="xyz:timeseriesValues" /> 
     <xs:element name="sendPreiseResponse" type="xs:anyType" /> 
     <xs:element name="sendTemp" type="xyz:timeseriesValues" /> 
     <xs:element name="sendTempResponse" type="xs:anyType" />  
    </xs:schema> 
    </wsdl:types> 
    <wsdl:message name="sendTempResponse"> 
    <wsdl:part name="sendTempResponse" element="wsc:sendTempResponse"> 
    </wsdl:part> 
    </wsdl:message> 
    <wsdl:message name="sendTemp"> 
    <wsdl:part name="parameters" element="ns:sendTemp"> 
    </wsdl:part> 
    </wsdl:message> 
    <wsdl:message name="sendPreise"> 
    <wsdl:part name="parameters" element="ns:sendPreise"> 
    </wsdl:part> 
    </wsdl:message> 
    <wsdl:message name="sendPreiseResponse"> 
    <wsdl:part name="sendPreiseResponse" element="wsc:sendPreiseResponse"> 
    </wsdl:part> 
    </wsdl:message> 
    <wsdl:portType name="event_PortType"> 
    <wsdl:operation name="sendPreise"> 
     <wsdl:input name="sendPreise" message="wsc:sendPreise"> 
     </wsdl:input> 
     <wsdl:output name="sendPreiseResponse" message="wsc:sendPreiseResponse"> 
     </wsdl:output> 
    </wsdl:operation> 
    <wsdl:operation name="sendTemp"> 
     <wsdl:input name="sendTemp" message="wsc:sendTemp"> 
     </wsdl:input> 
     <wsdl:output name="sendTempResponse" message="wsc:sendTempResponse"> 
     </wsdl:output> 
    </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="event_Binding" type="wsc:event_PortType"> 
    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
    <wsdl:operation name="sendPreise"> 
     <wsdlsoap:operation soapAction="sendPreise" /> 
     <wsdl:input name="sendPreise"> 
     <wsdlsoap:body parts="parameters" use="literal" /> 
     </wsdl:input> 
     <wsdl:output name="sendPreiseResponse"> 
     <wsdlsoap:body parts="sendPreiseResponse" use="literal" /> 
     </wsdl:output> 
    </wsdl:operation> 
    <wsdl:operation name="sendTemp"> 
     <wsdlsoap:operation soapAction="sendTemp" /> 
     <wsdl:input name="sendTemp"> 
     <wsdlsoap:body parts="parameters" use="literal" /> 
     </wsdl:input> 
     <wsdl:output name="sendTempResponse"> 
     <wsdlsoap:body parts="sendTempResponse" use="literal" /> 
     </wsdl:output> 
    </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:service name="event"> 
    <wsdl:port name="event_Port" binding="wsc:event_Binding"> 
     <wsdlsoap:address location="http://TEST:80/WS/" /> 
    </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 

这是一个错误,或可以告诉我为什么这样做?

这是根元素名称我的意思。

时间序列值

sendTemp或sendPreise。

该请求是“sendTemp”或“sendPreise”,但然后我得到序列化问题。

模式定义:sendPreise类型= timeseriesvalues sendTemp类型= timeseriesvalues

但是,只有 “timeseriesvalues” 作为根元素名称的工作原理。

+0

究竟是什么你的问题是什么?该id被定义为一个字符串,因此在生成实例时的行为与预期相同。其他领域是什么问题? – Dijkgraaf

+0

如果我使用我向您回答的选项(添加>添加生成的项目>使用WCF服务)生成实例,它会生成此XML xyz:id_0 ... In this not what you need? – felixmondelo

回答

0

我没有看到任何错误。

在XML命名空间是按照的targetNamespace在WSDL "http://test.com/abc/DataService/xyz"

的ID被定义为在WSDL的字符串,因此架构。所以当它生成它时,它会生成一个字符串示例。

res被定义为日或小时,所以这也是正确的。

值时间序列下被定义为双(不是int),所以这是它产生作为一个例子

时间是日期时间,这是它是将所生成的样本。

0

如果从添加BizTalk项目添加WSDL>添加生成项目>使用WCF服务,您将得到XSD,只要你想:

enter image description here