1 Reply Latest reply on Jul 25, 2006 8:55 PM by Salccnpp

    Consumming java webservices in coldfusion

    okoth
      could somebody show me how to consume this webservice from within coldfusion?
      " http://www.ripedev.com/webservices/ZipCode.asmx?WSDL"
      right now I invoke it as follows:

      <cfinvoke
      webservice=" http://www.ripedev.com/webservices/ZipCode.asmx?WSDL"
      method="ZipCodeToCityState" ZipCode="12210" returnvariable="returnedText" >
      </cfinvoke>

      <cfoutput>
      #arraylen(variables.returnedText)#
      </cfoutput>

      And this is what i get
      com.ripedev.xsd.ZipCodeResults_xsd.ArrayOfAnyType@aaa1d576 .

      This actually has no meaning to me.

      Thanks


      amos
        • 1. Re: Consumming java webservices in coldfusion
          Salccnpp Level 1
          I'm just learning how to consume webservice stuff but this should help as I got a result. See my code snippet below.
          Basically I did some cfdumps to see what the objects look like. This is from an empirical view as I don't understand yet. The object comes back with methods. You then use those methods to get values. I chose to use the getAnyType method. I did this as I used another tool, soapscope from www.mindreef.com (30 day eval) which really simplifies how to call webservices. It's worth the cost.
          Basically I invoked the service via soapscope and looked at the returned xml.
          It looked like:
          <soap:Envelope
          xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/"
          xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
          xmlns:xsd=" http://www.w3.org/2001/XMLSchema">
          <soap:Body>
          <ZipCodeToCityStateResponse xmlns=" http://ripedev.com/xsd/ZipCodeResults.xsd">
          <ZipCodeToCityStateResult>
          <anyType xsi:type="xsd:string">Albany, NY</anyType>
          </ZipCodeToCityStateResult>
          </ZipCodeToCityStateResponse>
          </soap:Body>
          </soap:Envelope>

          Note that the result was in a value of anyType. Thus I picked getAnyType method
          I hope this helps ya but I'm still quite a newbie to this. This link help me understand a little more about webservice http://tutorial292.easycfm.com/

          Zip test WS Object
          object of com.ripedev.xsd.ZipCodeResults_xsd.ArrayOfAnyType

          Methods hashCode (returns int)
          equals (returns boolean)
          getSerializer (returns interface org.apache.axis.encoding.Serializer)
          getDeserializer (returns interface org.apache.axis.encoding.Deserializer)
          getTypeDesc (returns org.apache.axis.description.TypeDesc)
          getAnyType (returns java.lang.Object)
          getAnyType (returns [Ljava.lang.Object;)
          setAnyType (returns void)
          setAnyType (returns void)
          getClass (returns java.lang.Class)
          wait (returns void)
          wait (returns void)
          wait (returns void)
          notify (returns void)
          notifyAll (returns void)
          toString (returns java.lang.String)


          Breaking down the object
          array
          1 Albany, NY