Loading ...
Sorry, an error occurred while loading the content.
 

.NET SOAP throwing "String was not recognized as a valid DateTime." error

Expand Messages
  • y_trafficstrategies
    I am attempting to implement Yahoo s new EWS API and I ve run into a roadblock. When .NET attempts to deserialize the SOAP message, it Throws-up on Date
    Message 1 of 6 , Dec 13, 2006
      I am attempting to implement Yahoo's new EWS API and I've run into a
      roadblock. When .NET attempts to deserialize the SOAP message, it
      Throws-up on Date fields. I can successfully parses the specified date
      string using
      System.Xml.Serialization.XmlSerializationReader.ToDateTime("2006-12-07T13:35:55.865-08:00").
      My computer's location is US_en and I have this entry in my app.config
      file
      <configuration>
      <system.web>
      <globalization culture="en-US" uiCulture="en-US" />

      Here is the stack trace:
      There is an error in XML document (1, 1148). --->
      System.FormatException: String was not recognized as a valid DateTime.
      at System.DateTimeParse.ParseExactMultiple(String s, String[]
      formats, DateTimeFormatInfo dtfi, DateTimeStyles style, DateTime& result)
      at System.DateTime.ParseExact(String s, String[] formats,
      IFormatProvider provider, DateTimeStyles style)
      at System.Xml.XmlConvert.ToDateTime(String s, String[] formats)
      at System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String
      value, String[] formats)
      at System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String value)
      at
      System.Xml.Serialization.XmlSerializationReader.ToDateTime(String value)
      at
      Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCampaignServiceService.Read1_Campaign(Boolean
      isNullable, Boolean checkType)
      at
      Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCampaignServiceService.Read4_CampaignResponse(Boolean
      isNullable, Boolean checkType)
      at
      Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCampaignServiceService.Read77_updateCampaignResponse()
      at
      Microsoft.Xml.Serialization.GeneratedAssembly.updateCampaignResponseSerializer.Deserialize(XmlSerializationReader
      reader)
      at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
      xmlReader, String encodingStyle, XmlDeserializationEvents events)
      at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
      xmlReader, XmlDeserializationEvents events)
      at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
      xmlReader)
      at
      System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
      message, WebResponse response, Stream responseStream, Boolean asyncCall)
      at
      System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
      methodName, Object[] parameters)
      at CampaignServiceService.updateCampaign(Campaign campaign, Boolean
      updateAll)

      Here is the request SOAP XML:
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Header>
      <accountID
      xmlns="http://marketing.ews.yahooapis.com/V1">12345</accountID>
      <license
      xmlns="http://marketing.ews.yahooapis.com/V1">12345-678-910-111-12345abc</license>
      <masterAccountID
      xmlns="http://marketing.ews.yahooapis.com/V1">12345</masterAccountID>
      <Security xmlns="http://schemas.xmlsoap.org/ws/2002/07/secext">
      <UsernameToken xmlns="">
      <Username>username</Username>
      <Password>password</Password>
      </UsernameToken>
      </Security>
      </soap:Header>
      <soap:Body>
      <updateCampaign xmlns="http://marketing.ews.yahooapis.com/V1">
      <campaign>
      <ID>1245</ID>
      <accountID>12345</accountID>
      <advancedMatchON>true</advancedMatchON>
      <campaignOptimizationON>true</campaignOptimizationON>
      <contentMatchON>false</contentMatchON>
      <description>My first campaign</description>
      <name>Cessna</name>
      <sponsoredSearchON>true</sponsoredSearchON>
      <status>On</status>
      </campaign>
      <updateAll>false</updateAll>
      </updateCampaign>
      </soap:Body>
      </soap:Envelope>

      And here is the response SOAP XML:
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soap:Header>
      <yns:remainingQuota
      xmlns:yns="http://marketing.ews.yahooapis.com/V1">998</yns:remainingQuota>
      <yns:commandGroup
      xmlns:yns="http://marketing.ews.yahooapis.com/V1">Marketing</yns:commandGroup>
      <yns:timeTakenMillis
      xmlns:yns="http://marketing.ews.yahooapis.com/V1">94</yns:timeTakenMillis>
      <yns:sid
      xmlns:yns="http://marketing.ews.yahooapis.com/V1">sk1-sbxadservices-002.ysm.sk1.yahoo.com</yns:sid>
      <yns:stime xmlns:yns="http://marketing.ews.yahooapis.com/V1">Mon Dec
      11 09:27:42 PST 2006</yns:stime>
      </soap:Header>
      <soap:Body>
      <updateCampaignResponse xmlns="http://marketing.ews.yahooapis.com/V1">
      <out xmlns="http://marketing.ews.yahooapis.com/V1">
      <campaign>
      <ID>1245</ID>
      <accountID>12345</accountID>
      <advancedMatchON>true</advancedMatchON>
      <campaignOptimizationON>false</campaignOptimizationON>
      <contentMatchON>false</contentMatchON>
      <createTimestamp>2006-12-07T13:35:55.865-08:00</createTimestamp>
      <deleteTimestamp xsi:nil="true" />
      <description>My first campaign</description>
      <endDate xsi:nil="true" />
      <lastUpdateTimestamp>2006-12-11T09:27:42.895-08:00</lastUpdateTimestamp>
      <name>Cessna</name>
      <sponsoredSearchON>true</sponsoredSearchON>
      <startDate>2006-12-07T00:00:00-08:00</startDate>
      <status>On</status>
      <watchON>false</watchON>
      </campaign>
      <errors xsi:nil="true" />
      <operationSucceeded>true</operationSucceeded>
      </out>
      </updateCampaignResponse>
      </soap:Body></soap:Envelope>

      Any ideas?
    • Yahoo! Search Marketing Monkey
      I m guessing it s choking on the milliseconds. But I don t know enough about .NET implementations to provide a suggestion on a fix. There are probably other
      Message 2 of 6 , Dec 13, 2006
        I'm guessing it's choking on the milliseconds. But I don't know enough
        about .NET implementations to provide a suggestion on a fix. There are
        probably other folks on the list that do.

        Best,
        -Y!SM Monkey

        y_trafficstrategies wrote:
        > I am attempting to implement Yahoo's new EWS API and I've run into a
        > roadblock. When .NET attempts to deserialize the SOAP message, it
        > Throws-up on Date fields. I can successfully parses the specified date
        > string using
        > System.Xml.Serialization.XmlSerializationReader.ToDateTime("2006-12-07T13:35:55.865-08:00").
        > My computer's location is US_en and I have this entry in my app.config
        > file
        > <configuration>
        > <system.web>
        > <globalization culture="en-US" uiCulture="en-US" />
        >
        > Here is the stack trace:
        > There is an error in XML document (1, 1148). --->
        > System.FormatException: String was not recognized as a valid DateTime.
        > at System.DateTimeParse.ParseExactMultiple(String s, String[]
        > formats, DateTimeFormatInfo dtfi, DateTimeStyles style, DateTime& result)
        > at System.DateTime.ParseExact(String s, String[] formats,
        > IFormatProvider provider, DateTimeStyles style)
        > at System.Xml.XmlConvert.ToDateTime(String s, String[] formats)
        > at System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String
        > value, String[] formats)
        > at System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String value)
        > at
        > System.Xml.Serialization.XmlSerializationReader.ToDateTime(String value)
        > at
        > Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCampaignServiceService.Read1_Campaign(Boolean
        > isNullable, Boolean checkType)
        > at
        > Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCampaignServiceService.Read4_CampaignResponse(Boolean
        > isNullable, Boolean checkType)
        > at
        > Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCampaignServiceService.Read77_updateCampaignResponse()
        > at
        > Microsoft.Xml.Serialization.GeneratedAssembly.updateCampaignResponseSerializer.Deserialize(XmlSerializationReader
        > reader)
        > at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
        > xmlReader, String encodingStyle, XmlDeserializationEvents events)
        > at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
        > xmlReader, XmlDeserializationEvents events)
        > at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
        > xmlReader)
        > at
        > System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
        > message, WebResponse response, Stream responseStream, Boolean asyncCall)
        > at
        > System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
        > methodName, Object[] parameters)
        > at CampaignServiceService.updateCampaign(Campaign campaign, Boolean
        > updateAll)
        >
        > Here is the request SOAP XML:
        > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        > xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        > <soap:Header>
        > <accountID
        > xmlns="http://marketing.ews.yahooapis.com/V1">12345</accountID>
        > <license
        > xmlns="http://marketing.ews.yahooapis.com/V1">12345-678-910-111-12345abc</license>
        > <masterAccountID
        > xmlns="http://marketing.ews.yahooapis.com/V1">12345</masterAccountID>
        > <Security xmlns="http://schemas.xmlsoap.org/ws/2002/07/secext">
        > <UsernameToken xmlns="">
        > <Username>username</Username>
        > <Password>password</Password>
        > </UsernameToken>
        > </Security>
        > </soap:Header>
        > <soap:Body>
        > <updateCampaign xmlns="http://marketing.ews.yahooapis.com/V1">
        > <campaign>
        > <ID>1245</ID>
        > <accountID>12345</accountID>
        > <advancedMatchON>true</advancedMatchON>
        > <campaignOptimizationON>true</campaignOptimizationON>
        > <contentMatchON>false</contentMatchON>
        > <description>My first campaign</description>
        > <name>Cessna</name>
        > <sponsoredSearchON>true</sponsoredSearchON>
        > <status>On</status>
        > </campaign>
        > <updateAll>false</updateAll>
        > </updateCampaign>
        > </soap:Body>
        > </soap:Envelope>
        >
        > And here is the response SOAP XML:
        > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        > <soap:Header>
        > <yns:remainingQuota
        > xmlns:yns="http://marketing.ews.yahooapis.com/V1">998</yns:remainingQuota>
        > <yns:commandGroup
        > xmlns:yns="http://marketing.ews.yahooapis.com/V1">Marketing</yns:commandGroup>
        > <yns:timeTakenMillis
        > xmlns:yns="http://marketing.ews.yahooapis.com/V1">94</yns:timeTakenMillis>
        > <yns:sid
        > xmlns:yns="http://marketing.ews.yahooapis.com/V1">sk1-sbxadservices-002.ysm.sk1.yahoo.com</yns:sid>
        > <yns:stime xmlns:yns="http://marketing.ews.yahooapis.com/V1">Mon Dec
        > 11 09:27:42 PST 2006</yns:stime>
        > </soap:Header>
        > <soap:Body>
        > <updateCampaignResponse xmlns="http://marketing.ews.yahooapis.com/V1">
        > <out xmlns="http://marketing.ews.yahooapis.com/V1">
        > <campaign>
        > <ID>1245</ID>
        > <accountID>12345</accountID>
        > <advancedMatchON>true</advancedMatchON>
        > <campaignOptimizationON>false</campaignOptimizationON>
        > <contentMatchON>false</contentMatchON>
        > <createTimestamp>2006-12-07T13:35:55.865-08:00</createTimestamp>
        > <deleteTimestamp xsi:nil="true" />
        > <description>My first campaign</description>
        > <endDate xsi:nil="true" />
        > <lastUpdateTimestamp>2006-12-11T09:27:42.895-08:00</lastUpdateTimestamp>
        > <name>Cessna</name>
        > <sponsoredSearchON>true</sponsoredSearchON>
        > <startDate>2006-12-07T00:00:00-08:00</startDate>
        > <status>On</status>
        > <watchON>false</watchON>
        > </campaign>
        > <errors xsi:nil="true" />
        > <operationSucceeded>true</operationSucceeded>
        > </out>
        > </updateCampaignResponse>
        > </soap:Body></soap:Envelope>
        >
        > Any ideas?
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
      • Brian Graves
        The only problems I ve had in .NET (so far) regarding time was initializing the report request structure. The problem involved the timezone and I got it to
        Message 3 of 6 , Dec 13, 2006

          The only problems I’ve had in .NET (so far) regarding time was initializing the report request structure.  The problem involved the timezone and I got it to work using the following code:

          _ReportRequest.startDate = eachDate.Year.ToString() + "-" + eachDate.Month.ToString().PadLeft(2, "0") + "-" + eachDate.Day.ToString().PadLeft(2, "0") + "T00:00:00-08:00"

          _ReportRequest.startDateSpecified = True

          _ReportRequest.endDate = _ReportRequest.startDate

          _ReportRequest.endDateSpecified = True

           

          I haven’t tried deserializing a SOAP message since I am getting/setting Campaign fields directly accessing the API.  For the start and end date of a Campaign, I use System.DateTime.

           


          From: yws-searchmarketing@yahoogroups.com [mailto:yws-searchmarketing@yahoogroups.com] On Behalf Of Yahoo! Search Marketing Monkey
          Sent: Wednesday, December 13, 2006 3:11 PM
          To: yws-searchmarketing@yahoogroups.com
          Subject: Re: [yws-searchmarketing] .NET SOAP throwing "String was not recognized as a valid DateTime." error

           

          I'm guessing it's choking on the milliseconds. But I don't know enough
          about .NET implementations to provide a suggestion on a fix. There are
          probably other folks on the list that do.

          Best,
          -Y!SM Monkey

          y_trafficstrategies wrote:

          > I am attempting to implement Yahoo's new EWS API and I've run into a
          > roadblock. When .NET attempts to deserialize the SOAP message, it
          > Throws-up on Date fields. I can successfully parses the specified date
          > string using
          > System.Xml.Serializ ation.XmlSeriali zationReader. ToDateTime( "2006-12- 07T13:35: 55.865-08: 00").
          > My computer's location is US_en and I have this entry in my app.config
          > file
          > <configuration>
          > <system.web>
          > <globalization culture="en- US" uiCulture="en- US"
          />
          >
          > Here is the stack trace:
          > There is an error in XML document (1, 1148). --->
          > System.FormatExcept ion: String was not recognized as a valid
          DateTime.
          > at System.DateTimePars e.ParseExactMult iple(String s, String[]
          > formats, DateTimeFormatInfo dtfi, DateTimeStyles style, DateTime&
          result)
          > at System.DateTime. ParseExact( String s, String[] formats,
          > IFormatProvider provider, DateTimeStyles style)
          > at System.Xml.XmlConve rt.ToDateTime( String s, String[] formats)
          > at System.Xml.Serializ ation.XmlCustomF ormatter. ToDateTime( String
          > value, String[] formats)
          > at System.Xml.Serializ ation.XmlCustomF ormatter. ToDateTime( String
          value)
          > at
          > System.Xml.Serializ ation.XmlSeriali zationReader. ToDateTime( String
          value)
          > at
          > Microsoft.Xml. Serialization. GeneratedAssembl y.XmlSerializati onReaderCampaign ServiceService. Read1_Campaign( Boolean
          > isNullable, Boolean checkType)
          > at
          > Microsoft.Xml. Serialization. GeneratedAssembl y.XmlSerializati onReaderCampaign ServiceService. Read4_CampaignRe sponse(Boolean
          > isNullable, Boolean checkType)
          > at
          > Microsoft.Xml. Serialization. GeneratedAssembl y.XmlSerializati onReaderCampaign ServiceService. Read77_updateCam paignResponse( )
          > at
          > Microsoft.Xml. Serialization. GeneratedAssembl y.updateCampaign ResponseSerializ er.Deserialize( XmlSerialization Reader
          > reader)
          > at System.Xml.Serializ ation.XmlSeriali zer.Deserialize( XmlReader
          > xmlReader, String encodingStyle, XmlDeserializationE vents events)
          > at System.Xml.Serializ ation.XmlSeriali zer.Deserialize( XmlReader
          > xmlReader, XmlDeserializationE vents events)
          > at System.Xml.Serializ ation.XmlSeriali zer.Deserialize( XmlReader
          > xmlReader)
          > at
          > System.Web.Services .Protocols. SoapHttpClientPr otocol.ReadRespo nse(SoapClientMe ssage
          > message, WebResponse response, Stream responseStream, Boolean asyncCall)
          > at
          > System.Web.Services .Protocols. SoapHttpClientPr otocol.Invoke( String
          > methodName, Object[] parameters)
          > at CampaignServiceServ ice.updateCampai gn(Campaign campaign,
          Boolean
          > updateAll)
          >
          > Here is the request SOAP XML:
          > <soap:Envelope xmlns:soap="
          href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas. xmlsoap.org/ soap/envelope/"
          > xmlns:xsi="http://www.w3. org/2001/ XMLSchema- instance"
          > xmlns:xsd="http://www.w3. org/2001/ XMLSchema">
          > <soap:Header>
          > <accountID
          > xmlns="http://marketing. ews.yahooapis. com/V1">12345</accountID>
          > <license
          > xmlns="http://marketing. ews.yahooapis. com/V1">12345-678- 910-111-12345abc </license>
          > <masterAccountID
          > xmlns="http://marketing. ews.yahooapis. com/V1">12345</masterAcco untID>
          > <Security xmlns="
          href="http://schemas.xmlsoap.org/ws/2002/07/secext">http://schemas. xmlsoap.org/ ws/2002/07/ secext">
          > <UsernameToken xmlns="">
          > <Username>username< /Username>
          > <Password>password< /Password>
          > </UsernameToken>
          > </Security>
          > </soap:Header>
          > <soap:Body>
          > <updateCampaign xmlns="
          href="http://marketing.ews.yahooapis.com/V1">http://marketing. ews.yahooapis. com/V1">
          > <campaign>
          > <ID>1245</ID>
          > <accountID>12345< /accountID>
          > <advancedMatchON> true</advancedMa tchON>
          > <campaignOptimizati onON>true< /campaignOptimiz ationON>
          > <contentMatchON> false</contentMa tchON>
          > <description> My first campaign</descripti on>
          > <name>Cessna< /name>
          > <sponsoredSearchON> true</sponsoredS earchON>
          > <status>On</ status>
          > </campaign>
          > <updateAll>false< /updateAll>
          > </updateCampaign>
          > </soap:Body>
          > </soap:Envelope>
          >
          > And here is the response SOAP XML:
          > <soap:Envelope xmlns:soap="
          href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas. xmlsoap.org/ soap/envelope/"
          > xmlns:xsd="http://www.w3. org/2001/ XMLSchema"
          > xmlns:xsi="http://www.w3. org/2001/ XMLSchema- instance">
          > <soap:Header>
          > <yns:remainingQuota
          > xmlns:yns="http://marketing. ews.yahooapis. com/V1">998</yns:remainin gQuota>
          > <yns:commandGroup
          > xmlns:yns="http://marketing. ews.yahooapis. com/V1">Marketing< /yns:commandGrou p>
          > <yns:timeTakenMilli s
          > xmlns:yns="http://marketing. ews.yahooapis. com/V1">94</yns:timeTaken Millis>
          > <yns:sid
          > xmlns:yns="http://marketing. ews.yahooapis. com/V1">sk1-sbxadservices -002.ysm. sk1.yahoo. com</yns: sid>
          > <yns:stime xmlns:yns="
          href="http://marketing.ews.yahooapis.com/V1">http://marketing. ews.yahooapis. com/V1">Mon Dec
          > 11 09:27:42 PST 2006</yns:stime>
          > </soap:Header>
          > <soap:Body>
          > <updateCampaignResp onse xmlns="
          href="http://marketing.ews.yahooapis.com/V1">http://marketing. ews.yahooapis. com/V1">
          > <out xmlns="http://marketing. ews.yahooapis. com/V1">
          > <campaign>
          > <ID>1245</ID>
          > <accountID>12345< /accountID>
          > <advancedMatchON> true</advancedMa tchON>
          > <campaignOptimizati onON>false< /campaignOptimiz ationON>
          > <contentMatchON> false</contentMa tchON>
          > <createTimestamp> 2006-12-07T13: 35:55.865- 08:00</createTim estamp>
          > <deleteTimestamp xsi:nil="true" />
          > <description> My first campaign</descripti on>
          > <endDate xsi:nil="true" />
          > <lastUpdateTimestam p>2006-12- 11T09:27: 42.895-08: 00</lastUpdateTi mestamp>
          > <name>Cessna< /name>
          > <sponsoredSearchON> true</sponsoredS earchON>
          > <startDate>2006- 12-07T00: 00:00-08: 00</startDate>
          > <status>On</ status>
          > <watchON>false< /watchON>
          > </campaign>
          > <errors xsi:nil="true" />
          > <operationSucceeded >true</operation Succeeded>
          > </out>
          > </updateCampaignRes ponse>
          > </soap:Body> </soap:Envelope>
          >
          > Any ideas?
          >
          >
          >
          >
          > Yahoo! Groups Links
          >
          >
          >

        • y_trafficstrategies
          Thanks for the replies. The problem is not with sending dates to Yahoo, that works fine. The problem is when I get data from Yahoo. For instance, when I call
          Message 4 of 6 , Dec 14, 2006
            Thanks for the replies. The problem is not with sending dates to
            Yahoo, that works fine. The problem is when I get data from Yahoo. For
            instance, when I call getCampaign() from the CampaignServiceService
            proxy, my computer makes the call to Yahoo, gets a valid response from
            Yahoo, and then dies when attempting to parse any of the returned date
            fields. This is all handled automatically by .NET, so I'm assuming
            it's a configuration setting (computer, Common Language Runtime,
            proxy, SOAP, etc)

            Other APIs I've implemented work fine. The difference here is that the
            date format includes the time zone shift. Is there a way to change the
            format Yahoo uses to send dates?


            --- In yws-searchmarketing@yahoogroups.com, "Brian Graves" <brian@...>
            wrote:
            >
            > The only problems I've had in .NET (so far) regarding time was
            initializing
            > the report request structure. The problem involved the timezone and
            I got
            > it to work using the following code:
            >
            > _ReportRequest.startDate = eachDate.Year.ToString() + "-" +
            > eachDate.Month.ToString().PadLeft(2, "0") + "-" +
            > eachDate.Day.ToString().PadLeft(2, "0") + "T00:00:00-08:00"
            >
            > _ReportRequest.startDateSpecified = True
            >
            > _ReportRequest.endDate = _ReportRequest.startDate
            >
            > _ReportRequest.endDateSpecified = True
            >
            >
            >
            > I haven't tried deserializing a SOAP message since I am getting/setting
            > Campaign fields directly accessing the API. For the start and end
            date of a
            > Campaign, I use System.DateTime.
            >
            >
            >
            > _____
            >
            > From: yws-searchmarketing@yahoogroups.com
            > [mailto:yws-searchmarketing@yahoogroups.com] On Behalf Of Yahoo! Search
            > Marketing Monkey
            > Sent: Wednesday, December 13, 2006 3:11 PM
            > To: yws-searchmarketing@yahoogroups.com
            > Subject: Re: [yws-searchmarketing] .NET SOAP throwing "String was not
            > recognized as a valid DateTime." error
            >
            >
            >
            > I'm guessing it's choking on the milliseconds. But I don't know enough
            > about .NET implementations to provide a suggestion on a fix. There are
            > probably other folks on the list that do.
            >
            > Best,
            > -Y!SM Monkey
            >
            > y_trafficstrategies wrote:
            > > I am attempting to implement Yahoo's new EWS API and I've run into a
            > > roadblock. When .NET attempts to deserialize the SOAP message, it
            > > Throws-up on Date fields. I can successfully parses the specified date
            > > string using
            > >
            >
            System.Xml.Serialization.XmlSerializationReader.ToDateTime("2006-12-07T13:35
            > :55.865-08:00").
            > > My computer's location is US_en and I have this entry in my app.config
            > > file
            > > <configuration>
            > > <system.web>
            > > <globalization culture="en-US" uiCulture="en-US" />
            > >
            > > Here is the stack trace:
            > > There is an error in XML document (1, 1148). --->
            > > System.FormatException: String was not recognized as a valid DateTime.
            > > at System.DateTimeParse.ParseExactMultiple(String s, String[]
            > > formats, DateTimeFormatInfo dtfi, DateTimeStyles style, DateTime&
            result)
            > > at System.DateTime.ParseExact(String s, String[] formats,
            > > IFormatProvider provider, DateTimeStyles style)
            > > at System.Xml.XmlConvert.ToDateTime(String s, String[] formats)
            > > at System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String
            > > value, String[] formats)
            > > at System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String
            value)
            > > at
            > > System.Xml.Serialization.XmlSerializationReader.ToDateTime(String
            value)
            > > at
            > >
            >
            Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCampaign
            > ServiceService.Read1_Campaign(Boolean
            > > isNullable, Boolean checkType)
            > > at
            > >
            >
            Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCampaign
            > ServiceService.Read4_CampaignResponse(Boolean
            > > isNullable, Boolean checkType)
            > > at
            > >
            >
            Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCampaign
            > ServiceService.Read77_updateCampaignResponse()
            > > at
            > >
            >
            Microsoft.Xml.Serialization.GeneratedAssembly.updateCampaignResponseSerializ
            > er.Deserialize(XmlSerializationReader
            > > reader)
            > > at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
            > > xmlReader, String encodingStyle, XmlDeserializationEvents events)
            > > at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
            > > xmlReader, XmlDeserializationEvents events)
            > > at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
            > > xmlReader)
            > > at
            > >
            >
            System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClient
            > Message
            > > message, WebResponse response, Stream responseStream, Boolean
            asyncCall)
            > > at
            > > System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
            > > methodName, Object[] parameters)
            > > at CampaignServiceService.updateCampaign(Campaign campaign, Boolean
            > > updateAll)
            > >
            > > Here is the request SOAP XML:
            > > <soap:Envelope xmlns:soap="http://schemas.
            > <http://schemas.xmlsoap.org/soap/envelope/> xmlsoap.org/soap/envelope/"
            > > xmlns:xsi="http://www.w3. <http://www.w3.org/2001/XMLSchema-instance>
            > org/2001/XMLSchema-instance"
            > > xmlns:xsd="http://www.w3. <http://www.w3.org/2001/XMLSchema>
            > org/2001/XMLSchema">
            > > <soap:Header>
            > > <accountID
            > > xmlns="http://marketing. <http://marketing.ews.yahooapis.com/V1>
            > ews.yahooapis.com/V1">12345</accountID>
            > > <license
            > > xmlns="http://marketing. <http://marketing.ews.yahooapis.com/V1>
            > ews.yahooapis.com/V1">12345-678-910-111-12345abc</license>
            > > <masterAccountID
            > > xmlns="http://marketing. <http://marketing.ews.yahooapis.com/V1>
            > ews.yahooapis.com/V1">12345</masterAccountID>
            > > <Security xmlns="http://schemas.
            > <http://schemas.xmlsoap.org/ws/2002/07/secext>
            > xmlsoap.org/ws/2002/07/secext">
            > > <UsernameToken xmlns="">
            > > <Username>username</Username>
            > > <Password>password</Password>
            > > </UsernameToken>
            > > </Security>
            > > </soap:Header>
            > > <soap:Body>
            > > <updateCampaign xmlns="http://marketing.
            > <http://marketing.ews.yahooapis.com/V1> ews.yahooapis.com/V1">
            > > <campaign>
            > > <ID>1245</ID>
            > > <accountID>12345</accountID>
            > > <advancedMatchON>true</advancedMatchON>
            > > <campaignOptimizationON>true</campaignOptimizationON>
            > > <contentMatchON>false</contentMatchON>
            > > <description>My first campaign</description>
            > > <name>Cessna</name>
            > > <sponsoredSearchON>true</sponsoredSearchON>
            > > <status>On</status>
            > > </campaign>
            > > <updateAll>false</updateAll>
            > > </updateCampaign>
            > > </soap:Body>
            > > </soap:Envelope>
            > >
            > > And here is the response SOAP XML:
            > > <soap:Envelope xmlns:soap="http://schemas.
            > <http://schemas.xmlsoap.org/soap/envelope/> xmlsoap.org/soap/envelope/"
            > > xmlns:xsd="http://www.w3. <http://www.w3.org/2001/XMLSchema>
            > org/2001/XMLSchema"
            > > xmlns:xsi="http://www.w3. <http://www.w3.org/2001/XMLSchema-instance>
            > org/2001/XMLSchema-instance">
            > > <soap:Header>
            > > <yns:remainingQuota
            > > xmlns:yns="http://marketing. <http://marketing.ews.yahooapis.com/V1>
            > ews.yahooapis.com/V1">998</yns:remainingQuota>
            > > <yns:commandGroup
            > > xmlns:yns="http://marketing. <http://marketing.ews.yahooapis.com/V1>
            > ews.yahooapis.com/V1">Marketing</yns:commandGroup>
            > > <yns:timeTakenMillis
            > > xmlns:yns="http://marketing. <http://marketing.ews.yahooapis.com/V1>
            > ews.yahooapis.com/V1">94</yns:timeTakenMillis>
            > > <yns:sid
            > > xmlns:yns="http://marketing. <http://marketing.ews.yahooapis.com/V1>
            > ews.yahooapis.com/V1">sk1-sbxadservices-002.ysm.sk1.yahoo.com</yns:sid>
            > > <yns:stime xmlns:yns="http://marketing.
            > <http://marketing.ews.yahooapis.com/V1> ews.yahooapis.com/V1">Mon Dec
            > > 11 09:27:42 PST 2006</yns:stime>
            > > </soap:Header>
            > > <soap:Body>
            > > <updateCampaignResponse xmlns="http://marketing.
            > <http://marketing.ews.yahooapis.com/V1> ews.yahooapis.com/V1">
            > > <out xmlns="http://marketing. <http://marketing.ews.yahooapis.com/V1>
            > ews.yahooapis.com/V1">
            > > <campaign>
            > > <ID>1245</ID>
            > > <accountID>12345</accountID>
            > > <advancedMatchON>true</advancedMatchON>
            > > <campaignOptimizationON>false</campaignOptimizationON>
            > > <contentMatchON>false</contentMatchON>
            > > <createTimestamp>2006-12-07T13:35:55.865-08:00</createTimestamp>
            > > <deleteTimestamp xsi:nil="true" />
            > > <description>My first campaign</description>
            > > <endDate xsi:nil="true" />
            > >
            <lastUpdateTimestamp>2006-12-11T09:27:42.895-08:00</lastUpdateTimestamp>
            > > <name>Cessna</name>
            > > <sponsoredSearchON>true</sponsoredSearchON>
            > > <startDate>2006-12-07T00:00:00-08:00</startDate>
            > > <status>On</status>
            > > <watchON>false</watchON>
            > > </campaign>
            > > <errors xsi:nil="true" />
            > > <operationSucceeded>true</operationSucceeded>
            > > </out>
            > > </updateCampaignResponse>
            > > </soap:Body></soap:Envelope>
            > >
            > > Any ideas?
            > >
            > >
            > >
            > >
            > > Yahoo! Groups Links
            > >
            > >
            > >
            >
          • Brian Graves
            Here s what I use to get the campaign start date in VB.NET: Dim dtStartDate As New Date dtStartDate = campaign.startDate _____ From:
            Message 5 of 6 , Dec 14, 2006

              Here’s what I use to get the campaign start date in VB.NET:

               

                          Dim dtStartDate As New Date

                          dtStartDate = campaign.startDate

               


              From: yws-searchmarketing@yahoogroups.com [mailto: yws-searchmarketing@yahoogroups.com ] On Behalf Of y_trafficstrategies
              Sent: Thursday, December 14, 2006 9:09 AM
              To: yws-searchmarketing@yahoogroups.com
              Subject: [yws-searchmarketing] Re: .NET SOAP throwing "String was not recognized as a valid DateTime." error

               

              Thanks for the replies. The problem is not with sending dates to
              Yahoo, that works fine. The problem is when I get data from Yahoo. For
              instance, when I call getCampaign( ) from the CampaignServiceServ ice
              proxy, my computer makes the call to Yahoo, gets a valid response from
              Yahoo, and then dies when attempting to parse any of the returned date
              fields. This is all handled automatically by .NET, so I'm assuming
              it's a configuration setting (computer, Common Language Runtime,
              proxy, SOAP, etc)

              Other APIs I've implemented work fine. The difference here is that the
              date format includes the time zone shift. Is there a way to change the
              format Yahoo uses to send dates?

              --- In yws-searchmarketing @yahoogroups. com, "Brian Graves" <brian@...>
              wrote:

              >
              > The only problems I've had in .NET (so far) regarding time was
              initializing
              > the report request structure. The problem involved the timezone and
              I got
              > it to work using the following code:
              >
              > _ReportRequest. startDate = eachDate.Year. ToString( ) +
              "-" +
              > eachDate.Month. ToString( ).PadLeft( 2, "0") +
              "-" +
              > eachDate.Day. ToString( ).PadLeft( 2, "0") +
              "T00:00:00-08: 00"
              >
              > _ReportRequest. startDateSpecifi ed = True
              >
              > _ReportRequest. endDate = _ReportRequest. startDate
              >
              > _ReportRequest. endDateSpecified = True
              >
              >
              >
              > I haven't tried deserializing a SOAP message since I am getting/setting
              > Campaign fields directly accessing the API. For the start and end
              date of a
              > Campaign, I use System.DateTime.
              >
              >
              >
              > _____
              >
              > From: yws-searchmarketing @yahoogroups. com
              > [mailto:yws-searchmarketing @yahoogroups. com]
              On Behalf Of Yahoo! Search
              > Marketing Monkey
              > Sent: Wednesday, December 13, 2006 3:11 PM
              > To: yws-searchmarketing @yahoogroups. com
              > Subject: Re: [yws-searchmarketin g] .NET SOAP throwing "String
              was not
              > recognized as a valid DateTime." error
              >
              >
              >
              > I'm guessing it's choking on the milliseconds. But I don't know enough
              > about .NET implementations to provide a suggestion on a fix. There are
              > probably other folks on the list that do.
              >
              > Best,
              > -Y!SM Monkey
              >
              > y_trafficstrategies wrote:
              > > I am attempting to implement Yahoo's new EWS API and I've run into a
              > > roadblock. When .NET attempts to deserialize the SOAP message, it
              > > Throws-up on Date fields. I can successfully parses the specified
              date
              > > string using
              > >
              >
              System.Xml.Serializ ation.XmlSeriali zationReader. ToDateTime( "2006-12- 07T13:35
              > :55.865-08:00" ).
              > > My computer's location is US_en and I have this entry in my
              app.config
              > > file
              > > <configuration>
              > > <system.web>
              > > <globalization culture="en- US" uiCulture="en- US"
              />
              > >
              > > Here is the stack trace:
              > > There is an error in XML document (1, 1148). --->
              > > System.FormatExcept ion: String was not recognized as a valid
              DateTime.
              > > at System.DateTimePars e.ParseExactMult iple(String s, String[]
              > > formats, DateTimeFormatInfo dtfi, DateTimeStyles style, DateTime&
              result)
              > > at System.DateTime. ParseExact( String s, String[] formats,
              > > IFormatProvider provider, DateTimeStyles style)
              > > at System.Xml.XmlConve rt.ToDateTime( String s, String[]
              formats)
              > > at System.Xml.Serializ ation.XmlCustomF ormatter. ToDateTime( String
              > > value, String[] formats)
              > > at System.Xml.Serializ ation.XmlCustomF ormatter. ToDateTime( String
              value)
              > > at
              > > System.Xml.Serializ ation.XmlSeriali zationReader. ToDateTime( String
              value)
              > > at
              > >
              >
              Microsoft.Xml. Serialization. GeneratedAssembl y.XmlSerializati onReaderCampaign
              > ServiceService. Read1_Campaign( Boolean
              > > isNullable, Boolean checkType)
              > > at
              > >
              >
              Microsoft.Xml. Serialization. GeneratedAssembl y.XmlSerializati onReaderCampaign
              > ServiceService. Read4_CampaignRe sponse(Boolean
              > > isNullable, Boolean checkType)
              > > at
              > >
              >
              Microsoft.Xml. Serialization. GeneratedAssembl y.XmlSerializati onReaderCampaign
              > ServiceService. Read77_updateCam paignResponse( )
              > > at
              > >
              >
              Microsoft.Xml. Serialization. GeneratedAssembl y.updateCampaign ResponseSerializ
              > er.Deserialize( XmlSerialization Reader
              > > reader)
              > > at System.Xml.Serializ ation.XmlSeriali zer.Deserialize( XmlReader
              > > xmlReader, String encodingStyle, XmlDeserializationE vents
              events)
              > > at System.Xml.Serializ ation.XmlSeriali zer.Deserialize( XmlReader
              > > xmlReader, XmlDeserializationE vents events)
              > > at System.Xml.Serializ ation.XmlSeriali zer.Deserialize( XmlReader
              > > xmlReader)
              > > at
              > >
              >
              System.Web.Services .Protocols. SoapHttpClientPr otocol.ReadRespo nse(SoapClient
              > Message
              > > message, WebResponse response, Stream responseStream, Boolean
              asyncCall)
              > > at
              > > System.Web.Services .Protocols. SoapHttpClientPr otocol.Invoke( String
              > > methodName, Object[] parameters)
              > > at CampaignServiceServ ice.updateCampai gn(Campaign campaign,
              Boolean
              > > updateAll)
              > >
              > > Here is the request SOAP XML:
              > > <soap:Envelope xmlns:soap="http://schemas.
              > <http://schemas. xmlsoap.org/ soap/envelope/>
              xmlsoap.org/ soap/envelope/ "
              > > xmlns:xsi="http://www.w3. <
              href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3. org/2001/ XMLSchema- instance>
              > org/2001/XMLSchema- instance"
              > > xmlns:xsd="http://www.w3. <
              href="http://www.w3.org/2001/XMLSchema">http://www.w3. org/2001/ XMLSchema>
              > org/2001/XMLSchema" >
              > > <soap:Header>
              > > <accountID
              > > xmlns="http://marketing. <
              href="http://marketing.ews.yahooapis.com/V1">http://marketing. ews.yahooapis. com/V1>
              > ews.yahooapis. com/V1">12345< /accountID>
              > > <license
              > > xmlns="http://marketing. <
              href="http://marketing.ews.yahooapis.com/V1">http://marketing. ews.yahooapis. com/V1>
              > ews.yahooapis. com/V1">12345- 678-910-111- 12345abc< /license>
              > > <masterAccountID
              > > xmlns="http://marketing. <
              href="http://marketing.ews.yahooapis.com/V1">http://marketing. ews.yahooapis. com/V1>
              > ews.yahooapis. com/V1">12345< /masterAccountID >
              > > <Security xmlns="http://schemas.
              > <http://schemas. xmlsoap.org/ ws/2002/07/ secext>
              > xmlsoap.org/ ws/2002/07/ secext">
              > > <UsernameToken xmlns="">
              > > <Username>username< /Username>
              > > <Password>password< /Password>
              > > </UsernameToken>
              > > </Security>
              > > </soap:Header>
              > > <soap:Body>
              > > <updateCampaign xmlns="http://marketing.
              > <http://marketing. ews.yahooapis. com/V1>
              ews.yahooapis. com/V1">
              > > <campaign>
              > > <ID>1245</ID>
              > > <accountID>12345< /accountID>
              > > <advancedMatchON> true</advancedMa tchON>
              > > <campaignOptimizati onON>true< /campaignOptimiz ationON>
              > > <contentMatchON> false</contentMa tchON>
              > > <description> My first campaign</descripti on>
              > > <name>Cessna< /name>
              > > <sponsoredSearchON> true</sponsoredS earchON>
              > > <status>On</ status>
              > > </campaign>
              > > <updateAll>false< /updateAll>
              > > </updateCampaign>
              > > </soap:Body>
              > > </soap:Envelope>
              > >
              > > And here is the response SOAP XML:
              > > <soap:Envelope xmlns:soap="http://schemas.
              > <http://schemas. xmlsoap.org/ soap/envelope/>
              xmlsoap.org/ soap/envelope/ "
              > > xmlns:xsd="http://www.w3. <
              href="http://www.w3.org/2001/XMLSchema">http://www.w3. org/2001/ XMLSchema>
              > org/2001/XMLSchema"
              > > xmlns:xsi="http://www.w3. <
              href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3. org/2001/ XMLSchema- instance>
              > org/2001/XMLSchema- instance" >
              > > <soap:Header>
              > > <yns:remainingQuota
              > > xmlns:yns="http://marketing.
              <http://marketing. ews.yahooapis. com/V1>
              > ews.yahooapis. com/V1">998< /yns:remainingQu ota>
              > > <yns:commandGroup
              > > xmlns:yns="http://marketing.
              <http://marketing. ews.yahooapis. com/V1>
              > ews.yahooapis. com/V1">Marketin g</yns:commandGr oup>
              > > <yns:timeTakenMilli s
              > > xmlns:yns="http://marketing.
              <http://marketing. ews.yahooapis. com/V1>
              > ews.yahooapis. com/V1">94< /yns:timeTakenMi llis>
              > > <yns:sid
              > > xmlns:yns="http://marketing.
              <http://marketing. ews.yahooapis. com/V1>
              > ews.yahooapis. com/V1">sk1- sbxadservices- 002.ysm.sk1. yahoo.com< /yns:sid>
              > > <yns:stime xmlns:yns="http://marketing.
              > <http://marketing. ews.yahooapis. com/V1>
              ews.yahooapis. com/V1">Mon Dec
              > > 11 09:27:42 PST 2006</yns:stime>
              > > </soap:Header>
              > > <soap:Body>
              > > <updateCampaignResp onse xmlns="
              href="http://marketing.">http://marketing.
              > <http://marketing. ews.yahooapis. com/V1>
              ews.yahooapis. com/V1">
              > > <out xmlns="http://marketing.
              <http://marketing. ews.yahooapis. com/V1>
              > ews.yahooapis. com/V1">
              > > <campaign>
              > > <ID>1245</ID>
              > > <accountID>12345< /accountID>
              > > <advancedMatchON> true</advancedMa tchON>
              > > <campaignOptimizati onON>false< /campaignOptimiz ationON>
              > > <contentMatchON> false</contentMa tchON>
              > > <createTimestamp> 2006-12-07T13: 35:55.865- 08:00</createTim estamp>
              > > <deleteTimestamp xsi:nil="true" />
              > > <description> My first campaign</descripti on>
              > > <endDate xsi:nil="true" />
              > >
              <lastUpdateTimestam p>2006-12- 11T09:27: 42.895-08: 00</lastUpdateTi mestamp>
              > > <name>Cessna< /name>
              > > <sponsoredSearchON> true</sponsoredS earchON>
              > > <startDate>2006- 12-07T00: 00:00-08: 00</startDate>
              > > <status>On</ status>
              > > <watchON>false< /watchON>
              > > </campaign>
              > > <errors xsi:nil="true" />
              > > <operationSucceeded >true</operation Succeeded>
              > > </out>
              > > </updateCampaignRes ponse>
              > > </soap:Body> </soap:Envelope>
              > >
              > > Any ideas?
              > >
              > >
              > >
              > >
              > > Yahoo! Groups Links
              > >
              > >
              > >
              >

            • don.frazier
              It ain t pretty but I use this anywhere I need to get a date from a Panama report. public static DateTime PanamaDate(string date) { string[] parts =
              Message 6 of 6 , Dec 14, 2006
                It ain't pretty but I use this anywhere I need to get a "date" from a
                Panama report.


                public static DateTime PanamaDate(string date)
                {
                string[] parts = date.Split('-');
                DateTime t = new DateTime(int.Parse(parts[0])
                , int.Parse(parts[1])
                , int.Parse(parts[2])
                , 0, 0, 0
                , DateTimeKind.Local);
                return t;
                }

                --- In yws-searchmarketing@yahoogroups.com, "Brian Graves"
                <brian@...> wrote:
                >
                > Here's what I use to get the campaign start date in VB.NET:
                >
                >
                >
                > Dim dtStartDate As New Date
                >
                > dtStartDate = campaign.startDate
                >
                >
                >
                > _____
                >
                > From: yws-searchmarketing@yahoogroups.com
                > [mailto:yws-searchmarketing@yahoogroups.com] On Behalf Of
                > y_trafficstrategies
                > Sent: Thursday, December 14, 2006 9:09 AM
                > To: yws-searchmarketing@yahoogroups.com
                > Subject: [yws-searchmarketing] Re: .NET SOAP throwing "String was
                not
                > recognized as a valid DateTime." error
                >
                >
                >
                > Thanks for the replies. The problem is not with sending dates to
                > Yahoo, that works fine. The problem is when I get data from Yahoo.
                For
                > instance, when I call getCampaign() from the CampaignServiceService
                > proxy, my computer makes the call to Yahoo, gets a valid response
                from
                > Yahoo, and then dies when attempting to parse any of the returned
                date
                > fields. This is all handled automatically by .NET, so I'm assuming
                > it's a configuration setting (computer, Common Language Runtime,
                > proxy, SOAP, etc)
                >
                > Other APIs I've implemented work fine. The difference here is that
                the
                > date format includes the time zone shift. Is there a way to change
                the
                > format Yahoo uses to send dates?
                >
                > --- In yws-searchmarketing <mailto:yws-searchmarketing%
                40yahoogroups.com>
                > @yahoogroups.com, "Brian Graves" <brian@>
                > wrote:
                > >
                > > The only problems I've had in .NET (so far) regarding time was
                > initializing
                > > the report request structure. The problem involved the timezone
                and
                > I got
                > > it to work using the following code:
                > >
                > > _ReportRequest.startDate = eachDate.Year.ToString() + "-" +
                > > eachDate.Month.ToString().PadLeft(2, "0") + "-" +
                > > eachDate.Day.ToString().PadLeft(2, "0") + "T00:00:00-08:00"
                > >
                > > _ReportRequest.startDateSpecified = True
                > >
                > > _ReportRequest.endDate = _ReportRequest.startDate
                > >
                > > _ReportRequest.endDateSpecified = True
                > >
                > >
                > >
                > > I haven't tried deserializing a SOAP message since I am
                getting/setting
                > > Campaign fields directly accessing the API. For the start and end
                > date of a
                > > Campaign, I use System.DateTime.
                > >
                > >
                > >
                > > _____
                > >
                > > From: yws-searchmarketing <mailto:yws-searchmarketing%
                40yahoogroups.com>
                > @yahoogroups.com
                > > [mailto:yws-searchmarketing <mailto:yws-searchmarketing%
                40yahoogroups.com>
                > @yahoogroups.com] On Behalf Of Yahoo! Search
                > > Marketing Monkey
                > > Sent: Wednesday, December 13, 2006 3:11 PM
                > > To: yws-searchmarketing <mailto:yws-searchmarketing%
                40yahoogroups.com>
                > @yahoogroups.com
                > > Subject: Re: [yws-searchmarketing] .NET SOAP throwing "String was
                not
                > > recognized as a valid DateTime." error
                > >
                > >
                > >
                > > I'm guessing it's choking on the milliseconds. But I don't know
                enough
                > > about .NET implementations to provide a suggestion on a fix.
                There are
                > > probably other folks on the list that do.
                > >
                > > Best,
                > > -Y!SM Monkey
                > >
                > > y_trafficstrategies wrote:
                > > > I am attempting to implement Yahoo's new EWS API and I've run
                into a
                > > > roadblock. When .NET attempts to deserialize the SOAP message,
                it
                > > > Throws-up on Date fields. I can successfully parses the
                specified date
                > > > string using
                > > >
                > >
                > System.Xml.Serialization.XmlSerializationReader.ToDateTime("2006-12-
                07T13:35
                > > :55.865-08:00").
                > > > My computer's location is US_en and I have this entry in my
                app.config
                > > > file
                > > > <configuration>
                > > > <system.web>
                > > > <globalization culture="en-US" uiCulture="en-US" />
                > > >
                > > > Here is the stack trace:
                > > > There is an error in XML document (1, 1148). --->
                > > > System.FormatException: String was not recognized as a valid
                DateTime.
                > > > at System.DateTimeParse.ParseExactMultiple(String s, String[]
                > > > formats, DateTimeFormatInfo dtfi, DateTimeStyles style,
                DateTime&
                > result)
                > > > at System.DateTime.ParseExact(String s, String[] formats,
                > > > IFormatProvider provider, DateTimeStyles style)
                > > > at System.Xml.XmlConvert.ToDateTime(String s, String[] formats)
                > > > at System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String
                > > > value, String[] formats)
                > > > at System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String
                > value)
                > > > at
                > > > System.Xml.Serialization.XmlSerializationReader.ToDateTime
                (String
                > value)
                > > > at
                > > >
                > >
                >
                Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCa
                mpaign
                > > ServiceService.Read1_Campaign(Boolean
                > > > isNullable, Boolean checkType)
                > > > at
                > > >
                > >
                >
                Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCa
                mpaign
                > > ServiceService.Read4_CampaignResponse(Boolean
                > > > isNullable, Boolean checkType)
                > > > at
                > > >
                > >
                >
                Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCa
                mpaign
                > > ServiceService.Read77_updateCampaignResponse()
                > > > at
                > > >
                > >
                >
                Microsoft.Xml.Serialization.GeneratedAssembly.updateCampaignResponseSe
                rializ
                > > er.Deserialize(XmlSerializationReader
                > > > reader)
                > > > at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
                > > > xmlReader, String encodingStyle, XmlDeserializationEvents
                events)
                > > > at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
                > > > xmlReader, XmlDeserializationEvents events)
                > > > at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
                > > > xmlReader)
                > > > at
                > > >
                > >
                > System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse
                (SoapClient
                > > Message
                > > > message, WebResponse response, Stream responseStream, Boolean
                > asyncCall)
                > > > at
                > > > System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke
                (String
                > > > methodName, Object[] parameters)
                > > > at CampaignServiceService.updateCampaign(Campaign campaign,
                Boolean
                > > > updateAll)
                > > >
                > > > Here is the request SOAP XML:
                > > > <soap:Envelope xmlns:soap="http://schemas.
                > > <http://schemas. <http://schemas.xmlsoap.org/soap/envelope/>
                > xmlsoap.org/soap/envelope/> xmlsoap.org/soap/envelope/"
                > > > xmlns:xsi="http://www.w3. <http://www.w3.
                > <http://www.w3.org/2001/XMLSchema-instance> org/2001/XMLSchema-
                instance>
                > > org/2001/XMLSchema-instance"
                > > > xmlns:xsd="http://www.w3. <http://www.w3.
                > <http://www.w3.org/2001/XMLSchema> org/2001/XMLSchema>
                > > org/2001/XMLSchema">
                > > > <soap:Header>
                > > > <accountID
                > > > xmlns="http://marketing. <http://marketing.
                > <http://marketing.ews.yahooapis.com/V1> ews.yahooapis.com/V1>
                > > ews.yahooapis.com/V1">12345</accountID>
                > > > <license
                > > > xmlns="http://marketing. <http://marketing.
                > <http://marketing.ews.yahooapis.com/V1> ews.yahooapis.com/V1>
                > > ews.yahooapis.com/V1">12345-678-910-111-12345abc</license>
                > > > <masterAccountID
                > > > xmlns="http://marketing. <http://marketing.
                > <http://marketing.ews.yahooapis.com/V1> ews.yahooapis.com/V1>
                > > ews.yahooapis.com/V1">12345</masterAccountID>
                > > > <Security xmlns="http://schemas.
                > > <http://schemas. <http://schemas.xmlsoap.org/ws/2002/07/secext>
                > xmlsoap.org/ws/2002/07/secext>
                > > xmlsoap.org/ws/2002/07/secext">
                > > > <UsernameToken xmlns="">
                > > > <Username>username</Username>
                > > > <Password>password</Password>
                > > > </UsernameToken>
                > > > </Security>
                > > > </soap:Header>
                > > > <soap:Body>
                > > > <updateCampaign xmlns="http://marketing.
                > > <http://marketing. <http://marketing.ews.yahooapis.com/V1>
                > ews.yahooapis.com/V1> ews.yahooapis.com/V1">
                > > > <campaign>
                > > > <ID>1245</ID>
                > > > <accountID>12345</accountID>
                > > > <advancedMatchON>true</advancedMatchON>
                > > > <campaignOptimizationON>true</campaignOptimizationON>
                > > > <contentMatchON>false</contentMatchON>
                > > > <description>My first campaign</description>
                > > > <name>Cessna</name>
                > > > <sponsoredSearchON>true</sponsoredSearchON>
                > > > <status>On</status>
                > > > </campaign>
                > > > <updateAll>false</updateAll>
                > > > </updateCampaign>
                > > > </soap:Body>
                > > > </soap:Envelope>
                > > >
                > > > And here is the response SOAP XML:
                > > > <soap:Envelope xmlns:soap="http://schemas.
                > > <http://schemas. <http://schemas.xmlsoap.org/soap/envelope/>
                > xmlsoap.org/soap/envelope/> xmlsoap.org/soap/envelope/"
                > > > xmlns:xsd="http://www.w3. <http://www.w3.
                > <http://www.w3.org/2001/XMLSchema> org/2001/XMLSchema>
                > > org/2001/XMLSchema"
                > > > xmlns:xsi="http://www.w3. <http://www.w3.
                > <http://www.w3.org/2001/XMLSchema-instance> org/2001/XMLSchema-
                instance>
                > > org/2001/XMLSchema-instance">
                > > > <soap:Header>
                > > > <yns:remainingQuota
                > > > xmlns:yns="http://marketing. <http://marketing.
                > <http://marketing.ews.yahooapis.com/V1> ews.yahooapis.com/V1>
                > > ews.yahooapis.com/V1">998</yns:remainingQuota>
                > > > <yns:commandGroup
                > > > xmlns:yns="http://marketing. <http://marketing.
                > <http://marketing.ews.yahooapis.com/V1> ews.yahooapis.com/V1>
                > > ews.yahooapis.com/V1">Marketing</yns:commandGroup>
                > > > <yns:timeTakenMillis
                > > > xmlns:yns="http://marketing. <http://marketing.
                > <http://marketing.ews.yahooapis.com/V1> ews.yahooapis.com/V1>
                > > ews.yahooapis.com/V1">94</yns:timeTakenMillis>
                > > > <yns:sid
                > > > xmlns:yns="http://marketing. <http://marketing.
                > <http://marketing.ews.yahooapis.com/V1> ews.yahooapis.com/V1>
                > > ews.yahooapis.com/V1">sk1-sbxadservices-
                002.ysm.sk1.yahoo.com</yns:sid>
                > > > <yns:stime xmlns:yns="http://marketing.
                > > <http://marketing. <http://marketing.ews.yahooapis.com/V1>
                > ews.yahooapis.com/V1> ews.yahooapis.com/V1">Mon Dec
                > > > 11 09:27:42 PST 2006</yns:stime>
                > > > </soap:Header>
                > > > <soap:Body>
                > > > <updateCampaignResponse xmlns="http://marketing.
                > > <http://marketing. <http://marketing.ews.yahooapis.com/V1>
                > ews.yahooapis.com/V1> ews.yahooapis.com/V1">
                > > > <out xmlns="http://marketing. <http://marketing.
                > <http://marketing.ews.yahooapis.com/V1> ews.yahooapis.com/V1>
                > > ews.yahooapis.com/V1">
                > > > <campaign>
                > > > <ID>1245</ID>
                > > > <accountID>12345</accountID>
                > > > <advancedMatchON>true</advancedMatchON>
                > > > <campaignOptimizationON>false</campaignOptimizationON>
                > > > <contentMatchON>false</contentMatchON>
                > > > <createTimestamp>2006-12-07T13:35:55.865-08:00</createTimestamp>
                > > > <deleteTimestamp xsi:nil="true" />
                > > > <description>My first campaign</description>
                > > > <endDate xsi:nil="true" />
                > > >
                > <lastUpdateTimestamp>2006-12-11T09:27:42.895-
                08:00</lastUpdateTimestamp>
                > > > <name>Cessna</name>
                > > > <sponsoredSearchON>true</sponsoredSearchON>
                > > > <startDate>2006-12-07T00:00:00-08:00</startDate>
                > > > <status>On</status>
                > > > <watchON>false</watchON>
                > > > </campaign>
                > > > <errors xsi:nil="true" />
                > > > <operationSucceeded>true</operationSucceeded>
                > > > </out>
                > > > </updateCampaignResponse>
                > > > </soap:Body></soap:Envelope>
                > > >
                > > > Any ideas?
                > > >
                > > >
                > > >
                > > >
                > > > Yahoo! Groups Links
                > > >
                > > >
                > > >
                > >
                >
              Your message has been successfully submitted and would be delivered to recipients shortly.