Yodlee - startSiteRefresh给出405(方法不允许)

时间:2014-05-20 01:42:40

标签: java scala soap axis yodlee

我正在尝试刷新某个用户帐户的所有网站(有时当用户输入某些类型的帐户时,他们无法完全刷新,因此我们不会进行完全强制刷新所有用户帐户)

根据startSiteRefresh,我们应该使用startSiteRefresh,但我在实际调用405时收到startSiteFresh错误,即Locators.refreshService.startSiteRefresh(userContext,id,refreshParameters)

以下是代码(用scala编写,但使用java axis / soap API),该代码应对应于here所示的逻辑。

  def initiateRefresh(userContext:UserContext)(implicit cobrandContext:CobrandContext) = {
    val toRefresh = Locators.siteAccountManagement.getAllSiteAccounts(userContext).list.collect{
      case x:SiteAccountInfo if
        x.getSiteRefreshInfo.getSiteRefreshStatus == SiteRefreshStatus.REFRESH_NEVER_INITIATED ||
        x.getSiteRefreshInfo.getSiteRefreshStatus == SiteRefreshStatus.REFRESH_TIMED_OUT ||
        x.getSiteRefreshInfo.getSiteRefreshStatus == SiteRefreshStatus.REFRESH_COMPLETED
          => x.getSiteAccountId
    }

    val refreshParameters = new RefreshParameters()
    refreshParameters.setRefreshPriority(RefreshInitiate.High.id.toInt)
    refreshParameters.setRefreshMode(RefreshMode.NORMAL_REFRESH_MODE)
    refreshParameters.setForceRefresh(true)

    toRefresh.foreach{id =>
      Locators.refreshService.startSiteRefresh(userContext,id,refreshParameters)
    }
  }

RefreshInitiate在这里定义

sealed abstract class RefreshInitiate(val id:Long)

object RefreshInitiate {
  case object High extends RefreshInitiate(1)
  case object Low extends RefreshInitiate(2)
  case object StopReasonTimeout extends RefreshInitiate(100)
  case object StopReasonUserAborted extends RefreshInitiate(101)
  case object StopReasonMFATimeout extends RefreshInitiate(102)
  case object StopReasonMFAGathererTimeout extends RefreshInitiate(103)
}

所以RefreshInitiate.High.id.toInt对应于Int(1),这取自java_soap_example com.yodlee.sampleapps.helper.RefreshHelper class

其他调用,例如startSiteReferesh2(在java_soap_example中使用)和startSiteRefresh7也会返回405

这是来自呼叫的堆栈跟踪

<p>
            (405)Method Not Allowed
          </p>
        </div>
        <div class="details block">
          <pre class="stacktrace">at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)</pre>
          <pre class="stacktrace">at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)</pre>
          <pre class="stacktrace">at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)</pre>
          <pre class="stacktrace">at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)</pre>
          <pre class="stacktrace">at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)</pre>
          <pre class="stacktrace">at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)</pre>
          <pre class="stacktrace">at org.apache.axis.client.Call.invokeEngine(Call.java:2784)</pre>
          <pre class="stacktrace">at org.apache.axis.client.Call.invoke(Call.java:2767)</pre>
          <pre class="stacktrace">at org.apache.axis.client.Call.invoke(Call.java:2443)</pre>
          <pre class="stacktrace">at org.apache.axis.client.Call.invoke(Call.java:2366)</pre>
          <pre class="stacktrace">at org.apache.axis.client.Call.invoke(Call.java:1812)</pre>
          <pre class="stacktrace">at com.yodlee.soap.core.refresh.refresh.RefreshServiceSoapBindingStub.startSiteRefresh(RefreshServiceSoapBindingStub.java:5079)</pre>
          <pre class="stacktrace">at com.monetise.yodlee.login.Sites$$anonfun$initiateRefresh$1.apply(Sites.scala:98)</pre>

所以看起来是Yodlee将405作为一个实际的HTTP错误(而不是Yodlee正在刷新的实际网站抛出错误代码)

EDIT3:正在使用的刷新定位器定义如下

  def refreshService = {
    def locator = new RefreshServiceLocator()
    val serviceName = locator.getRefreshServiceWSDDServiceName + Settings.sdkVersion
    locator.setRefreshServiceEndpointAddress(
      Settings.soapURL + "/" + serviceName
    )
    locator.getRefreshService
  }

URL的配置如下

export YODLEE_SOAPURL="https://rest.developer.yodlee.com/services/services"
export YODLEE_SDKVERSION="_12_0"

端点的最终网址最终为https://rest.developer.yodlee.com/services/services/RefreshService_12_0

1 个答案:

答案 0 :(得分:0)

请问您是否使用了正确的服务名称?

虽然我提供了一些Java代码供您帮助,但这可能有所帮助。

RefreshServiceLocator locator = new RefreshServiceLocator();
String serviceName = locator.getRefreshServiceWSDDServiceName();
serviceName = serviceName + getSDKVersion(); //SDKversion which you are using
locator.setRefreshServiceEndpointAddress(System.getProperty("com.yodlee.soap.services.url")
+ "/" + serviceName1);
refresh = locator.getRefreshService();

除此之外,您还可以检查所有配置是否正确? Here是另一个可以提供帮助的线程(与Yodlee无关,但通常与405相关)。