Copy link to clipboard
Copied
I'm about to write a web service web app. for the 2nd time. I'm new to this but my first app. was a success so I plan to do it again.
In both cases, the web services weren't written with CF. Not sure what language they used but this shouldn't be a problem as far as I understand because I'm just consuming and CF should be able to do that.
This time I'm facing an address manipulation software called QAS. This software should be able to do some formating to the input address. For example, if we pass in an address with a mix of lower and uppper case street name, without state and 5 digits zip, after being processed by this software, we'll get a nice formatted address back as a result where the first letter of the street name is capitalized, added the city, state and 9 digits zip with a dash in between. That's briefly what this software can do (it can do more than this but since this software is already there and has this capability, I'm going to use this particular functionality without having to re-invent the wheel).
In Production env., we should install this software in prod. web server but in dev. stage I can install the software in my local machine, as it is written in its manual. The url to the wsdl file when it is installed in local machine is referred to as http://localhost:2021/Proweb.wsdl The 2021 is the port where this software is installed. I open up in the browser and I can see the wsdl file display nicely.
Now the problem is, I'm using cfinvoke to invoke this web service as I did in the pass but I got error saying :Web service operation DoBulkSearch with parameters {DoSearch={3300 metzerott rd | adelphi | maryland | 20783},Country={Structure},Engine={Structure},Layout={Database layout}} cannot be found.
I communicated to the support, even they're helpful but since they don't speak ColdFusion they're not that helpful to me. My last question to them was asking them to comment on my approach, in a plain english, if the steps I currently use is wrong. Here is my question to them:
1. I’m trying to consume (invoke) a web service and reference the WSDL file through http://localhost;2021/Proweb.wsdl
2. The method that I’m using to invoke this web service is called: DoBulkSearch
3. I also pass a few parameters when invoking this web service and they are:
· Country, which has a value = USA
· Engine , which has a value = Verification
· Layout , which has a value = Database layout
· Search, which has a value = 1 riverside rd|new york|ny|blank zip
4. The end result expected from calling this web service is a formatted address, which steps from this is/are considered in correct. Please
advice
This is their answer:
Engine has to be the structure defined in the wsdl, Verification alone is not enough of a value to pass to it. I don’t know how to pass the
structure in coldfusion though.
Search has to be a structure as well. If you were to use the DoSearch method, then this string would be enough to pass, it might be easier to
start with this method.
In ColdFusion, I tried a couple of approach but unfortunately both are not working and gave the same error:
<cfinvoke webservice="http://localhost:2021/proweb.wsdl" method="DoBulkSearch" returnvariable="retVal">
<cfinvokeargument name="Country" value="USA">
<cfinvokeargument name="Engine" value="Verification">
<cfinvokeargument name="Layout" value="Database layout">
<cfinvokeargument name="Search" value="3223 st. paul street | | | 21218">
</cfinvoke>
<cfdump
var="#retVal#">
My Question is:
How can I pass Country, Engine, Search parameters and tell the remote site that these are structure paramater. In cfinvokeargument there is no "Type" attribute where I can write Type= "Structure"
OR this one is also not working:
Post / HTTP.1.0
Content-Type:text/xml
Content-Length:614
SOAPAction: "http://www.qas.com/web-2007-08/DoBulkSearch"
<?xml version="1.0" encoding="utf-8"?>
<cfsavecontent
variable="soap">
<cfoutput>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<qas:QABulkSearch xmlns:qas="http://www.qas.com/web-2007-08">
<qas:Country>USA</qas:Country>
<qas:Layout>Database layout</qas:Layout>
<qas:Engine Flatten="1" PromptSet="Default" Intensity="Close">Verification</qas:Engine>
<qas:BulkSearchTerm>
<qas:Search>3223 st. paul street | | | 21218</qas:Search>
</qas:BulkSearchTerm>
</qas:QABulkSearch>
</soapenv:Body>
</soapenv:Envelope>
</cfoutput>
</cfsavecontent>
<cfhttp
url="http://localhost:2021/proweb.wsdl/" method="post">
<cfhttpparam type="xml" name="DoBulkSearch" value="#trim(soap)#">
</cfhttp>
<cfdump
var="#soap#">
(screen shot of the wsdl file in text file)
Copy link to clipboard
Copied
You pass a structure as a parameter to a web service by making a ColdFusion structure and passing the structure to the web service. A structure is a complex variable containg a set of key-value pairs.
Using Arrays and Structures
http://livedocs.adobe.com/coldfusion/8/htmldocs/arrayStruct_01.html
A Brief example.
<cfset search = structNew()>
<cfset search.key1 = "Value1">
<cfset search.key2 = 2>
<cfset search.key3 = "Something Else">
You would then provide the variable search as the appropiate parameter to your web service.