I have tried to rewrite your sample php application in ColdFusion but i'm receiving errors.
It's a simple application, but I keep getting this error:
Here's the code for my coldfusion app:
Here's the XML that I am posting:
and if I just post the XML file to the webservice (like this: <cfset result = cnp_client.Operation(form.txtParam)> rather than placing it in an array), I get this response:
Any idea what i'm doing wrong here? I don't have much experience with any SOAP API's and I don't really know what I should be receiving or passing into these soap requests.. The samples I have seen haven't given me much direction.
Thanks for any help,
-Jason
It's a simple application, but I keep getting this error:
Code:
[TABLE="width: 500"] [TR] [TD="width: 500, align: left"][B]Cannot perform web service invocation Operation.[/B][/TD] [/TR] [TR] [TD="width: 400, colspan: 2"][COLOR=black]The fault returned when invoking the web service operation is: AxisFault faultCode: {http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher}InternalServiceFault faultSubcode: faultString: Object reference not set to an instance of an object. faultActor: faultNode: faultDetail: {http://schemas.datacontract.org/2004/07/System.ServiceModel}ExceptionDetail:Object reference not set to an instance of an object. at PaymentService.Operation(String instruction) at SyncInvokeOperation(Object , Object [] , Object[] ) at ...[/COLOR][/TD] [/TR] [/TABLE]
Code:
<cfif isdefined('form.submit')> <cfsavecontent variable="xml"> <cfoutput>#txtParam#</cfoutput> </cfsavecontent> <cfif form.txtParam NEQ ''> <cfscript> cnp_client = createobject('webservice','https://paas.cloud.clickandpledge.com/paymentservice.svc?wsdl'); </cfscript> <cfset params=StructNew()> <cfset params.instruction = form.txtParam> <cfset result = cnp_client.Operation(params)> <cfdump var="#result#"> </cfif> </cfif> <HTML> <HEAD> <TITLE>Click & Pledge API</TITLE> </HEAD ><BODY> <cfform action="" method="post"> <!-- Copy & paste the XML request below --> <p><cftextarea id="txtParam" name="txtParam" rows="5" cols="60"></cftextarea> <br /> <cfinput type="submit" value="Process Request" name="submit"/> </p> </cfform> </BODY> </HTML>
Code:
<CnPAPI xmlns="urn:APISchema.xsd"> <Version>12</Version> <Engine> <Request> <Operation> <OperationType>Transaction</OperationType> <IPAddress>192.168.0.11</IPAddress> </Operation> <Authentication> <AccountGuid>ddd31189-9a80-41d9-99e7-fdbb4350893c</AccountGuid> <AccountID>14521</AccountID> </Authentication> <Order> <OrderMode>Test</OrderMode> <CardHolder> <BillingInformation> <BillingFirstName>John</BillingFirstName> <BillingMI>C</BillingMI> <BillingLastName>Smith</BillingLastName> <BillingEmail>[email protected]</BillingEmail> <BillingPhone>123.456.7890</BillingPhone> </BillingInformation> <BillingAddress> <BillingAddress1>Post Office Box 1000</BillingAddress1> <BillingAddress2></BillingAddress2> <BillingAddress3></BillingAddress3> <BillingCity>Blacksburg</BillingCity> <BillingStateProvince>VA</BillingStateProvince> <BillingPostalCode>12346-4563</BillingPostalCode> <BillingCountryCode>840</BillingCountryCode> </BillingAddress> <CustomFieldList> <CustomField> <FieldName>Employer</FieldName> <FieldValue>Good Company</FieldValue> </CustomField> <CustomField> <FieldName>Occupation</FieldName> <FieldValue>Good Job</FieldValue> </CustomField> <CustomField> <FieldName>Place of Employment</FieldName> <FieldValue>Blacksburg, Virginia</FieldValue> </CustomField> </CustomFieldList> <PaymentMethod> <PaymentType>CreditCard</PaymentType> <CreditCard> <NameOnCard>John Smith</NameOnCard> <CardNumber>4111111111111111</CardNumber> <Cvv2>123</Cvv2> <ExpirationDate>04/15</ExpirationDate> </CreditCard> </PaymentMethod> </CardHolder> <ThirdParty> <SocialNetworks> <Network> <NetworkName>Twitter</NetworkName> <NetworkUserID>UserID</NetworkUserID> <NetworkPassword>Password</NetworkPassword> <NetworkComment>Sample twitter message</NetworkComment> </Network> </SocialNetworks> </ThirdParty> <OrderItemList> <OrderItem> <ItemID>1</ItemID> <ItemName>Donation</ItemName> <Quantity>1</Quantity> <UnitPrice>1000</UnitPrice> <UnitDeductible>1000</UnitDeductible> </OrderItem> </OrderItemList> <Receipt> <SendReceipt>true</SendReceipt> <WID>30168</WID> <Deductible>0</Deductible> </Receipt> <Transaction> <TransactionType>Authorize</TransactionType> <CurrentTotals> <TotalDeductible>1000</TotalDeductible> <Total>1000</Total> </CurrentTotals> </Transaction> </Order> </Request> </Engine> </CnPAPI>
Class Name | org.datacontract.schemas._2004._07.CcTransactionRe sult | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
Methods |
|
Any idea what i'm doing wrong here? I don't have much experience with any SOAP API's and I don't really know what I should be receiving or passing into these soap requests.. The samples I have seen haven't given me much direction.
Thanks for any help,
-Jason
Comment