Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

using complex data types with web services

New Here ,
Jun 17, 2009 Jun 17, 2009

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

383
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 18, 2009 Jun 18, 2009
LATEST

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.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources