Generating SOAP Web Proxy from WSDL Issue BizTalk VS2013

251 Views Asked by At

I have a problem by generating a SOAP-Web-Proxy using this WDSL in VS2013 BizTalk.

It seems VS doesn't generate a proper xsd and cs. When I generate an instance from the xsd it looks like this:

Generated by 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>

But it should be like this, to talk with the 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>

Is this a bug or can someone tell me why it does this?

It's the root-element Name what i meant.

timeseriesValues

sendTemp or sendPreise.

The request is either "sendTemp" or "sendPreise" but then i get a serialize-problem.

The Schema defines : sendPreise type=timeseriesvalues sendTemp type=timeseriesvalues

But only "timeseriesvalues" as root-element-Name works.

2

There are 2 best solutions below

0
On

I don't see any bug.

The namespace in the XML is as per the targetNameSpace in the WSDL "http://test.com/abc/DataService/xyz"

The id is defined as a string in the WSDL and hence the schema. So when it generates it, it will generate a string example.

res is defined as either being day or hour, so that is also correct.

The value under the timeseries is defined as a double (not an int) so that is what it generated as an example

time is a datetime, that is what it is in the generated sample.

0
On

If you add that WSDL from a BizTalk project with Add > Add Generated Items > Consume WCF Service, you will get the XSD as you want:

enter image description here