Sudzc问题解析一个String

时间:2013-04-23 14:13:45

标签: iphone ios xml soap

我正在使用Sudzc解析soap XML。

我正在设置:

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];

来自网络服务:

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

1 个答案:

答案 0 :(得分:0)

问题在于命名空间:

在内部"SDZAmount.m",我需要改变:

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

为:

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