2013-04-23 35 views
0

我使用Sudzc來解析一個soap XML。Sudzc問題來解析一個字符串

我設置:

amount.currency = @"BRL"; 

它給了我下面的錯誤:

validation 138 Unsupported currency specified 

的logcat:

<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:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>validation 138 Unsupported currency specified</faultstring></soap:Fault></soap:Body></soap:Envelope> 

我知道WSDL是好的。那麼我應該在哪裏尋找這個錯誤?

SDZPayment* service = [SDZPayment service]; 
    service.logging = YES; 
    service.username = @"**************"; 
    service.password = @"****************"; 


    SDZAmount *amount = [SDZAmount new]; 
    amount.value = (long)100; 
    amount.currency = @"BRL"; 

    SDZCard *card = [SDZCard new]; 
    card.cvc = @"412"; 
    card.number = @"21432423423"; 
    card.holderName = @"Marcus Ataide"; 
    card.expiryMonth = @"12"; 
    card.expiryYear = @"2017"; 
    card.brand = @"visa"; 
    card.issueNumber = @"10"; 
    card.startMonth = @"10"; 
    card.startYear = @"2010"; 

    SDZPaymentRequest *payment = [SDZPaymentRequest new]; 
    payment.amount = amount; 
    payment.card = card; 
    payment.merchantAccount = @"*************"; 
    payment.shopperReference = @"123456"; 


    // Returns SDZPaymentResult* 
    /* */ 
    [service authorise:self action:@selector(authoriseHandler:) paymentRequest: payment]; 

從Web服務:

<xsd:complexType name="Amount"> 
<xsd:sequence> 
<xsd:element minOccurs="1" name="currency"> 
<xsd:simpleType> 
<xsd:restriction base="xsd:string"> 
<xsd:minLength value="3"/> 
<xsd:maxLength value="3"/> 
</xsd:restriction> 
</xsd:simpleType> 
</xsd:element> 
<xsd:element minOccurs="1" name="value" type="xsd:long"/> 
</xsd:sequence> 
</xsd:complexType> 

回答

0

的問題是與命名空間:

裏面,"SDZAmount.m",我需要改變:

[s appendString: [Soap serialize: self.currency]]; 

到:

[s appendFormat: @"<currency xmlns=\"http://common.services.adyen.com\">%@</currency>", [Soap serialize: self.currency]];