从WSDL生成SOAP Web代理问题BizTalk VS2013

时间:2017-09-04 12:32:08

标签: soap xsd wsdl biztalk biztalk-2013

我在VS2013 BizTalk中使用此WDSL生成SOAP-Web-Proxy时出现问题。

似乎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>

这是一个错误还是有人能告诉我它为什么这样做?

它是根元素Name我的意思。

timeseriesValues

sendTemp或sendPreise。

请求是&#34; sendTemp&#34;或&#34; sendPreise&#34;但后来我遇到了序列化问题。

Schema定义:sendPreise type = timeseriesvalues sendTemp type = timeseriesvalues

但只有&#34; timeseriesvalues&#34; as root-element-Name有效。

2 个答案:

答案 0 :(得分:0)

我没有看到任何错误。

XML中的命名空间符合WSDL Error for v,pa(v): bp, oil List of 2 $ bp : chr [1:3] "low" "medium" "high" $ oil: chr [1:2] "low" "high" num [1:12] 0.9 0.1 0.1 0.9 0 1 0.1 0.9 0.4 0.6 ... Error in compileCPT(list(eh, oil.eh, inf.oil.eh, bp.oil, rt.inf.eh)) : Table dimensions do not match!

中的targetNameSpace

id被定义为WSDL中的字符串,因此也定义为模式。因此,当它生成它时,它将生成一个字符串示例。

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

时间序列下的值被定义为double(不是int),因此它是作为示例生成的

时间是日期时间,即生成的样本中的日期时间。

答案 1 :(得分:0)

如果使用Add&gt;从BizTalk项目添加该WSDL;添加生成的项目&gt;使用WCF服务,您将获得所需的XSD:

enter image description here

相关问题