如何在 VS2010 中使用 Perceptive MCAPI(vb.net 4.0 框架)
尝试启动并运行 PerceptiveMC API (http://perceptivemcapi.codeplex.com/)。从文档中我可以获得“测试安装”,好的
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.Load
Dim apikey As String = "YourApikey" ' or default to config
GridView1.DataSource = MCAPISettings.ListAPISettings().ToList()
GridView1.DataBind()
End Sub
我正在尝试使用“ListSubscribe”将测试输入到我的 MailChimp 列表,但我的输出每次都返回失败
Dim input As listSubscribeInput = New listSubscribeInput()
input.api_AccessType = EnumValues.AccessType.XmlRpc
input.api_OutputType = EnumValues.OutputType.XmlRpc
input.api_Validate = True
input.parms.apikey = "xxxxxxxxxxxxxxxxxx-us4"
input.parms.id = "xxxxxxxxx"
input.parms.email_address = "[email protected]"
input.parms.email_type = EnumValues.emailType.html
input.parms.double_optin = True
input.parms.send_welcome = True
input.parms.update_existing = True
input.parms.replace_interests = True
input.parms.merge_vars.Add("FNAME", "Test")
input.parms.merge_vars.Add("LNAME", "Test")
' do it
Dim cmd As New listSubscribe(input)
Dim output As listSubscribeOutput = cmd.Execute()
' check output
If output.result = True Then
Response.Write("Success")
Else
Response.Write("Fail")
End If
在调试过程中我可以看到 cmd< /code> 看起来已按预期填充,但
output.result
返回 false。
构建代码时我没有看到任何错误消息或警告。谁能建议如何发现问题所在?
编辑
好的,这是我遇到的错误:
The remote name could not be resolved: 'us4.api.mailchimp.com' at
System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at
System.Net.HttpWebRequest.GetRequestStream() at
CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object clientObj, MethodInfo mi, Object[]
parameters) at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(MethodInfo mi, Object[]
Parameters) at XmlRpcProxy2e8b139c-9016-4a0e-8cc6-5d8c78fa9a26.listSubscribe(String
apikey, String id, String email_address, XmlRpcStruct merge_vars, String email_type,
Boolean double_optin, Boolean update_existing, Boolean replace_interests, Boolean
send_welcome) at PerceptiveMCAPI.Methods.listSubscribe.ExecuteXmlRpc()
编辑
上面的错误似乎是与我的测试运行的服务器直接相关的问题。我现在收到 407 需要代理身份验证的消息。
Trying to get the PerceptiveMC API (http://perceptivemcapi.codeplex.com/) up and running. From the documentation I am able to get the 'Test Install' OK
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Me.Load
Dim apikey As String = "YourApikey" ' or default to config
GridView1.DataSource = MCAPISettings.ListAPISettings().ToList()
GridView1.DataBind()
End Sub
I am trying to use the 'ListSubscribe' to enter a test to my MailChimp list but my output returns a failure each time
Dim input As listSubscribeInput = New listSubscribeInput()
input.api_AccessType = EnumValues.AccessType.XmlRpc
input.api_OutputType = EnumValues.OutputType.XmlRpc
input.api_Validate = True
input.parms.apikey = "xxxxxxxxxxxxxxxxxx-us4"
input.parms.id = "xxxxxxxxx"
input.parms.email_address = "[email protected]"
input.parms.email_type = EnumValues.emailType.html
input.parms.double_optin = True
input.parms.send_welcome = True
input.parms.update_existing = True
input.parms.replace_interests = True
input.parms.merge_vars.Add("FNAME", "Test")
input.parms.merge_vars.Add("LNAME", "Test")
' do it
Dim cmd As New listSubscribe(input)
Dim output As listSubscribeOutput = cmd.Execute()
' check output
If output.result = True Then
Response.Write("Success")
Else
Response.Write("Fail")
End If
During debugging I can see that cmd
looks to be populated as expected but output.result
returns as false.
I am not seeing any error message or warnings when building the code. Can anyone suggest how to uncover what the problem is?
EDIT
Ok, here is the error that I am encountering:
The remote name could not be resolved: 'us4.api.mailchimp.com' at
System.Net.HttpWebRequest.GetRequestStream(TransportContext& context) at
System.Net.HttpWebRequest.GetRequestStream() at
CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(Object clientObj, MethodInfo mi, Object[]
parameters) at CookComputing.XmlRpc.XmlRpcClientProtocol.Invoke(MethodInfo mi, Object[]
Parameters) at XmlRpcProxy2e8b139c-9016-4a0e-8cc6-5d8c78fa9a26.listSubscribe(String
apikey, String id, String email_address, XmlRpcStruct merge_vars, String email_type,
Boolean double_optin, Boolean update_existing, Boolean replace_interests, Boolean
send_welcome) at PerceptiveMCAPI.Methods.listSubscribe.ExecuteXmlRpc()
EDIT
The above error seems to be a problem directly related to the server that my test is running on. I am now getting a 407 Proxy Authentication required message.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过向我的 us4.api.mailchimp.com 代理添加例外解决了这个问题
This was resolved by adding an exception to my proxy for us4.api.mailchimp.com