EasyCFM.COM ColdFusion Forums / Coding Help! / Web Service?

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Web Service?

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

arthurclark
10-31-2007 @ 10:50 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 166
Joined: May 2005

I am trying to query a data source through a pix firewall. Port 80 is open so I think I could get a query through with a web service. But how would I go about doing that? Can some on show me a good way to perform a query with a web service or a cfc as to query a remote data source using a where clause..... I would think that if you can answer this question you should sit on the Jedi Counsel

Coding Ninja Monkey

Ron
10-31-2007 @ 3:50 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 244
Joined: Oct 2004

All due respect; your post is not making total sense. seems you are mixing to seperate concepts here. would you like to use a web service or a query. If you are going to use a web service, one has to be set up on the remote server in order to make that possible (not sure if the remote server is yours) or do you want to establish a datasource to a remote servers db. If so I think the db type would be in order, and I dont beleive port 80 is where such traffic would occur.

arthurclark
10-31-2007 @ 3:58 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 166
Joined: May 2005

Ok both servers are mine one in the DMZ one in behind a PIX firewall. I need to do a query on a data source behind the PIX. So my question is can a web service provide a return from a query? If so what should the syntax be. No problem on setting up code on both ends just want it to pass through and can do on port 80 if web service right :-?......

Coding Ninja Monkey

Webmaster
10-31-2007 @ 4:07 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4533
Joined: Jan 2002

Let's set some definition.

Server A - sits outside the pix (in the DMZ) accessbile to the world.
Server B - sits behind the pix and is not world accessible.

The best thing to do is this. Can server "A" access internal ip ranges? such as 10.10.1.1 or something similar? and can that be configured to allow calls?

If the answer is no; then does server "B" have any ports open? (Port 80?) if so; then on that server you can setup a web service and the return type = "query".

Then on Server "A" you would do this:

<cfset webServiceGateway = createObject("webservice", "http://serverB/webservice.cfc?wsdl") />
<cfset qGetRecords = webserviceGateway.methodToGetQuery(sql="SELECT * FROM MyTable")/>


Then on server B you would create a file as follows:

<cfcomponent>

   <cffunction name="methodToGetQuery" returntype="query" access="remote">

      <cfargument name="sqlCode" type="string" required="yes" />

      <cfquery name="qGetData" datasaource="myDBInsidePix">
         #preserveSingleQuotes(arguments.sqlCode)#
      </cfquery>

      <cfreturn qGetData />

  </cffunction>

</cfcomponent>


that make sense?

Pablo Varando
Senior Application Architect
EasyCFM.COM, LLC.

904.483.1457 \\ mobile
webmaster@easycfm.com \\email

arthurclark
10-31-2007 @ 6:09 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 166
Joined: May 2005

The concept kind of makes sence but i am still getting errors when I try to run the page requesting the web service. It states that it can not generate stub objects for web service invocation :-?....

Coding Ninja Monkey

Webmaster
11-01-2007 @ 1:12 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4533
Joined: Jan 2002

Two things to check:

1) If you load the url in that machine's browser:
   http:// ...... ?wsdl

   Does it give you the XML wsdl?

2) If yes, go into the adminstrator and remove the webservice cache.

Pablo Varando
Senior Application Architect
EasyCFM.COM, LLC.

904.483.1457 \\ mobile
webmaster@easycfm.com \\email

arthurclark
11-01-2007 @ 10:34 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 166
Joined: May 2005

Could not perform web service invocation "methodToGetQuery". When I try to load page on Server A .....

Attribute validation error for tag CFQUERY.  
when I load webservice.cfc and webservice.cfm on server A



Question However querys from the data source wrok on server B.
The thing that has me very puzzled is that the applicatoins in which I need the data source from work on server A.
Question

this exsists on server A page to pull query

<cfset webServiceGateway = createObject("webservice", "http://SERVERIP/webservice.cfc?wsdl") />

<cfset qGetRecords = webserviceGateway.methodToGetQuery(sql="SELECT * FROM MyTable")/>



This is the code that makes the web service available on server B

<cfcomponent>

   <cffunction name="methodToGetQuery" returntype="query" access="remote">

      <cfargument name="sqlCode" type="string" required="yes" />

      <cfquery name="qGetData" datasaource="myDBInsidePix">
         #preserveSingleQuotes(arguments.sqlCode)#
      </cfquery>

      <cfreturn qGetData />

  </cffunction>

</cfcomponent>





Coding Ninja Monkey

Ron
11-01-2007 @ 11:09 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 244
Joined: Oct 2004

This should work:

The addition of the url param "wsdl" and the "access=remote" attribute of the function tag, create the scenario that coldFusion will expect data to be returned from the original call to the component. The second call should not be there.

perhaps Pablo can explain better Smile

<cfset webServiceGateway = createObject("webservice", "http://SERVERIP/webservice.cfc?wsdl") />


This is the code that makes the web service available on server B

<cfcomponent>

   <cffunction name="methodToGetQuery" returntype="query" access="remote">

      <cfquery name="qGetData" datasaource="myDBInsidePix">
       SELECT * FROM MyTable
      </cfquery>

      <cfreturn qGetData />

  </cffunction>

</cfcomponent>


Sponsored By...
iOpenSoft, LLC is a Houston, Texas Advanced Technology Studio Specializing in Web Design, Web Development, iPhone App Development and Android App Development.