• JK__
  • NEWBIE
  • 0 Points
  • Member since 2011

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

My Salesforce app calls out to my own external web service. The documentation says to use the user ID and session ID to authenticate and identify users from an external service. Specifically, you're supposed to put the user and session IDs in the web request then have your service call back through the Force.com API to check that the user has an active session and has been authenticated.

 

I get the idea but there is no example or further explanation. HOW is that done with the API? WHAT API methods are used?

When testing in QA and switching to Production it was necessary to always reload the web reference in the .Net application.  It became a nuciance and so I am posting a solution that we came across.

When starting your .Net application you can place the code below in the Application_Start subroutine of your Global.asax file. Depending on your environment it just switches out part of the URL string to point to either the Sandbox or Production.


 Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs on application startup
        '***** IMPORTANT ******The the section you are changing causes a restart, you needs some additional properties set
        '<section  restartOnExternalChanges="false" requirePermission="false" />
        'appSettings by default is already set to false
        'Sforce.Salesforce web ref 'values 'QA = https://test.salesforce.com/services/Soap  'Prod =https://login.salesforce.com/services/Soap
        Try
            'get current SFDC settings
            Dim mySFDCConn As String = ConfigurationManager.AppSettings("Sforce.Salesforce")
            'get a handle on the appsetting Sforce entry in web.config
            Dim MyConfig As Configuration = Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~")
            Dim setting As KeyValueConfigurationElement = CType(MyConfig.AppSettings.Settings("Sforce.Salesforce"), KeyValueConfigurationElement)
            If Not setting Is Nothing Then
                If Not ConfigurationManager.AppSettings("Level") Is Nothing Then
                    If ConfigurationManager.AppSettings("Level").Substring(0, 1) = "P" Then
                        'only update if different so web.config isn't needlessly updated and reloaded locally
                        If setting.Value.Contains("test") Then
                            setting.Value = mySFDCConn.Replace("test", "login")
                            MyConfig.Save()
                        End If
                    Else
                        'qa or not defined 
                        'only update if different so web.config isn't needlessly updated and reloaded locally
                        If setting.Value.Contains("login") Then
                            setting.Value = mySFDCConn.Replace("login", "test")
                            MyConfig.Save()
                        End If
                    End If
                End If
            End If
        Catch ex As Exception
           
        End Try
    End Sub
       

Can anybody guide me how to decrypt a string in ASP.net to original value when we Encrypt it using the APEX Crypto class AES algorythm?

  • January 23, 2011
  • Like
  • 0

Hi All,

SO I have generated a simple WSDL file with VS2005.

When I try to import it into salesforce I get the error:

Error: Failed to parse wsdl: Found more than one wsdl:binding. WSDL with multiple binding not supported
  <?xml version="1.0" encoding="utf-8" ?> 
- <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://minciTest.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://minciTest.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <s:schema elementFormDefault="qualified" targetNamespace="http://minciTest.org/">
- <s:element name="HelloWorld">
  <s:complexType /> 
  </s:element>
- <s:element name="HelloWorldResponse">
- <s:complexType>
- <s:sequence>
  <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" /> 
  </s:sequence>
  </s:complexType>
  </s:element>
  </s:schema>
  </wsdl:types>
- <wsdl:message name="HelloWorldSoapIn">
  <wsdl:part name="parameters" element="tns:HelloWorld" /> 
  </wsdl:message>
- <wsdl:message name="HelloWorldSoapOut">
  <wsdl:part name="parameters" element="tns:HelloWorldResponse" /> 
  </wsdl:message>
- <wsdl:portType name="Service1Soap">
- <wsdl:operation name="HelloWorld">
  <wsdl:input message="tns:HelloWorldSoapIn" /> 
  <wsdl:output message="tns:HelloWorldSoapOut" /> 
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" /> 
- <wsdl:operation name="HelloWorld">
  <soap:operation soapAction="http://minciTest.org/HelloWorld" style="document" /> 
- <wsdl:input>
  <soap:body use="literal" /> 
  </wsdl:input>
- <wsdl:output>
  <soap:body use="literal" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:binding name="Service1Soap12" type="tns:Service1Soap">
  <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> 
- <wsdl:operation name="HelloWorld">
  <soap12:operation soapAction="http://minciTest.org/HelloWorld" style="document" /> 
- <wsdl:input>
  <soap12:body use="literal" /> 
  </wsdl:input>
- <wsdl:output>
  <soap12:body use="literal" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="Service1">
- <wsdl:port name="Service1Soap" binding="tns:Service1Soap">
  <soap:address location="http://localhost:51892/Service1.asmx" /> 
  </wsdl:port>
- <wsdl:port name="Service1Soap12" binding="tns:Service1Soap12">
  <soap12:address location="http://localhost:51892/Service1.asmx" /> 
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>

 

The code was Copied & Pasted...

 

Thank you So much!