• SFDC to Java Connector
  • NEWBIE
  • 30 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 7
    Replies

Hi,

 

"A duplicate value was specified for field 'LastName' in object 'Contact', duplicate value 'Prabhu' prior value 'Muthu'"

this is an exception while am trying to upsert a value in salesforce using partner wsdl and jax-ws.

I am fetching RDBMS table values using jdbc and trying to insert the values into salesforce.

 

Here is my code snippet,

 

DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
            Document doc = docBuilder.newDocument();

Upsert upsert = new Upsert();

SObject sobj = new SObject();

 

 

ResultSet rs = stmt.executeQuery(query);

 

while(rs.next())
            {
                sobj.setType(objname);
                
                sobj.setId("objectfromjava");
                for (int i = 0; i < clc; i++) {          // clc - number of columns : column count

                    
                    Element insert = doc.createElement( columnValue[i]);
                    insert.appendChild(doc.createTextNode(rs.getString((i+1)).toString()));                
             

                   sobj.getAnies().add(insert);



                }
                upsert.getSObjects().add(sobj);
         
            }

 

 

port.Upsert(upsert);

 

 

The same error is happening for create call also..

 

what will be my problem? Please help me out!!

Hi all,

 

I am doing a project to integrate java with salesforce. I need to find out the various options to integrate except web service. Suggest me the various options to integrate java with salesforce. Please help me out...

Hi all,

 

I am using netbeans 6.9.1 and jax-ws to create an SObject(Account). The code to create an Account is

 

 

        Create createParam = new Create();  

        QName qn = new QName("urn:enterprise.soap.sforce.com");

        JAXBElement<String> aname = new JAXBElement<String>(qn,String.class,"NetBeans");
      
      for (int i=0;i<5;i++) {

        Account a = new Account();
        aname.setValue("Netbeans"+i);    
        a.setName(aname);
        createParam.getSObjects().add(a);
      }

      // create the records in Salesforce.com

        CreateResponse cresponse = port.create(createParam);

 

 

For this code the exception is

 

"javax.xml.ws.soap.SOAPFaultException: The prefix "urn" for element "urn:enterprise.soap.sforce.com" is not bound".

 

 

The Marshalled XML code for aname is

 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<urn:enterprise.soap.sforce.com xmlns:ns2="urn:sobject.enterprise.soap.sforce.com"

xmlns:ns3="urn:enterprise.soap.sforce.com">Netbeans</urn:enterprise.soap.sforce.com>

 

While trying to unmarshall this XML to JAXBElement<String> the same exception is occuring

 

"org.xml.sax.SAXParseException: The prefix "urn" for element "urn:enterprise.soap.sforce.com" is not bound".

 

 

What would be the problem in this code?

 

Please help me out!!!!

Hi all,

 

I am using netbeans 6.9.1 . In which i created a web service client which consumes the enterprise.wsdl file of my developer edition.

I am using JAX-WS to parse the WSDL file. After parsing the file it didnt create the class "SoapBindingStub.java" .

 

Is there any way to login to salesforce without using the class. I am strugling without this class to set the session Header. So it throws an exception "Invalid Session ID".

 

How to clear this problem????

 

Help me out!!!!

Hi I am doing a project to Integrate salesforce with java.

 

I am successfully getting login which returns session id and server Url.

 

I set the server url, but dont know how to set the session header.

 

I created an object for the session header and set the session id, but dont know how to use that object.

 

I am using Netbeans 6.9.1.

 

Is it necessary to use wsc to parse the enterprise WSDL file.

 

Please give me a solution...

Hi,

 

"A duplicate value was specified for field 'LastName' in object 'Contact', duplicate value 'Prabhu' prior value 'Muthu'"

this is an exception while am trying to upsert a value in salesforce using partner wsdl and jax-ws.

I am fetching RDBMS table values using jdbc and trying to insert the values into salesforce.

 

Here is my code snippet,

 

DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
            Document doc = docBuilder.newDocument();

Upsert upsert = new Upsert();

SObject sobj = new SObject();

 

 

ResultSet rs = stmt.executeQuery(query);

 

while(rs.next())
            {
                sobj.setType(objname);
                
                sobj.setId("objectfromjava");
                for (int i = 0; i < clc; i++) {          // clc - number of columns : column count

                    
                    Element insert = doc.createElement( columnValue[i]);
                    insert.appendChild(doc.createTextNode(rs.getString((i+1)).toString()));                
             

                   sobj.getAnies().add(insert);



                }
                upsert.getSObjects().add(sobj);
         
            }

 

 

port.Upsert(upsert);

 

 

The same error is happening for create call also..

 

what will be my problem? Please help me out!!

Hi all,

 

I am doing a project to integrate java with salesforce. I need to find out the various options to integrate except web service. Suggest me the various options to integrate java with salesforce. Please help me out...

Hi all,

 

I am using netbeans 6.9.1 and jax-ws to create an SObject(Account). The code to create an Account is

 

 

        Create createParam = new Create();  

        QName qn = new QName("urn:enterprise.soap.sforce.com");

        JAXBElement<String> aname = new JAXBElement<String>(qn,String.class,"NetBeans");
      
      for (int i=0;i<5;i++) {

        Account a = new Account();
        aname.setValue("Netbeans"+i);    
        a.setName(aname);
        createParam.getSObjects().add(a);
      }

      // create the records in Salesforce.com

        CreateResponse cresponse = port.create(createParam);

 

 

For this code the exception is

 

"javax.xml.ws.soap.SOAPFaultException: The prefix "urn" for element "urn:enterprise.soap.sforce.com" is not bound".

 

 

The Marshalled XML code for aname is

 

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<urn:enterprise.soap.sforce.com xmlns:ns2="urn:sobject.enterprise.soap.sforce.com"

xmlns:ns3="urn:enterprise.soap.sforce.com">Netbeans</urn:enterprise.soap.sforce.com>

 

While trying to unmarshall this XML to JAXBElement<String> the same exception is occuring

 

"org.xml.sax.SAXParseException: The prefix "urn" for element "urn:enterprise.soap.sforce.com" is not bound".

 

 

What would be the problem in this code?

 

Please help me out!!!!

Hi all,

 

I am using netbeans 6.9.1 . In which i created a web service client which consumes the enterprise.wsdl file of my developer edition.

I am using JAX-WS to parse the WSDL file. After parsing the file it didnt create the class "SoapBindingStub.java" .

 

Is there any way to login to salesforce without using the class. I am strugling without this class to set the session Header. So it throws an exception "Invalid Session ID".

 

How to clear this problem????

 

Help me out!!!!

Hi I am doing a project to Integrate salesforce with java.

 

I am successfully getting login which returns session id and server Url.

 

I set the server url, but dont know how to set the session header.

 

I created an object for the session header and set the session id, but dont know how to use that object.

 

I am using Netbeans 6.9.1.

 

Is it necessary to use wsc to parse the enterprise WSDL file.

 

Please give me a solution...