Skip to main content
Participant
June 17, 2009
Question

using complex data types with web services

  • June 17, 2009
  • 1 reply
  • 430 views

Hello-

I am trying to integrate our SugarCRM application & our Coldfusion application using web services.

My page that calls the web service looks like this

------------------------------------

<cfscript>
user_struct = structnew();

    user_struct["user_name"] = "my_username";
    user_struct["password"] = "my_password";

auth_struct = structnew();
      auth_struct["user_auth"] = user_struct;
      auth_struct["application_name"] = "my_app";

    ws = createObject("webservice", "https://{mysite}/soap.php?wsdl");
login_results = ws.login(auth_struct);

</cfscript>

<cfdump var="#login_results#">

-----------------------------

the relevant lines in the wsdl file are

- <xsd:complexType name="user_auth">
-       <xsd:all>
             <xsd:element name="user_name" type="xsd:string" />
             <xsd:element name="password" type="xsd:string" />
             <xsd:element name="version" type="xsd:string" />
     </xsd:all>
</xsd:complexType>
- <message name="loginRequest">
     <part name="user_auth" type="tns:user_auth" />
     <part name="application_name" type="xsd:string" />
</message>
- <message name="loginResponse">
       <part name="return" type="tns:set_entry_result" />
</message>
- <operation name="login">
     <input message="tns:loginRequest" />
   <output message="tns:loginResponse" />
</operation>

- <operation name="login">
    <soap:operation soapAction=http://{mysite}/soap.php/login style="rpc" />
-    <input>
      <soap:body use="encoded" namespace="http://www.sugarcrm.com/sugarcrm" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
-   <output>
     <soap:body use="encoded" namespace="http://www.sugarcrm.com/sugarcrm"  encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
------------------------------------------------------
The error I get is
Error Occurred While Processing Request

Web service operation login with parameters {{application_name={myApp},user_auth={{user_name={my_username},password={my_password}}}}} cannot be found.

the wsdl has a 'test' operation that passes a simple string that is echoed back & it worked just fine so I know I am connecting to it.

Any ideas?

Thank you!

Sena

    This topic has been closed for replies.

    1 reply

    ilssac
    Inspiring
    June 18, 2009

    The first thing I notice is that your struct has a user_name and a password:

        user_struct["user_name"] = "my_username";
        user_struct["password"] = "my_password";

    And that the WSDL defines a user_name, password and version:

    * *            <xsd:element name="*user_name*" type="*xsd:string*" />
    * *            <xsd:element name="*password*" type="*xsd:string*" />
    * *            <xsd:element name="*version*" type="*xsd:string*" />

    Usually these things need to match.