none
ASMX deserialization problem RRS feed

  • Frage

  • Hi,

    I'm having some trouble with an ASMX webservice I'm writing. The service seems to run without problems and the data which is coming in seems to be correct but in my WebMethods the parameter obejcts are null.

    Here's the code of my webservice. It's from http://ebay.custhelp.com/cgi-bin/ebay.cfg/php/enduser/std_adp.php?p_faqid=303 .

    namespace eBayNotification
    {
      /// <summary>
      /// Webservice for listening to eBay platform notifications
      /// </summary>
      [WebService(Namespace = "urn:ebay:apis:eBLBaseComponents")]
      public class eBayNotification : System.Web.Services.WebService
      {
    
        private CustomSecurityHeaderType mRequesterCredentials;
        /// <summary>
        /// Property to hold the Soap header.
        /// </summary>
        public CustomSecurityHeaderType RequesterCredentials
        {
          get
          {
            return this.mRequesterCredentials;
          }
          set
          {
            this.mRequesterCredentials = value;
          }
        }
    
        public eBayNotification()
        {
          InitializeComponent();
        }
    
        #region Component Designer generated code
    
        //Designer generated code
    
        #endregion
    
        #region WebMethods
    
        [WebMethod()]
        [System.Web.Services.Protocols.SoapHeaderAttribute(
          "RequesterCredentials", 
          Direction = System.Web.Services.Protocols.SoapHeaderDirection.In)]
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute(
          Action = "http://developer.ebay.com/notification/BidReceived", 
          Use = System.Web.Services.Description.SoapBindingUse.Literal, 
          ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Bare)]
        public void BidReceived(GetItemResponseType getItemResponse)
        {
          //getItemResponse is null
        }
    
        //3 more methods like BidReceived
    
        #endregion
    
      }
    
    }
    

    And here is some data I got from eBay:

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <soapenv:Header>
     <ebl:RequesterCredentials soapenv:mustUnderstand="0" xmlns:ns="urn:ebay:apis:eBLBaseComponents" xmlns:ebl="urn:ebay:apis:eBLBaseComponents">
      <ebl:NotificationSignature xmlns:ebl="urn:ebay:apis:eBLBaseComponents">5xHSIADrUFBAoF8KF9Ce5w==</ebl:NotificationSignature>
     </ebl:RequesterCredentials>
     </soapenv:Header>
     <soapenv:Body>
     <GetItemResponse xmlns="urn:ebay:apis:eBLBaseComponents">
      <Timestamp>2010-09-15T14:03:15.673Z</Timestamp>
      <Ack>Success</Ack>
      <CorrelationID>421558160</CorrelationID>
      <Version>685</Version>
      <Build>E685_CORE_BUNDLED_11934711_R1</Build>
      <NotificationEventName>BidReceived</NotificationEventName>
      <RecipientUserID>Recipient</RecipientUserID>
      <EIASToken>RecipientToken</EIASToken>
      <Item>
      <AutoPay>false</AutoPay>
      <MotorsGermanySearchable>false</MotorsGermanySearchable>
      <BuyerProtection>ItemEligible</BuyerProtection>
      <BuyItNowPrice currencyID="EUR">12.0</BuyItNowPrice>
      <Country>DE</Country>
      <Currency>EUR</Currency>
      <GiftIcon>0</GiftIcon>
      <HitCounter>NoHitCounter</HitCounter>
      <ItemID>110054034959</ItemID>
      <ListingDetails>
       <Adult>false</Adult>
       <BindingAuction>false</BindingAuction>
       <CheckoutEnabled>true</CheckoutEnabled>
       <ConvertedBuyItNowPrice currencyID="EUR">12.0</ConvertedBuyItNowPrice>
       <ConvertedStartPrice currencyID="EUR">1.0</ConvertedStartPrice>
       <ConvertedReservePrice currencyID="EUR">0.0</ConvertedReservePrice>
       <HasReservePrice>false</HasReservePrice>
       <StartTime>2010-09-15T08:20:52.000Z</StartTime>
       <EndTime>2010-09-20T08:20:52.000Z</EndTime>
       <ViewItemURL>http://cgi.sandbox.ebay.de/ws/eBayISAPI.dll?ViewItem&amp;item=110054034959&amp;category=24071</ViewItemURL>
       <HasUnansweredQuestions>false</HasUnansweredQuestions>
       <HasPublicMessages>false</HasPublicMessages>
       <ExpressListing>false</ExpressListing>
      </ListingDetails>
      <ListingDuration>Days_5</ListingDuration>
      <ListingType>Chinese</ListingType>
      <Location>Trier</Location>
      <PaymentMethods>PayPal</PaymentMethods>
      <PayPalEmailAddress>test@paypal.com</PayPalEmailAddress>
      <PrimaryCategory>
       <CategoryID>24071</CategoryID>
       <CategoryName>Kleidung &amp; Accessoires:Herrenmode:Jeans</CategoryName>
      </PrimaryCategory>
      <PrivateListing>false</PrivateListing>
      <Quantity>1</Quantity>
      <ReservePrice currencyID="EUR">0.0</ReservePrice>
      <ReviseStatus>
       <ItemRevised>false</ItemRevised>
      </ReviseStatus>
      <Seller>
       <AboutMePage>false</AboutMePage>
       <Email>ebay@intelligix.de</Email>
       <FeedbackScore>1</FeedbackScore>
       <PositiveFeedbackPercent>100.0</PositiveFeedbackPercent>
       <FeedbackPrivate>false</FeedbackPrivate>
       <FeedbackRatingStar>None</FeedbackRatingStar>
       <IDVerified>true</IDVerified>
       <eBayGoodStanding>true</eBayGoodStanding>
       <NewUser>false</NewUser>
       <RegistrationDate>1995-01-01T00:00:00.000Z</RegistrationDate>
       <Site>Germany</Site>
       <Status>Confirmed</Status>
       <UserID>testuser_cmxuser2</UserID>
       <UserIDChanged>false</UserIDChanged>
       <UserIDLastChanged>2009-12-28T09:38:54.000Z</UserIDLastChanged>
       <VATStatus>NoVATTax</VATStatus>
       <SellerInfo>
       <AllowPaymentEdit>true</AllowPaymentEdit>
       <CheckoutEnabled>true</CheckoutEnabled>
       <CIPBankAccountStored>false</CIPBankAccountStored>
       <GoodStanding>true</GoodStanding>
       <LiveAuctionAuthorized>false</LiveAuctionAuthorized>
       <MerchandizingPref>OptIn</MerchandizingPref>
       <QualifiesForB2BVAT>false</QualifiesForB2BVAT>
       <StoreOwner>false</StoreOwner>
       <ExpressEligible>false</ExpressEligible>
       <ExpressWallet>false</ExpressWallet>
       <SafePaymentExempt>true</SafePaymentExempt>
       </SellerInfo>
       <MotorsDealer>false</MotorsDealer>
      </Seller>
      <SellingStatus>
       <BidCount>20</BidCount>
       <BidIncrement currencyID="EUR">0.5</BidIncrement>
       <ConvertedCurrentPrice currencyID="EUR">1.0</ConvertedCurrentPrice>
       <CurrentPrice currencyID="EUR">1.0</CurrentPrice>
       <HighBidder>
       <AboutMePage>false</AboutMePage>
       <EIASToken>BidderToken</EIASToken>
       <Email>Email</Email>
       <FeedbackScore>2</FeedbackScore>
       <PositiveFeedbackPercent>100.0</PositiveFeedbackPercent>
       <FeedbackPrivate>false</FeedbackPrivate>
       <FeedbackRatingStar>None</FeedbackRatingStar>
       <IDVerified>false</IDVerified>
       <eBayGoodStanding>true</eBayGoodStanding>
       <NewUser>false</NewUser>
       <RegistrationAddress>
        <Name>Test User</Name>
        <Street>Testadressenstr. 4711</Street>
        <Street1>Testadressenstr. 4711</Street1>
        <CityName>Testhausen</CityName>
        <Country>CustomCode</Country>
        <CountryName>Kein Land</CountryName>
        <Phone>Invalid Request</Phone>
        <PostalCode>0815</PostalCode>
       </RegistrationAddress>
       <RegistrationDate>2009-09-09T00:00:00.000Z</RegistrationDate>
       <Site>Germany</Site>
       <Status>Confirmed</Status>
       <UserID>BiddingUser</UserID>
       <UserIDChanged>false</UserIDChanged>
       <UserIDLastChanged>2009-09-10T11:46:37.000Z</UserIDLastChanged>
       <VATStatus>NoVATTax</VATStatus>
       <UserAnonymized>false</UserAnonymized>
       </HighBidder>
       <LeadCount>0</LeadCount>
       <MinimumToBid currencyID="EUR">1.5</MinimumToBid>
       <QuantitySold>0</QuantitySold>
       <ReserveMet>true</ReserveMet>
       <SecondChanceEligible>false</SecondChanceEligible>
       <ListingStatus>Active</ListingStatus>
      </SellingStatus>
      <ShippingDetails>
       <ApplyShippingDiscount>false</ApplyShippingDiscount>
       <InsuranceFee currencyID="EUR">0.0</InsuranceFee>
       <InsuranceOption>NotOffered</InsuranceOption>
       <SalesTax>
       <SalesTaxPercent>0.0</SalesTaxPercent>
       <ShippingIncludedInTax>false</ShippingIncludedInTax>
       </SalesTax>
       <ShippingServiceOptions>
       <ShippingService>DE_DHLPackchen</ShippingService>
       <ShippingServiceCost currencyID="EUR">0.0</ShippingServiceCost>
       <ShippingServicePriority>1</ShippingServicePriority>
       <ExpeditedService>false</ExpeditedService>
       <FreeShipping>true</FreeShipping>
       </ShippingServiceOptions>
       <ShippingType>Flat</ShippingType>
       <ThirdPartyCheckout>false</ThirdPartyCheckout>
       <TaxTable/>
       <InsuranceDetails>
       <InsuranceOption>NotOffered</InsuranceOption>
       </InsuranceDetails>
       <SellerExcludeShipToLocationsPreference>false</SellerExcludeShipToLocationsPreference>
      </ShippingDetails>
      <ShipToLocations>DE</ShipToLocations>
      <Site>Germany</Site>
      <StartPrice currencyID="EUR">1.0</StartPrice>
      <TimeLeft>P4DT18H17M37S</TimeLeft>
      <Title>Testartikel 4711</Title>
      <HitCount>0</HitCount>
      <LocationDefaulted>true</LocationDefaulted>
      <GetItFast>false</GetItFast>
      <PostalCode>54290</PostalCode>
      <PictureDetails>
       <PhotoDisplay>None</PhotoDisplay>
      </PictureDetails>
      <DispatchTimeMax>1</DispatchTimeMax>
      <ProxyItem>false</ProxyItem>
      <BuyerGuaranteePrice currencyID="EUR">20000.0</BuyerGuaranteePrice>
      <ReturnPolicy>
       <RefundOption>MoneyBack</RefundOption>
       <Refund>Money Back</Refund>
       <ReturnsAcceptedOption>ReturnsAccepted</ReturnsAcceptedOption>
       <ReturnsAccepted>Verbraucher haben das Recht, den Artikel unter den angegebenen Bedingungen zurückzugeben.</ReturnsAccepted>
      </ReturnPolicy>
      <PaymentAllowedSite>Germany</PaymentAllowedSite>
      </Item>
     </GetItemResponse>
     </soapenv:Body>
    </soapenv:Envelope>
    
    

    I hope someone can help. Thanks for your help anyway.

    Regards,

    Christoph

    Mittwoch, 22. September 2010 07:52

Antworten

  • Hallo Christoph,
    I'm having some trouble with an ASMX webservice I'm writing. The service seems to run without problems and the data which is coming in seems to be correct but in my WebMethods the parameter obejcts are null.

    da wir hier in einem deutschsprachigen Forum sind, antworte ich auch mal auf Deutsch.

    Da Du leider die relevanten Sachen alle weggelassen hast, poste bitte mal, was (und vor allem wie, wenn machbar, inkl. Code) der Client an deinen Webservice sendet.

    Wenn die Daten im Request korrekt ankommen sollten (kann man bspw. mal über HttpContext.Current.Request.SaveAs( "<Pfad>", True ) in eine Datei speichern und sich das dann in Ruhe anschauen), liegt es wohl an deinen Klassen, die dann die Deserialisierung verhindern. Allerdings sollte in dem Fall eher ein Fehler kommen als einfach Nothing/Null.

     


    Gruß, Stefan
    Microsoft MVP - Visual Developer ASP/ASP.NET
    http://www.asp-solutions.de/ - Consulting, Development
    http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
    Mittwoch, 22. September 2010 08:47
    Moderator