Question

I'm trying to integrate Sugar CRM with one of my projects. I'm using Apache Axis as my SOAP client.

I got the initial setup from this blog. Using this tutorial I'm able to login, fetch and insert data into my Sugar CRM installation.

I'm trying to fetch Leads using the following code

Get_entry_list_result_version2 entryList = port.get_entry_list(
            sessionID, "Leads", "", "", 0, new String[] { "first_name",
                    "phone_work" }, null, 2, 0);

This portion is working fine, but when I try to add a query criteria as the 3rd parameter, system is throwing an error

Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode: 
faultString: org.xml.sax.SAXParseException: Content is not allowed in prolog.
faultActor: 
faultNode: 
faultDetail: 
    {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: Content is not allowed in prolog.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411)

Thank you

here is my new fetch using the query

Get_entry_list_result_version2 entryList = port.get_entry_list(
            sessionID, "Leads", "first_name='arun'", "", 0, new String[] { "first_name",
                    "phone_work" }, null, 2, 0);

What am I doing wrong?

I've already compiled my axis-1.4 library to fix this bug

Was it helpful?

Solution 2

I figured it out, need to have a query qualified by the module name:

Sorry for my ignorance.

My further searches took me to here.

After fixing my code looks like

Get_entry_list_result_version2 entryList = port.get_entry_list(
            sessionID, "Leads", " leads.last_name ='LastName' ", "", 0, new String[] { "first_name",
                    "phone_work", "sic_code" }, null, 10, 0);

Thanks

OTHER TIPS

Arun P Johny's answer was correct and very helpful. I am using Talend Open Studio w/ tSugarCRMInput component. Even though there is a field for Module, the query does need to be fully qualified.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top