• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Create Soap webservice

Guest
Mar 14, 2008 Mar 14, 2008

Copy link to clipboard

Copied

Is there any example available for soap in coldfusion? So i can invoke soap to cfc webservice.

TOPICS
Advanced techniques

Views

2.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 14, 2008 Mar 14, 2008

Copy link to clipboard

Copied

Nick201 wrote:
> Is there any example available for soap in coldfusion? So i can invoke soap to cfc webservice.
>
>

Other then creating a CFC method with an 'access="remote"' parameter as
described in the documentation available on the internet and elsewhere?

http://livedocs.adobe.com/coldfusion/8/htmldocs/webservices_17.html

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 14, 2008 Mar 14, 2008

Copy link to clipboard

Copied

Then what is soap.. Is it possible to access this test.cfc?wsdl in php or java. Can I call that. What is useful for soap. why people using soap

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 14, 2008 Mar 14, 2008

Copy link to clipboard

Copied

Nick201 wrote:
> Then what is soap..

"Simple Object Access Protocol" originally, but now just "SOAP"
http://en.wikipedia.org/wiki/SOAP

> Is it possible to access this test.cfc?wsdl in php or java. C

Yes. The nice thing about ColdFusion is by simply adding
"access='remote' to a CFC function (aka method) ColdFusion
auto-magically builds the required SOAP WSDL interface. Just point
anybody who wants to consume your web service to uri (i.e.
'test.cfc?wsdl' and they should be off and running.

> What is useful for soap. why people using soap

To exchange data across this new fangled thing called the 'internets'.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 14, 2008 Mar 14, 2008

Copy link to clipboard

Copied

SO I someone request a DATA using my WSDL query then will get result set back right

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 14, 2008 Mar 14, 2008

Copy link to clipboard

Copied

Nick201 wrote:
> SO I someone request a DATA using my WSDL query then will get result set back right


That's the idea, sort of, more or less.

They request data using the 'web service' you build. Which ColdFusion
make rather painless --- usually. But when it is not painless it can be
quite frustrating.

The WSDL "Web Service Definition Language" is what tells anybody trying
to use your web service what is its API. I.E. What are the methods,
what arguments do these methods need and what do they return.
ColdFusion generates this file automatically when you designate at least
one method in a CFC as "access='remote'" and thus a web service.

So "WSDL query" is not a phrase that makes much sense.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 14, 2008 Mar 14, 2008

Copy link to clipboard

Copied

Is there any example of query invoke webservice. Thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 14, 2008 Mar 14, 2008

Copy link to clipboard

Copied

Nick201 wrote:
> Is there any example of query invoke webservice. Thanks


I'm not sure what type of an example you want. English seems to be a
bit of a barrier here.

But a simple method that returns a query.

<cfcomponent>
<cffunction name="aMethod" returnType="query" access="remote"
output="false">
<cfset var returnQry = "">

<cfquery name="returnQry" dataSource="aDSN">
SELECT aField
FROM aTable
</cfquery>

<cfreturn returnqry>
</cffunction>
</cfcomponent>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

I am running this issue here. I am getting this error message when I passed argument.

Web service operation "aMethod" with parameters {first_name={John}} could not be found.
Any idea thanks.

<cfcomponent>
<cffunction name="aMethod" returnType="query" access="remote" output="false">
<cfargument name="first_name" type="string" required="yes">
<cfquery name="returnQry" dataSource="abc">
SELECT first_name
FROM empwhere first_name='#ARGUMENTS.first_name#'
</cfquery>
<cfreturn returnqry>
</cffunction>
</cfcomponent>

<cfinvoke webservice=" http://catburg/test.cfc?wsdl" method="aMethod"
returnvariable="detailinfo">
<cfinvokeargument name="first_name" value="John">
</cfinvoke>
<cfdump var="#detailinfo#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

Nick201 wrote:
> I am running this issue here. I am getting this error message when I passed
> argument.
>
> Web service operation "aMethod" with parameters {first_name={John}} could not
> be found.
> Any idea thanks.


You may need to 'refresh' the web service in the ColdFusion
Administrator. ColdFusion caches the signature of a web service and it
must be refreshed if the signature changes.

A signature of a web service is it's URI, the names and return types of
the remote methods as well as the names and types of any arguments
passed to these methods.

If you created the method without the argument, for example; tested the
code; then added the argument - you would need to refresh the web
service in the Administrator.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

Thanks. It works internally ok. But if i am calling from other server I am getting this error message. Any idea

AXIS error
Sorry, something seems to have gone wrong... here are the details:

Fault - Error attempting to create Java skeleton for CFC web service; nested exception is:
coldfusion.xml.rpc.CFCInvocationException: [coldfusion.xml.rpc.SkeletonClassLoader$UnresolvedCFCDataTypeException : Could not resolve CFC datatype:
AxisFault
faultCode: { http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: Error attempting to create Java skeleton for CFC web service; nested exception is:
coldfusion.xml.rpc.CFCInvocationException: [coldfusion.xml.rpc.SkeletonClassLoader$UnresolvedCFCDataTypeException : Could not resolve CFC datatype:
faultActor:
faultNode:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

Nick201 wrote:
> Thanks. It works internally ok. But if i am calling from other server I am
> getting this error message. Any idea
>

What is the other server running?

If it is not ColdFusion, you may have trouble with a query return type.
Unfortunately a record set is not a universally implemented from
language to language. You may have to transfer a more basic complex
type such a structure or array.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

I have created cfc in my test server and I am calling cfc from my local machine (coldfusion server)

Also Do you have any example of basic complex type such a structure or array.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

Nick201 wrote:
> I have created cfc in my test server and I am calling cfc from my local machine (coldfusion server)

What do you get if you put the URI " http://catburg/test.cfc?wsdl" into
browser? Do you get the WSDL file? Or perhaps some connection error?
There maybe permissions problems and this should show it up.

> Also Do you have any example of basic complex type such a structure or array.

<cfset basicAry = arrayNew(1)>
<cfset basicAry[1] = "something">

<cfset basicStruct = structNew()>
<cfset basicStruct["aKey"] = "something else">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

Thanks,

You mean function return type query will cause problem. If I call this WSDL in .NET.

Coluld you please give me example of basic complex type such a structure or array in webservice.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

Nick201 wrote:
> Thanks,
>
> You mean function return type query will cause problem. If I call this WSDL in .NET.

It might. I do not know for sure from personal experience. But I
understand that 'query' means somewhat different things to different
languages.

>
> Coluld you please give me example of basic complex type such a structure or array in webservice.
>


<cffunction name="anArray" returnType="array" access="remote"
output="false">

<cfset var returnVal = arrayNew(1)>

<cfset returnVal[1] = "something">

<cfreturn returnVal>
</cffuntion>


<cffunction name="aStruct" returnType="struct" access="remote"
output="false">

<cfset var returnVal = structNew()>

<cfset returnVal["aKey"] = "something">

<cfreturn returnVal>
</cffuntion>

If this is required, it is fairly easy to loop over a query and rebuild
it as either a set of nested arrays and|or structures.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

could you please give me one working example of array or struc with query. I also would like to know how to output.

here is my code.

Since this function declare as array so this cfc should work with other programs. such as Java, . Net etc right?

<cfcomponent>
<cffunction name="aMethod" returntype="array" access="remote" output="false">
<cfargument name="first_name" type="string" required="yes">

<cfquery name="returnQry" dataSource="test">
SELECT top 10 first_name,last_name
FROM emp where first_name='#ARGUMENTS.first_name#'
</cfquery>

<cfset myarray=arraynew(2)>

<!--- Populate the array row by row --->
<cfloop query="returnQry">
<cfset myarray[CurrentRow][1]=first_name>
<cfset myarray[CurrentRow][2]=last_name>
</cfloop>


<cfreturn myarray>
</cffunction>
</cfcomponent>



<cfinvoke webservice=" http://catburg/array.cfc?wsdl" method="aMethod"
returnvariable="detailinfo">
<cfinvokeargument name="first_name" value="viki"/>
</cfinvoke>

<cfdump var="#detailinfo#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

Nick201 wrote:
> could you please give me one working example of array or struc with query. I
> also would like to know how to output.
>
> here is my code.
>
> Since this function declare as array so this cfc should work with other
> programs. such as Java, . Net etc right?

That's the idea. An array is a more universally implemented variable
type, thus it is supposedly more portable across disparate environments.

You have the right idea on how to loop over a query and create it as a
two-dimension array. To output you just have to go old school and write
your own iteration loops to handle it. Something along these lines:

<cfoutput>
<cfloop from="1" to="#arrayLen(detailInfo)#" index="foo">
<cfloop from="1" to="#arrayLen(detailInfo[foo])#" index="bar">
#detailInfo[foo][bar]#<br/>
</cfloop>
<hr/>
</cfloop>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

I am getting this error with webservice.. If i used componets i am not seeing any problems. Any idea thanks.


Could not perform web service invocation "aMethod".
Here is the fault returned when invoking the web service operation:

java.lang.NullPointerException


The error occurred in /var/www/html/tarang/qarray1.cfm: line 3

1 :
2 : <cfinvoke webservice=" http://catburg/qqarray.cfc?wsdl" method="aMethod"
3 : returnvariable="detailInfo">
4 : </cfinvoke>
5 :


<cfcomponent>
<cffunction name="aMethod" returntype="array" access="remote" output="false">

<cfquery name="returnQry" dataSource="test">
SELECT first_name,last_name
FROM emp where first_name='Danny'
</cfquery>

<cfset myarray=arraynew(2)>


<cfloop query="returnQry">
<cfset myarray[CurrentRow][1]=first_name>
<cfset myarray[CurrentRow][2]=last_name>
</cfloop>
<cfreturn myarray>
</cffunction>
</cfcomponent>

Call webservice
-------------------------------------------------

<cfinvoke webservice=" http://catburg/qqarray.cfc?wsdl" method="aMethod"
returnvariable="detailInfo">
</cfinvoke>


<cfoutput>
<cfloop from="1" to="#arrayLen(detailInfo)#" index="foo">
<cfloop from="1" to="#arrayLen(detailInfo[foo])#" index="bar">
#detailInfo[foo][bar]#<br/>
</cfloop>
<hr/>
</cfloop>
</cfoutput>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

Nick201 wrote:
> I am getting this error with webservice.. If i used componets i am not seeing
> any problems. Any idea thanks.
>
>
> Could not perform web service invocation "aMethod".
> Here is the fault returned when invoking the web service operation:
>
> java.lang.NullPointerException

Sorry, I don't see any obvious errors. The only advice I can give you
at this moment is to 'var' scope all your internal variables. The 'var'
scope is local to a single method and thus the variables will not clash
with similarly named variables in the in other methods or the global
'variables' scope.

<cffunction name="aMethod" returntype="array" access="remote"
output="false">
<!--- Initialize local function variables. --->
<cfset var returnQry = "">
<cfset var myarray = "">
...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2008 Mar 17, 2008

Copy link to clipboard

Copied

Nick201 wrote:
> I am getting this error with webservice.. If i used componets i am not seeing
> any problems. Any idea thanks.
>
>
> Could not perform web service invocation "aMethod".
> Here is the fault returned when invoking the web service operation:
>
> java.lang.NullPointerException

You have confirmed that putting the uri
" http://catburg/qqarray.cfc?wsdl" into a browser return the expected
WSDL file, correct?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 18, 2008 Mar 18, 2008

Copy link to clipboard

Copied

How can I call my simple wsdl in ASP. I would like to test it.

CFC I have only simple query.

select firstname from emp

thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 20, 2008 Mar 20, 2008

Copy link to clipboard

Copied

Nick201 wrote:
How can I call my simple wsdl in ASP. I would like to test it.

I think it's at this point that I would thank Ian Skinner for his help, his patience and the skillful way in which he has explained the web service concepts. I would then end there.



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 09, 2008 Apr 09, 2008

Copy link to clipboard

Copied

LATEST
how to make this webservice secure.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation