Skip to main content
Participant
June 3, 2013
Answered

CF10: Consuming SOAP-Service - Axis2 Enumeration

  • June 3, 2013
  • 1 reply
  • 1224 views

Hi all,

Im trying to call a webservice with a complex-within-complex structure. Here an extract form the wsdl:

<simpleType name="ProductType">

    <restriction base="xsd:string">

     <enumeration value="Car"/>

     <enumeration value="Truck"/>

    </restriction>

   </simpleType>

<complexType name="Product">

    <sequence>

     <element name="id" type="xsd:string"/>

     <element name="type" type="impl:ProductType"/>

     </sequence>

</complexType>

If i call the webservice with a structure as Parameter

<cfset local.ws.addProduct( {

    id: 'p01234',

    type: 'Truck'

} )>

I get an Error.

Cannot perform web service invocation addProduct.

The fault returned when invoking the web service operation is:
org.apache.axis2.AxisFault: product cannot be null!! 

If i change the wsdl file, so the Type of the element "type" is also "xsd:string", then it works perfectly. Problem is, changing the wsdl file by myself is a absolute no-go, since i have to consume it form our customers.

Based on reserches i've found that older Axis2 version didn't implement the Enumeration-Type, but the one shipped with CF10 should (Axis2 v1.7).

I've found this Thread: http://forums.adobe.com/thread/88154

I tried to copy the generated stubs for productType in the cfusion/wwwroot/WEB-INF/classes and create a object with createObject("java","productType") which -of course- generated an Error saying that i cannot create from abstract classes. sigh.

Did anyone managed to call an Webservice with Enumerations in WSDL?

Best regards,
Maertsch

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Correct answer OneLove

    Set the wsversion to 1 and try again.


    <cfscript>
      args = { refreshWSDL=true, wsversion=1 };
      ws = createObject("webservice", "http://yourwebserivce?wsdl", args);
      result =
    ws.addProduct( {

                                             id: 'p01234',

                                             type: 'Truck'

                                               } )>


    </cfscript>

    http://stackoverflow.com/questions/15385642/issue-using-net-web-service-from-coldfusion

    1 reply

    OneLove
    OneLoveCorrect answer
    Participant
    August 29, 2014

    Set the wsversion to 1 and try again.


    <cfscript>
      args = { refreshWSDL=true, wsversion=1 };
      ws = createObject("webservice", "http://yourwebserivce?wsdl", args);
      result =
    ws.addProduct( {

                                             id: 'p01234',

                                             type: 'Truck'

                                               } )>


    </cfscript>

    http://stackoverflow.com/questions/15385642/issue-using-net-web-service-from-coldfusion