Partager via


Now Available: Aaron's new Service Factory article on MSDN

Steven just told me that Aaron Skonnard's latest Service Factory article about the December release was just published through his Service Station column in the MSDN Magazine. Talk about timing ... sweet. 

Even though it was written and finished before we locked down the code, it is still very accurate and comprehensive. I mean, it's Aaron ... what else would you expect?! There a few minor places where we changed the code out from under him so if you have a question about anything in it, feel free to leave a comment here and I'll field it.

Oh, and if you're building ASMX services, be sure to check out his first Service Factory article about the July (ASMX) release.

Great job Aaron!

Comments

  • Anonymous
    March 27, 2007
    Be sure you defined a namespace when you created the DataContracts. The targetNamespace you've listed is for the WSDL document. From that IE page, click on the "service description" link so you can see the actual WSDL document. Inside that doc, look for the element <wsdl:description><wsdl:types><xs:schema> and make sure it has a targetNamespace attribute that is something other than "". As the error states, your wsdl:types section might be using an xs:import that is causing it to break compliance. Hope this helps.

  • Anonymous
    March 28, 2007
    I found it.  I figured out what you meant with the datatypes.  All of them had a NameSpace="". Thank you very much for your help.

  • Anonymous
    April 01, 2007
    It worked once before so I'm going to the well once again :) I have a DataType (Trip) defined that has a DataType (Months) array as one of its properties.  An array of Trips is returned to the client, and each Trip should contain one or more Months.  When I debug the code, the Month array is getting populated and retains its elements up to and including the return statement that returns the Trips to the client.  Yet, in the client, although the Trip array is populated, its child Months array is not.  It contains no elements. I am wondering if I have the declaration wrong with regard to XML decoration/attributes.  The response definition appears below. HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">  <soap:Body>    <TripListByCompanyRS xmlns="http://Myco.MyApp.ServiceContracts/2007/03">      <Status>string</Status>      <Trips>        <Trip>          <tripID xmlns="">int</tripID>          <tripName xmlns="">string</tripName>          <tripCode xmlns="">string</tripCode>          <tripTypeID xmlns="">int</tripTypeID>          <tripDuration xmlns="">string</tripDuration>          <tripNotes xmlns="">string</tripNotes>          <tripFrequency xmlns="">string</tripFrequency>          <tripDescription xmlns="">string</tripDescription>          <tripNumDays xmlns="">short</tripNumDays>          <tripURL xmlns="">string</tripURL>          <tripPrice xmlns="">decimal</tripPrice>          <tripPriceDescription xmlns="">string</tripPriceDescription>          <companyID xmlns="">int</companyID>          <Months xmlns="">            <monthNumber>int</monthNumber>            <monthName>string</monthName>          </Months>          <Months xmlns="">            <monthNumber>int</monthNumber>            <monthName>string</monthName>          </Months>          <Departures xmlns="">            <tripDepartureID>int</tripDepartureID>            <tripID>int</tripID>            <tripDepartureStartDate>dateTime</tripDepartureStartDate>            <tripDepartureMaxPassengers>short</tripDepartureMaxPassengers>            <tripDepartureComments>string</tripDepartureComments>            <tripDepartureEndDate>dateTime</tripDepartureEndDate>            <tripDepartureLength>int</tripDepartureLength>            <tripDepartureMinPassengers>short</tripDepartureMinPassengers>            <tripDepartureCode>string</tripDepartureCode>          </Departures>          <Departures xmlns="">            <tripDepartureID>int</tripDepartureID>            <tripID>int</tripID>            <tripDepartureStartDate>dateTime</tripDepartureStartDate>            <tripDepartureMaxPassengers>short</tripDepartureMaxPassengers>            <tripDepartureComments>string</tripDepartureComments>            <tripDepartureEndDate>dateTime</tripDepartureEndDate>            <tripDepartureLength>int</tripDepartureLength>            <tripDepartureMinPassengers>short</tripDepartureMinPassengers>            <tripDepartureCode>string</tripDepartureCode>          </Departures>        </Trip>        <Trip>          <tripID xmlns="">int</tripID>          <tripName xmlns="">string</tripName>          <tripCode xmlns="">string</tripCode>          <tripTypeID xmlns="">int</tripTypeID>          <tripDuration xmlns="">string</tripDuration>          <tripNotes xmlns="">string</tripNotes>          <tripFrequency xmlns="">string</tripFrequency>          <tripDescription xmlns="">string</tripDescription>          <tripNumDays xmlns="">short</tripNumDays>          <tripURL xmlns="">string</tripURL>          <tripPrice xmlns="">decimal</tripPrice>          <tripPriceDescription xmlns="">string</tripPriceDescription>          <companyID xmlns="">int</companyID>          <Months xmlns="">            <monthNumber>int</monthNumber>            <monthName>string</monthName>          </Months>          <Months xmlns="">            <monthNumber>int</monthNumber>            <monthName>string</monthName>          </Months>          <Departures xmlns="">            <tripDepartureID>int</tripDepartureID>            <tripID>int</tripID>            <tripDepartureStartDate>dateTime</tripDepartureStartDate>            <tripDepartureMaxPassengers>short</tripDepartureMaxPassengers>            <tripDepartureComments>string</tripDepartureComments>            <tripDepartureEndDate>dateTime</tripDepartureEndDate>            <tripDepartureLength>int</tripDepartureLength>            <tripDepartureMinPassengers>short</tripDepartureMinPassengers>            <tripDepartureCode>string</tripDepartureCode>          </Departures>          <Departures xmlns="">            <tripDepartureID>int</tripDepartureID>            <tripID>int</tripID>            <tripDepartureStartDate>dateTime</tripDepartureStartDate>            <tripDepartureMaxPassengers>short</tripDepartureMaxPassengers>            <tripDepartureComments>string</tripDepartureComments>            <tripDepartureEndDate>dateTime</tripDepartureEndDate>            <tripDepartureLength>int</tripDepartureLength>            <tripDepartureMinPassengers>short</tripDepartureMinPassengers>            <tripDepartureCode>string</tripDepartureCode>          </Departures>        </Trip>      </Trips>    </TripListByCompanyRS>  </soap:Body> </soap:Envelope>

  • Anonymous
    April 02, 2007
    I have a little more info now.  I wrote a test stub to return only one trip object, instead of an array.  The months do appear in the response, but they are appearing incorrectly.  They should be <Months><month></month><month></month><Months>, but instead look like the following.  <?xml version="1.0" encoding="utf-8" ?>

  • <TripByTripIDRS xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://MyCo.MyService.ServiceContracts/2007/03">  <Status>Status_Ok</Status>
  • <Trip>  <tripName xmlns="">Super Trip</tripName>  <tripCode xmlns="">ST12345</tripCode>  <tripDuration xmlns="">365</tripDuration>  <tripNotes xmlns="" />  <tripFrequency xmlns="">Every Day</tripFrequency>  <tripDescription xmlns="" />  <tripURL xmlns="" />  <tripPriceDescription xmlns="">Because</tripPriceDescription>  <companyID xmlns="">0</companyID>
  • <Months xmlns="">  <monthNumber>4</monthNumber>  <monthName>April</monthName>  </Months>
  • <Months xmlns="">  <monthNumber>5</monthNumber>  <monthName>May</monthName>  </Months>
  • <Months xmlns="">  <monthNumber>6</monthNumber>  <monthName>June</monthName>  </Months>  </Trip>  </TripByTripIDRS>
  • Anonymous
    April 02, 2007
    Thanks for letting think this through on your blog.  I got it.  Unfortunately, I'm not really sure what combination of things did the trick.  I just changed [System.Xml.Serialization.XmlElementAttribute("Months", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] to [System.Xml.Serialization.XmlArray()] on my Months array property declaration in my trip class and bingo.