function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC to Java ConnectorSFDC to Java Connector 

The prefix "urn" for element "urn:enterprise.soap.sforce.com" is not bound

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!!!!

Best Answer chosen by Admin (Salesforce Developers) 
SFDC to Java ConnectorSFDC to Java Connector

Thank you so much,

 

I corrected the code as

 

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

 

and it worked well.

 

Thank you...

All Answers

SuperfellSuperfell

you're using the wrong qname constructor, and so generating garbage xml.

SFDC to Java ConnectorSFDC to Java Connector

Thank you so much,

 

I corrected the code as

 

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

 

and it worked well.

 

Thank you...

This was selected as the best answer