你好,西蒙! 它看起来像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
财产已经增加:
你在沙箱里试过了吗?它会给你同样的结果吗? –
其实是的,它的确如此 - 我想出了这个问题,我即将作出回应 - 希望它可以帮助其他人(并希望他们不会像这样再次破坏它)...... –