Created
March 25, 2014 10:41
-
-
Save bennadel/9759000 to your computer and use it in GitHub Desktop.
AxisFault: ColdFusion Web Services And XML Data Types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfcomponent | |
output="false" | |
hint="I am a test web service component."> | |
<cffunction | |
name="Test" | |
access="remote" | |
returntype="string" | |
output="false" | |
hint="I take an XML argument."> | |
<!--- Define arguments. ---> | |
<cfargument | |
name="Data" | |
type="xml" | |
required="true" | |
hint="I am the xml data." | |
/> | |
<!--- Define the local scope. ---> | |
<cfset var LOCAL = {} /> | |
<!--- Get the value. ---> | |
<cfset LOCAL.ValueNodes = XmlSearch( | |
XmlParse( ARGUMENTS.Data ), | |
"//value" | |
) /> | |
<!--- Get the value. ---> | |
<cfset LOCAL.Value = LOCAL.ValueNodes[ 1 ].XmlText /> | |
<!--- Return value. ---> | |
<cfreturn LOCAL.Value /> | |
</cffunction> | |
</cfcomponent> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Build our WSDL Url. ---> | |
<cfset strURL = ( | |
"http://localhost" & | |
GetDirectoryFromPath( CGI.script_name ) & | |
"WS.cfc?wsdl" | |
) /> | |
<!--- Build our XML data. ---> | |
<cfsavecontent variable="strData"> | |
<data> | |
<value>Test</value> | |
</data> | |
</cfsavecontent> | |
<!--- Invoke the web service. ---> | |
<cfinvoke | |
returnvariable="strResponse" | |
webservice="#strURL#" | |
method="Test" | |
refreshwsdl="true"> | |
<cfinvokeargument name="Data" value="#Trim( strData )#" /> | |
</cfinvoke> | |
<!--- Output the response. ---> | |
<cfoutput> | |
#strResponse# | |
</cfoutput> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Output ARGUMENTS. ---> | |
<cfdump | |
var="#ARGUMENTS#" | |
format="html" | |
output="#ExpandPath( './dump.htm' )#" | |
/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Define arguments. ---> | |
<cfargument | |
name="Data" | |
type="string" | |
required="true" | |
hint="I am the xml data." | |
/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment