• Losintikfos
  • NEWBIE
  • 125 Points
  • Member since 2008

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 31
    Questions
  • 140
    Replies

Hi

 

       Is there any way to generate XML file with the QueryResult object?

       

Thanks,

--bdr

Message Edited by bdr_09 on 01-27-2010 02:11 AM

I have a trigger which executes after an update.  Is there a way to tell a difference between an API update or a update from the Case page in the trigger?

 

Cheers,

Timothy

I downloaded the enterprise.wsdl and using axis tools managed to get the wsdl2java tool working and built the java stubs for the wsdl.  I'm trying to do a simple login into SalesForce and grab some data from the contact object, an extremely simple app.  I cannot find the SoapBindingStub and I am completely stuck and its making me so mad.  Below is a list of the java classes that were created as a result of using axis tools.

 

InvalidFieldFault.java

InvalidIdFault.java

InvalidNewPasswordFault.java

InvalidQueryLocatorFault.java

InvalidSObjectFault.java

LoginFault.java

MalformedQueryFault.java

MalformedSearchFault.java

SforceServiceCallbackHandler.java

SforceServiceStub.java

UnexpectedErrorFault.java

 

I read somewhere that SoapBindingStuf is found is SforceServiceStub.java but I cannot find it anywhere.  I am really stuck here and any help that anybody could give, I would really appreciate it.  I am kinda new to java as I'm mainly a .NET guy and this is bothering me.

 

Ralph

 

Hi,

in my sandbox environment someone has created (the administrator?) a new profile called "External who".

 

We can't read (edit/delete/clone) the profile details.

Do you know where it comes from?

Thanks

F.

Hi,

 

I have a simple WSDL file which I need to parse in SFDC. When I am trying to do a 'generate from wsdl' I am getting below error.

 

Error: Failed to parse wsdl: Found more than one wsdl:binding. WSDL with multiple binding not supported

 

WSDL:-

 

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://ws.apache.org/axis2" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://ws.apache.org/axis2">
    <wsdl:documentation>
        Please Type your service description here
    </wsdl:documentation>
    <wsdl:types>
        <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://ws.apache.org/axis2">
            <xs:element name="summation">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="a" type="xs:int"/>
                        <xs:element minOccurs="0" name="b" type="xs:int"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="summationResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="return" type="xs:int"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="summationRequest">
        <wsdl:part name="parameters" element="ns:summation"/>
    </wsdl:message>
    <wsdl:message name="summationResponse">
        <wsdl:part name="parameters" element="ns:summationResponse"/>
    </wsdl:message>
    <wsdl:portType name="FirePortType">
        <wsdl:operation name="summation">
            <wsdl:input message="ns:summationRequest" wsaw:Action="urn:summation"/>
            <wsdl:output message="ns:summationResponse" wsaw:Action="urn:summationResponse"/>
        </wsdl:operation>
    </wsdl:portType>
 
    <wsdl:binding name="FireSoap12Binding" type="ns:FirePortType">
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="summation">
            <soap12:operation soapAction="urn:summation" style="document"/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="FireHttpBinding" type="ns:FirePortType">
        <http:binding verb="POST"/>
        <wsdl:operation name="summation">
            <http:operation location="Fire/summation"/>
            <wsdl:input>
                <mime:content type="text/xml" part="summation"/>
            </wsdl:input>
            <wsdl:output>
                <mime:content type="text/xml" part="summation"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Fire">
        <wsdl:port name="FireHttpSoap11Endpoint" binding="ns:FireSoap11Binding">
            <soap:address location="http://10.227.75.47:8080/Webservice_provider/services/Fire.FireHttpSoap11Endpoint/"/>
        </wsdl:port>
        <wsdl:port name="FireHttpSoap12Endpoint" binding="ns:FireSoap12Binding">
            <soap12:address location="http://10.227.75.47:8080/Webservice_provider/services/Fire.FireHttpSoap12Endpoint/"/>
        </wsdl:port>
        <wsdl:port name="FireHttpEndpoint" binding="ns:FireHttpBinding">
            <http:address location="http://10.227.75.47:8080/Webservice_provider/services/Fire.FireHttpEndpoint/"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

 

 

I tried to remove the second binding tag as found in the error but still the error persists. Any idea would be of

great help

 

 

Thanks

indranily81

 

I'm trying to connect the salesforce API by creating a web service client in java (Axis).

 

I'm behind proxy and I have set the property that is required for connecting a web service for proxy

The code that I'm using is 

 

            binding = (SoapBindingStub) new SforceServiceLocator().getSoap();

            binding._setProperty("http.proxySet", "true");
            binding._setProperty("http.proxyHost", <proxy-host>);
            binding._setProperty("http.proxyPort", <proxy-port>);

 

 

 I'm calling the login function given below

 

            Login login = new Login();
            login.setUsername(<username>);
            login.setPassword(<password>);
            LoginResult lr = binding.login(username, password);
 

 

I have added the following jars in my classpath :

 

jaxrpc.jar
axis.jar
commons-discovery-0.2.jar
commons-logging.jar
wsdl4j-1.5.1.jar
commons-httpclient-3.0-rc4.jar

I'm getting the following error while calling the login function 

 


AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.net.UnknownHostException: test.salesforce.com
 faultActor:
 faultNode:
 faultDetail:
    {http://xml.apache.org/axis/}stackTrace:java.net.UnknownHostException: test.salesforce.com
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153)
    at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:120)
    at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)

 

Can someone please help me how can I resolve the problem...

 

Thanks!!!

Hi, I need some help in understanding what's going on with the outbound messaging in our case.

The web service we have built on the other end is able to receive the msg from SFDC and sends a true acknowldgement as well, but SFDC shows it as a failure with a reason "SOAP response was a nack" Anybody would know what could possibly be the reason?

Any help would be really appreciated.

Thank you!

 

 Request message 

 

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:m0="urn:sobject.enterprise.soap.sforce.com">
<SOAP-ENV:Body>
<m:notifications xmlns:m="http://soap.sforce.com/2005/09/outbound">
<m:OrganizationId>000000000000000000</m:OrganizationId>
<m:ActionId>000000000000000000</m:ActionId>
<m:SessionId>String</m:SessionId>
<m:EnterpriseUrl>String</m:EnterpriseUrl>
<m:PartnerUrl>String</m:PartnerUrl>
<m:Notification>
<m:Id>000000000000000000</m:Id>
<m:sObject>
<m0:fieldsToNull>String</m0:fieldsToNull>
<m0:Id>000000000000000000</m0:Id>
<m0:AccountId>000000000000000000</m0:AccountId>
<m0:Name>String</m0:Name>
</m:sObject>
</m:Notification>
</m:notifications>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

 

 

 Responce

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns3:notificationsResponse xmlns:ns3="http://soap.sforce.com/2005/09/outbound">
<ns3:Ack>true</ns3:Ack>
</ns3:notificationsResponse>
</soapenv:Body>
</soapenv:Envelope>

 

 

 

Message Edited by joystick on 11-11-2009 07:36 AM

Hi,

 

ISSUE :

We are using Intershop Infinity  as our App Server and We have successfully created the SoAP client. We Are able to successfully login to SF server. However we are encountering the following error of Invalid Session ID

 

Error Excerpt :

 

appserver0: An exception occured invoking service login().
appserver0: AxisFault
appserver0:  faultCode: {urn:fault.enterprise.soap.sforce.com}INVALID_SESSION_ID
appserver0:  faultSubcode:
appserver0:  faultString: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
appserver0:  faultActor:
appserver0:  faultNode:
appserver0:  faultDetail:
appserver0:  {urn:fault.enterprise.soap.sforce.com}UnexpectedErrorFault: <ns1:exceptionCode>INVALID_SESSION_ID</ns1:exceptionCode><ns1:exceptionMessage>Invalid Session ID found in SessionHeader: Illegal Session</ns1:exceptionMessage>
appserver0:
appserver0: INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session
appserver0:  at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
appserver0:  at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
appserver0:  at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1015)
appserver0:  at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
appserver0:  at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
appserver0:  at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
appserver0:  at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
appserver0:  at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
appserver0:  at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
appserver0:  at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
appserver0:  at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
appserver0:  at javax.xml.parsers.SAXParser.parse(Unknown Source)
appserver0:  at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:242)
appserver0:  at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
appserver0:  at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
appserver0:  at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:675)
appserver0:  at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:128)
appserver0:  at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:71)
appserver0:  at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
appserver0:  at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
appserver0:  at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
appserver0:  at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
appserver0:  at org.apache.axis.client.Call.invoke(Call.java:2553)
 
CODE EXCERPT :

            Soap service = (new SforceServiceLocator()).getSoap();
           // LoginResult loginResult = service.login(username, password);
    
            SoapBindingStub binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
            binding.setTimeout(600000);
            LoginResult loginResult = binding.login(username, password);
            System.out.println("serviceResult....." + loginResult.getServerUrl());
            // Create a new session header object and set the
            // session id to that returned by the login
            binding._setProperty(
                SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY,
                loginResult.getServerUrl());
          
            // Create a new session header object and set the session id to that
            // returned by the login
            SessionHeader sh = new SessionHeader();
           
            System.out.println("Server ID: " + loginResult.getSessionId());
            System.out.println("Service name:" + new SforceServiceLocator().getServiceName());
            //sh.setSessionId(loginResult.getSessionId());
           
           binding.setHeader(
                new SforceServiceLocator().getServiceName().getNamespaceURI(),
                "SessionHeader",
                sh);
            System.out.println("SH SESS ID: " +sh.getSessionId()); 
               
          //*****************************************************************     

            Contact contact;
            SObject[] cons = new Contact[2];
          
            System.out.println("create called....3");
            for (int j = 0; j < 2; j++) {
                contact = new Contact();
                System.out.println("In loop...");
                contact.setAssistantName("Jane");
                contact.setAssistantPhone("777.777.7777");
                contact.setDepartment("Purchasing");
                contact.setDescription("International IT Purchaser");
                contact.setEmail("
joeblow@isp.com");
                contact.setFax("555.555.5555");
                contact.setMailingCity("San Mateo");
                contact.setMailingCountry("US");
                contact.setMailingState("CA");
                contact.setMailingStreet("1129 B Street");
                contact.setMailingPostalCode("94105");
                contact.setMobilePhone("888.888.8888");
                contact.setFirstName("Joe");
                contact.setLastName("Blow");
                contact.setSalutation("Mr.");
                contact.setPhone("999.999.9999");
                contact.setTitle("Purchasing Director");
                cons[j] = contact;
            }
            System.out.println("Cons length: "+cons.length);
           
           <<ERROR LINE>> SaveResult[] sr = binding.create(cons); <<ERROR LINE>>
           
            for (int j = 0; j < sr.length; j++) {
                           if (sr[j].isSuccess()) {
                               System.out.println("A contact was created with an id of: "
                                       + sr[j].getId());
                                      
                           }
               
            }

 

Please Advise.

Thanks

Saachin,

Hi

 

I have written a simple program to download the record..

Here is the progrma i have written

 

 

package com.demo;
import com.sforce.soap.enterprise.LoginResult;
import com.sforce.soap.enterprise.QueryResult;
import com.sforce.soap.enterprise.SessionHeader;
import com.sforce.soap.enterprise.SforceServiceLocator;
import com.sforce.soap.enterprise.SoapBindingStub;
import com.sforce.soap.enterprise.sobject.*;

public class RunDemo {

    public static final String USERNAME = "";
    public static final String TOKEN = "";
    public static final String PASSWORD ="";
    
    /**
     * @param args
     */
    private SoapBindingStub binding;
    public static void main(String[] args) {
        RunDemo r = new RunDemo();
        try {
            r.login();
            r.search();
        } catch (Exception e) {
        }

    }
    

    private void login() throws Exception{
        
//        System.setProperty("http.proxySet", "true");
//        System.setProperty("http.proxyHost", "localhost");
//        System.setProperty("http.proxyPort", "8080");
//        System.setProperty("http.proxyUser", "rajiv");
//        System.setProperty("http.proxyPassword", "rajiv");
//        System.out.println("Logging into Salesforce.....");
        
        
        binding = (SoapBindingStub) new SforceServiceLocator().getSoap();
        
        System.out.println("Before Login");
        
        LoginResult loginResult = binding.login(USERNAME, PASSWORD);
        
        binding._setProperty(SoapBindingStub.ENDPOINT_ADDRESS_PROPERTY, loginResult.getServerUrl());
        
        SessionHeader sh = new SessionHeader();
        sh.setSessionId(loginResult.getSessionId());
        
        binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(),"SessionHeader",sh);
        
    }

    private void search() throws Exception{
        QueryResult qr = binding.query("Select FirstName,LastName from Contact");
        if (qr.getSize() > 0){
            for (int i = 0; i < qr.getSize(); i++) {
            Contact c = (Contact) qr.getRecords(i);
            System.out.println("First Name :" + c.getFirstName() + "Last Name" + c.getLastName());
                
            }
        }
        
    }
}

 

 

 

I am getting exception on line 

 

 binding = (SoapBindingStub) new SforceServiceLocator().getSoap();

 

 

 

Here is the exception which i am getting while trying to run the program....

 

 

Exception in thread "main" java.lang.ExceptionInInitializerError
    at org.apache.axis.client.Service.getAxisClient(Service.java:104)
    at org.apache.axis.client.Service.<init>(Service.java:113)
    at com.sforce.soap.enterprise.SforceServiceLocator.<init>(SforceServiceLocator.java:16)
    at com.demo.RunDemo.login(RunDemo.java:40)
    at com.demo.RunDemo.main(RunDemo.java:22)
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException))
    at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
    at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:370)
    at org.apache.axis.components.logger.LogFactory.getLog(LogFactory.java:37)
    at org.apache.axis.handlers.BasicHandler.<clinit>(BasicHandler.java:43)
    ... 5 more
Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)
    at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
    at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
    ... 9 more
Caused by: java.lang.NullPointerException
    at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
    ... 10 more

 

 

 

Any help on this will be great help 

 

Thanks

 

 

 

 

Hello!
I am new at writing APEX code and I need some help.   I want to write the following Excel logic in APEX CODE:

My organization has three products….let's call them "Product 1" , "Product 2", and "Product 3"

For Each Product I have a field called "Product 1 Rate", "Product 2 Rate" and "Product 3 Rate"

I want to declare a variable called "PriceDaily" and have it equal one of the product rates.

So I want to say:  If Product name is  "Product 1" than "Price Daily" is "Product 1 Rate",
                                    If Product name is  "Product 2" than "Price Daily" is "Product 2 Rate",
                                    If Product name is  "Product 3" than "Price Daily" is "Product 3 Rate"

How is this written in an APEX Class? 

Thank you for you help!!!!!!!!!

Hi,

For instance I create a new Account and I need to update its list of Contacts. What if the best way?

Is the line below correct? Thank you

 

anAccount.getContacts().getValue().getRecords().add(aContact);