I'm very new to SOAP, but I've looked all over and can't seem to get an answer for this. I think it has to do with the SOAPAction in the <cfhttpparam> tag but I'm not sure what the syntax is. Whatever I put in produces the following error:
The message with Action 'http://InvoiceCollector.hypur.com/PostInvoice' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher.
This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
My SOAP body looks like this:
<cfsavecontent variable="SOAPBody">
<cfoutput>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:dat="http://schemas.datacontract.org/2004/07/DataTransferObjects">
<soapenv:Header/>
<soapenv:Body>
<tem:PostInvoice>
<tem:PoSToken>"XXXXX"</tem:PoSToken>
<tem:MerchantToken>"XXXXX"</tem:MerchantToken>
<tem:Invoice>
<dat:Cash>1</dat:Cash>
<dat:Change>1</dat:Change>
<dat:CreatedBy>"Me"</dat:CreatedBy>
<dat:CurrencyCode>"usd"</dat:CurrencyCode>
<dat:DiscountAmount>1</dat:DiscountAmount>
<dat:DiscountPercent>1</dat:DiscountPercent>
<dat:DueDate>2015-08-13T12:00:00</dat:DueDate>
<dat:InvoiceDate>2015-08-13T12:00:00</dat:InvoiceDate>
<dat:InvoiceItems>
<dat:InvoiceItemDTO>
<dat:Description>"Desc"</dat:Description>
<dat:DiscountAmount>1</dat:DiscountAmount>
<dat:DiscountPercent>1</dat:DiscountPercent>
<dat:Name>"Adam"</dat:Name>
<dat:Quantity>1</dat:Quantity>
<dat:Unit>"lb"</dat:Unit>
<dat:UnitPrice>1</dat:UnitPrice>
</dat:InvoiceItemDTO>
</dat:InvoiceItems>
<dat:InvoiceNumber>123</dat:InvoiceNumber>
<dat:InvoiceTax>1</dat:InvoiceTax>
<dat:IsTaxCalculatedAfterDiscount>false</dat:IsTaxCalculatedAfterDiscount>
<dat:MerchantMemo>"Memo"</dat:MerchantMemo>
<dat:Note>"Note"</dat:Note>
<dat:PaidDate>2015-08-13T12:00:00</dat:PaidDate>
<dat:PoSID>2</dat:PoSID>
<dat:PoSName>1</dat:PoSName>
<dat:Status>1</dat:Status>
<dat:SubTotal>1</dat:SubTotal>
<dat:TaxInclusive>1</dat:TaxInclusive>
<dat:Total>1</dat:Total>
</tem:Invoice>
</tem:PostInvoice>
</soapenv:Body>
</soapenv:Envelope>
</cfoutput>
</cfsavecontent>
which I've tested in soapUI and it connects with the website but has weird issues (it throws an enum error with any <status> values, but if I comment it out then it connects and returns error messages for invalid PoSToken and MerchantTokens, but after I enter those correctly, it doesn't return any data at all.)
I then grab the expected information with the following code:
<cfhttp url="https://devapi.hypur.com/InvoiceCollector/InvoiceCollector.svc?wsdl" method="post" result="httpResponse">
<cfhttpparam type="header" name="SOAPAction" value="http://InvoiceCollector.hypur.com/PostInvoice"/>
<cfhttpparam type="header" name="accept-encoding" value="no-compression"/>
<cfhttpparam type="xml" value="#trim(SOAPBody)#" />
<cfdump var="#soapResponse#">
And it doesn't matter what I put as the value in the
<cfhttpparam type="header" name="SOAPAction" value="http://InvoiceCollector.hypur.com/PostInvoice"/>
tag it always throws the same error.
Any help would be appreciated. Thank you in advance.
So, I ended up using the SOAPAction provided in soapUI (It's under the Raw HTML tab for the outgoing xml) and changed the Status value to Paid and got it working.
So the ColdFusion looks like this:
<cfhttp url="https://devapi.hypur.com/InvoiceCollector/InvoiceCollector.svc" method="post" result="httpResponse">
<cfhttpparam type="header" name="SOAPAction" value="http://tempuri.org/IInvoiceCollector/PostInvoice"/>
<cfhttpparam type="xml" value="#trim(SOAPBody)#" />
Just in case anyone else runs into this problem.