CF Web服务阵列与.Net Web服务阵列

时间:2012-12-18 00:25:45

标签: coldfusion

MethodCRM api在.Net

中有这个例子
Dim arrUpdateFieldsArray(1) As String
Dim arrUpdateValueArray(1) As String

arrUpdateFieldsArray(0) = Me.txtUpdateField1.Text
arrUpdateValueArray(0) = Me.txtUpdateValue1.Text
arrUpdateFieldsArray(1) = Me.txtUpdateField12Text
arrUpdateValueArray(1) = Me.txtUpdateValue2.Text

'Call the MethodAPI to update the record
sResult = wbsMethodAPI.MethodAPIUpdateV2(sCompanyAccount, sUserName, sPassword, "", _sUpdateTable, arrUpdateFrieldsArray, arrUpdateValueArray, intRecordID)
wbsMethodAPI = Nothing

我试图建立这个等价物,但没有成功,这就是我试过的

<CFSCRIPT>
    s = "salesRep,CustomerType";
    array1 = s.split(",");
    s = "#Signature_RepName#,#Payment_CompanyType#";
    array2 = s.split(",");

    string = CreateObject("java", "java.lang.String");
    array = CreateObject("java", "java.lang.reflect.Array");
    cookies = array.newInstance(string.getClass(), 3);
    array.set(cookies, 0, "salesRep");
    array.set(cookies, 1, "CustomerType");

    string2 = CreateObject("java", "java.lang.String");
    array2 = CreateObject("java", "java.lang.reflect.Array");
    cookies2 = array2.newInstance(string.getClass(), 3);
    array2.set(cookies2, 0, "#Signature_RepName#");
    array2.set(cookies2, 1, "#Payment_CompanyType#");
</CFSCRIPT>

<cfhttp url="https://www.methodintegration.com/MethodAPI/service.asmx/MethodAPIUpdateV2" method="GET"> 
    <cfhttpparam type="URL" name="strCompanyAccount" value="xxxx"/>
    <cfhttpparam type="URL" name="strLogin" value="xxxx"/>
    <cfhttpparam type="URL" name="strPassword" value="xxxx"/>
    <cfhttpparam type="URL" name="strSessionID" value=""/>
    <cfhttpparam type="URL" name="strTable" value="Customer"/>
    <cfhttpparam type="URL" name="arrUpdateFieldsArray" value=#cookies#/>
    <cfhttpparam type="URL" name="arrUpdateValueArray" value=#cookies2#/>
    <cfhttpparam type="URL" name="intRecordID" value="#customerid#"/>
</cfhttp>

请让我知道我做错了什么。 TIA

1 个答案:

答案 0 :(得分:4)

根据http://www.methodintegration.com/Method-API-for-QuickBooks-CRM.aspx,我认为这些是SOAP Web服务。证明:https://www.methodintegration.com/MethodAPI/service.asmx?wsdl

因此,请使用cfinvoke来使用它们。

<cfinvoke 
     webservice="https://www.methodintegration.com/MethodAPI/service.asmx?wsdl" 
     method="MethodAPIUpdateV2" 
     returnVariable="ws" >
    <cfinvokeargument name="strCompanyAccount" value="" />
    <cfinvokeargument name="strLogin" value="" />
    <cfinvokeargument name="strPassword" value="" />
    <cfinvokeargument name="strSessionID" value="" />
    <cfinvokeargument name="strTable" value="" />
    <cfinvokeargument name="arrUpdateFieldsArray" value="" />
    <cfinvokeargument name="arrUpdateValueArray" value="" />
    <cfinvokeargument name="intRecordID" value="" />
</cfinvoke>

<cfset wbsMethodAPI 
   = createObject("webservice",
                  "https://www.methodintegration.com/MethodAPI/service.asmx?wsdl")>
<cfset ws = wbsMethodAPI.MethodAPIUpdateV2(
  strLogin="", strCompanyAccount="", strTable="", arrUpdateValueArray="", 
  arrUpdateFieldsArray="", intRecordID="", strPassword="", strSessionID="")>

请参阅:http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-78b4.html

2个数组的类型为tns:ArrayOfString,请参阅:http://forums.adobe.com/message/4337438