Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using CF and XML

Status
Not open for further replies.

GUJUm0deL

Programmer
Jan 16, 2001
3,676
0
0
US
Can anyone help me? I need to use SOAP and XML with CF. I don't know how to begin. How do I setup SOAP and XML to be used with CF?

Thanks.

[sub]
____________________________________
Just Imagine.
[sub]
 
phew... took me a bit to find this again but this is a very good article that might get you started.


Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 

If you're using MX, then the axis soap engine is on your server. (diff ver based on service pack)

You can write your code in cfc's and call it in a browser with "?WSDL" as your query string and it will return the cfc as a web service wrapped in soap. CF does it all for you....you shouldn't have to write any soap, unless you really want to learn.

Hope that helps
 
bombboy, thanks for the link. Looking at it now.

dallasweb, how do I write a CFC that does what you just said? If I can get CF to do all the work, then saves me lots of time.

[sub]
____________________________________
Just Imagine.
[sub]
 
bombboy...

Here is a sample of how to write a component (CFC)

Save as something.cfc and then call it from a browser as something.cfc?WSDL....a you'll see you soap doc. There is some good documentation avail on the web ...just search for coldfusion cfc

<cffunction access="remote" name="findSomething" output="false" returntype="string" hint="Return output: verifySomethingResult( XML string )">
<cfargument name="somevar" required="true">
<cfset variables.errormessage="">
....do a query or something....get some data
....what I do is wrap it up as XML

<cfset variables.verifySomethingResult=''>
<cfset variables.verifySomethingResult = variables.verifyDocResult & '<?xml version="1.0" encoding="UTF-8" ?>'>
<cfset variables.verifySomethingResult = variables.verifyDocResult & '<result>'>
<cfset variables.verifyDocResult = variables.verifyDocResult & '<something>#variables.something#</something>'>
<cfset variables.verifyDocResult = variables.verifyDocResult & '</result>'>
<cfreturn variables.verifyDocResult>
</cffunction>
</cfcomponent>

Good luck

 
Here is the result of the above code:
something.cfc?WSDL

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace=" xmlns:impl=" xmlns:intf=" xmlns:apachesoap=" xmlns:wsdlsoap=" xmlns:soapenc=" xmlns:xsd=" xmlns:tns1=" xmlns:wsdl=" xmlns=" xmlns=" targetNamespace=" namespace=" name="CFCInvocationException"><sequence/></complexType></schema></wsdl:types>
<wsdl:message name="findSomethingResponse">
<wsdl:part name="findSomethingReturn" type="xsd:string"/>
</wsdl:message>
<wsdl:message name="findSomethingRequest">
<wsdl:part name="somevar" type="xsd:anyType"/>
</wsdl:message>
<wsdl:message name="CFCInvocationException">
<wsdl:part name="fault" type="tns1:CFCInvocationException"/>
</wsdl:message>
<wsdl:portType name="deleteme">
<wsdl:eek:peration name="findSomething" parameterOrder="somevar">
<wsdl:input name="findSomethingRequest" message="impl:findSomethingRequest"/>
<wsdl:eek:utput name="findSomethingResponse" message="impl:findSomethingResponse"/>
<wsdl:fault name="CFCInvocationException" message="impl:CFCInvocationException"/>
</wsdl:eek:peration>
</wsdl:portType>
<wsdl:binding name="deleteme.cfcSoapBinding" type="impl:deleteme">
<wsdlsoap:binding style="rpc" transport=" <wsdl:eek:peration name="findSomething">
<wsdlsoap:eek:peration soapAction=""/>
<wsdl:input name="findSomethingRequest">
<wsdlsoap:body use="encoded" encodingStyle=" namespace=" </wsdl:input>
<wsdl:eek:utput name="findSomethingResponse">
<wsdlsoap:body use="encoded" encodingStyle=" namespace=" </wsdl:eek:utput>
<wsdl:fault name="CFCInvocationException">
<wsdlsoap:fault use="encoded" encodingStyle=" namespace=" </wsdl:fault>
</wsdl:eek:peration>
</wsdl:binding>
<wsdl:service name="deletemeService">
<wsdl:port name="deleteme.cfc" binding="impl:deleteme.cfcSoapBinding">
<wsdlsoap:address location=" </wsdl:port>
</wsdl:service>
</wsdl:definitions>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top