你好,西蒙! 它看起來像Authorize.NET更新他們的服務與新領域,但忘了將它們添加到WSDL。
這是我送的示例請求(截獲使用Fiddler):
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo3vYq2eC/5VIuiUcm2hEtw8AABBBJr/dLQF7z02Y7UKwphq24W1n9j0XlQ1MiAlOjy5fO14ACQAA</VsDebuggerCausalityData>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetCustomerProfile xmlns="https://api.authorize.net/soap/v1/">
<merchantAuthentication>
<name>95U6bwXXXXX</name>
<transactionKey>8tf62gV7XXXXXX</transactionKey>
</merchantAuthentication>
<customerProfileId>37745529</customerProfileId>
</GetCustomerProfile>
</s:Body>
</s:Envelope>
這是響應:這裏
<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:Body>
<GetCustomerProfileResponse xmlns="https://api.authorize.net/soap/v1/">
<GetCustomerProfileResult>
<resultCode>Ok</resultCode>
<messages>
<MessagesTypeMessage>
<code>I00001</code>
<text>Successful.</text>
</MessagesTypeMessage>
</messages>
<profile>
<merchantCustomerId>33938</merchantCustomerId>
<email>[email protected]</email>
<customerProfileId>37745529</customerProfileId>
<paymentProfiles>
<CustomerPaymentProfileMaskedType>
<billTo>
<firstName>TEST</firstName>
<lastName>USER</lastName>
<company>Defender Razor</company>
<address>1 RODEO DRIVE</address>
<city>BEVERLY HILLS</city>
<state>CA</state>
<zip>90210</zip>
<country>UNITED STATES</country>
</billTo>
<customerProfileId>0</customerProfileId>
<customerPaymentProfileId>34313485</customerPaymentProfileId>
<payment>
<creditCard>
<cardNumber>XXXX5108</cardNumber>
<expirationDate>XXXX</expirationDate>
</creditCard>
</payment>
</CustomerPaymentProfileMaskedType>
</paymentProfiles>
</profile>
</GetCustomerProfileResult>
</GetCustomerProfileResponse>
</soap:Body>
</soap:Envelope>
一切是正確的 - 因爲你可以看到payment
節點正確發送。
然而 - 與.NET反序列化屬性事項的順序 - 爲所生成的References.cs
文件中指定。
[System.Xml.Serialization.XmlElementAttribute(Order=0)]
事實證明,兩個新字段添加到響應billTo
和customerProfileId
,但他們並沒有加入到WSDL。
所以,當試圖反序列化領域billTo
被發現,但不是什麼預期 - 所以一切都結束了空。
如果加上這兩行(並謹慎地補充他們的正是這種類型),那麼你可以重新生成references.cs文件(通過在服務引用右擊並重新生成文件)。
如果您是通過網址https://api.authorize.net/soap/v1/Service.asmx?WSDL
生成代理,那麼您需要在本地下載此文件作爲Service.wsdl
並從那裏生成代理。
<s:element minOccurs="1" maxOccurs="1" name="billTo" type="tns:CustomerAddressType"/>
<s:element minOccurs="1" maxOccurs="1" name="customerProfileId" type="s:long" />
<s:complexType name="CustomerPaymentProfileMaskedType">
<s:complexContent mixed="false">
<s:extension base="tns:CustomerPaymentProfileBaseType">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="billTo" type="tns:CustomerAddressType"/>
<s:element minOccurs="1" maxOccurs="1" name="customerProfileId" type="s:long" />
<s:element minOccurs="1" maxOccurs="1" name="customerPaymentProfileId" type="s:long" />
<s:element minOccurs="0" maxOccurs="1" name="payment" type="tns:PaymentMaskedType" />
<s:element minOccurs="0" maxOccurs="1" name="driversLicense" type="tns:DriversLicenseMaskedType" />
<s:element minOccurs="0" maxOccurs="1" name="taxId" type="s:string" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
在檢測到之前,我損失了12個小時的付款。幸運的是我有客戶的電子郵件,但這非常糟糕。您不能只將字段添加到訂單重要的響應中。甚至更糟糕的是,你不能忘記將它們添加到WSDL中。
這對我來說是速戰速決。我可能會轉而在某個時候使用適當的API--我已經向Authorize.net報告了這一點,希望他們也能做出迴應。
這是References.cs後,我做了我的變化的差異。正如你所看到的Order
財產已經增加:
你在沙箱裏試過了嗎?它會給你同樣的結果嗎? –
其實是的,它的確如此 - 我想出了這個問題,我即將作出迴應 - 希望它可以幫助其他人(並希望他們不會像這樣再次破壞它)...... –