14 Replies Latest reply on Apr 28, 2009 12:40 PM by Happy Munchkin

    Consuming WS blues

    Happy Munchkin
      Hi Everyone,
      I just got started on a site which needs to pull data via a SOAP WS. Whilst I have a bit of experience with CF and conventional datasources I have never used a WS before.

      The WSDL is located here:

      and I used the attached code to try and pull data.

      I respectively got the following error messages :

      Cannot generate stub objects for web service invocation.

      Name: http://www.villarenters.com/VillarentersWebService/VillaSearch.asmx/GetChildLocationsV2?Pa rentID=0&VRF=. WSDL: http://www.villarenters.com/VillarentersWebService/VillaSearch.asmx/GetChildLocationsV2?Pa rentID=0&VRF=. WSDLException (at /ChildLocationV2): faultCode=INVALID_WSDL: Expected element '{ http://schemas.xmlsoap.org/wsdl/}definitions'.: It is recommended that you use a web browser to retrieve and examine the requested WSDL document to ensure it is correct. If the requested WSDL document cannot be retrieved or is dynamically generated, it is likely that the target web service has programming errors.


      Web service operation GetChildLocationsV2 with parameters {Parent_ID={0}} cannot be found.

      So I thought that the WSDL file was malformed. However when I paste this into my browser :

      http://www.villarenters.com/VillarentersWebService/VillaSearch.asmx/GetChildLocationsV2?Pa rentID=0&VRF=

      it returns the correct data so that same WSDL file is working when called from their own website.

      I am starting to think maybe an ASP.NET vs CF incompatibility ???

      Do I need to use the arguments in both the url of the WS and in the <CFInvokeArgument> tag? Or can I dispense with one of them?

      I would really be grateful for any help on this as I am well and truly stuck :)
      Thanks, Paul.
        • 1. Re: Consuming WS blues
          injun [576871] Level 1

          If you have Dreamweaver, you can use it to generate code for web-services.
          Just open the "Components", select in drop-down menu "Web services" and enter the URL of service. Dreamweaver show to you available functions and generate code for their use.

          Like this:


              <cfinvokeargument name="rag" value="enter_value_here"/>
              <cfinvokeargument name="strOwnerRefs" value="enter_value_here"/>
              <cfinvokeargument name="strPropRefs" value="enter_value_here"/>
              <cfinvokeargument name="strLocationRefs" value="enter_value_here"/>
              <cfinvokeargument name="intMaxPrice" value="enter_value_here"/>
              <cfinvokeargument name="intMinPrice" value="enter_value_here"/>
              <cfinvokeargument name="intSleeps" value="enter_value_here"/>
              <cfinvokeargument name="blnInstantBooking" value="enter_value_here"/>
              <cfinvokeargument name="intVillarentersIndex" value="enter_value_here"/>
              <cfinvokeargument name="intDiscountType" value="enter_value_here"/>
              <cfinvokeargument name="intBranding" value="enter_value_here"/>
              <cfinvokeargument name="intPage" value="enter_value_here"/>
              <cfinvokeargument name="intItemsPerPage" value="enter_value_here"/>
              <cfinvokeargument name="blnEnableAvailabilitySearch" value="enter_value_here"/>
              <cfinvokeargument name="strFromYYYYMMDD" value="enter_value_here"/>
              <cfinvokeargument name="strToYYYYMMDD" value="enter_value_here"/>
              <cfinvokeargument name="intSortOrder" value="enter_value_here"/>
          • 2. Re: Consuming WS blues
            Happy Munchkin Level 1

            Thanks for that Alexei. I have CS4 trial installed right now (which I am not impressed with!) and it seems that the web services feature has been dropped since CS3..... Unless I am missing something?


            From the Dreamweaver CS4 Manual:


            Deprecated features

            The following features have been deprecated for Dreamweaver CS4:

            • Timelines

            • Web services

            • Layout mode

            • Site Map view

            • Java Bean support

            • Adobe® Flash elements (Image Viewer)

            • Adobe® Flash text and Adobe® Flash buttons

            • ASP.NET and JSP server behaviors and recordsets


            I have now tried lots of variations and still can't get it to talk. Also from the LiveDocs I found :


            To consume a web service that is implemented in a technology other than ColdFusion, the web service must have one of the following sets of options:


            • rpc as the SOAP binding style and encoding as the encodingStyle
            • document as the SOAP binding style and literal as the encodingStyle


            Can anyone tell me for sure if the WSDL file that I am using complies with these requirements. I called the company who's WS is it and they were "fairly" sure that it complies with the second option.... but they weren't committing themselves!

            • 3. Re: Consuming WS blues
              injun [576871] Level 1

              I use Dreamweaver to work with Web-services, and everything works perfectly!

              • 4. Re: Consuming WS blues
                Happy Munchkin Level 1

                Are you using CS4?

                • 5. Re: Consuming WS blues
                  Happy Munchkin Level 1

                  OK, so I finally managed to get this working. I found a good reference at :




                  and after minimal tinkering I made it work with the WS I am trying to use.




                  I hope this is useful for someone.

                  • 6. Re: Consuming WS blues
                    injun [576871] Level 1
                    Are you using CS4?



                    • 7. Re: Consuming WS blues
                      Happy Munchkin Level 1

                      OK, that's interesting. When I open the components panel I see:




                      As I understand it the drop-down should have a web services option - is that right? The only option I have is CF Components. Am I missing something?

                      • 8. Re: Consuming WS blues
                        injun [576871] Level 1

                        Choose in drop-down menu "Web services" and click "+", then enter URL of web service. Dw check it and show to you avalaible methods. Next you can drag needed method to your page

                        • 9. Re: Consuming WS blues
                          Happy Munchkin Level 1

                          Sounds too easy

                          But I don't have "Web Services" in the drop-down, just CF Component. I have looked through the prefs for DW but can't find anything there to enable WS functionality.



                          • 10. Re: Consuming WS blues
                            injun [576871] Level 1

                            Look at my screenshot

                            • 11. Re: Consuming WS blues' in Advanced Techniques
                              Happy Munchkin Level 1

                              OK, so now you have got me jealous and confused


                              I'll try and contact DW support and see if they can tell me how I can get the web services in my drop-down.

                              • 12. Re: Consuming WS blues' in Advanced Techniques
                                Happy Munchkin Level 1

                                From the Dreamweaver Documentation on consuming web services:


                                Note: This section makes use of a Dreamweaver CS4 feature that is only available on Windows machines. You will not be able to introspect a web service on a Mac OS X machine. You can, of course, still use ColdFusion on Mac OS X and run code that makes use of web services. You just can't use the built-in Dreamweaver's tool to examine the web service.



                                I am on a Mac hence why I don't get the web services option in my drop-down list. Mystery solved

                                • 13. Re: Consuming WS blues' in Advanced Techniques
                                  insuractive Level 3

                                  Dreamweaver integration aside, you should be able to hand-code the web service call without too much dificulty.  From what I can tell it looks like you had a couple of problems with your initial web service invocation call, based on your first post.  Can you verify the following:


                                  1) That your <cfinvoke> webservice attribute is pointing to: http://www.villarenters.com/VillarentersWebService/VillaSearch.asmx?WSDL

                                  2) That you are passing in ALL expected parameters of the web service method?  CF will freak out on you if you leave a parameter out of a web service call (even if it is an optional one).  You can try using the "omit" parameter, but I find that that does not always do the trick.


                                  Based on the error messages that you were receiving from your initial post, it looks like you may have been pointing your webservice to the GET form of the web service call instead of the WSDL, and your second error message only includes the value of one of the web service parameters.


                                  If you are still having problems, can you post your invocation code so we can troubleshoot your problem?


                                  Hope that helps,


                                  - Michael

                                  • 14. Re: Consuming WS blues' in Advanced Techniques
                                    Happy Munchkin Level 1

                                    Hi Michael,


                                    When I realised that DW wasn't going to help me out with using the web service I decided to get my hands dirty and look at coding the WS calls by hand. I found a good resource on a blog ( http://www.jamesnetherton.com/blog/2007/01/14/Invoking-a-webservice-using-CFHTTP/ ) and modified slightly to suit my requirements and it has been working beautifully.


                                    The code now looks like this:




                                    I put all that into a cfc and I just make the call to it using either :


                                    or this:


                                    I did struggle a bit with this as I hadn't been coding for a number years and SOAP was completely new to me but once I got comfortable with it I realised that it's no big deal.


                                    Thanks for the help,