• Tzafrirben
  • NEWBIE
  • 25 Points
  • Member since 2009

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

How do you switch your .net app between connecting to Produciton and Sandbox web services?

I have code working on my Developer orgI now want to  move to my Sandbox.

I generated the WSDL on my developer org, and just copied the Apex classes to my sandbox and have not regenerated the WSDL for it.


private const string _url = "https://test.salesforce.com/services/Soap/u/10.0";


protected void Button1_Click(object sender, EventArgs e)
{
if (!isConnected())
{
getSessionInfo();
}
MyService ws = new MyService();
ws.Url = Application["_serverUrl"].ToString();
ws.Proxy = getProxy();
ws.SessionHeaderValue = new SessionHeader();
ws.SessionHeaderValue.sessionId = Application["_sessionId"].ToString();
string foo= ws.HelloWolrd("bar");


}

public WebProxy getProxy()
{
System.Net.WebProxy proxy = System.Net.WebProxy.GetDefaultProxy();
proxy.Credentials = CredentialCache.DefaultCredentials;
return proxy;
}


public bool isConnected()
{
bool functionReturnValue = false;
if (Application["_sessionId"] != null )
{
if (DateTime.Now < (DateTime)(Application["_nextLoginTime"]) )
{
return true;
}
}
return false;
}

public void getSessionInfo()
{
SforceService ss = new SforceService();
ss.Proxy = getProxy();
ss.Url = _url;
LoginResult lr = ss.login(_userId, _password);
if (!lr.passwordExpired)
{
Application["SforceService"] = ss;
Application["_sessionId"] = lr.sessionId;
Application["_serverUrl"] = lr.serverUrl;
Application["_nextLoginTime"] = DateTime.Now.AddMinutes(_sessionTime);
}
}

this code works fine on my developer edition, but I cannot get it working on my sandbox.

The value for 

serverUrl = "https://tapp0-api.salesforce.com/services/Soap/u/10.0/00DT0000000Gg4C"


The error I get is:

 

 No operation available for request {http://soap.sforce.com/schemas/class/MyService}HelloWolrd

Message Edited by dke01 on 11-29-2009 03:35 PM
Message Edited by dke01 on 11-29-2009 03:37 PM
  • November 29, 2009
  • Like
  • 0

We need to create a cusomer portal user from a .NET code and not from Apex (so we cannot use the Site.CreateCusomerPortal method in Apex).

 

For some reason, when trying to create new user from the .NET API we keep getting the following error:

invalid cross reference id (Status code INVALID_CROSS_REFERENCE_KEY)

 

 

Any ideas\examples on how we can perfrom this task and why we keep getting this error?

I've a .NET web service with a method that recieve byte[]:

 

[WebMethod] public void DoSomething(byte[] array) { ... }

 I'm imported the web service into apex using the wsdl import mechanism. 

 

The problem is that the byte[] object is represented as String array.

 

How can I call a web method which needs to recieve a byte[]?

 

We have a .NET service to communicate with SF. The .NET service logs in to SF once using a valid user, and after that all API calls to SalesFroce.com uses that user session ID.

 

The problem is: how can we tell when the session of this user was expired and he needs to re-login? currently it is done by catching exception, but this is probably not the  best way to do it.

 

Thanks

From what I understand, I cannot define public properties in Interface like I can do in C#. Meaning this is not allowed:

 

global interface IClientIdentifier {
        String LoginEmail {get; set;};
}

 

The problem is that I want seamless to replace an existing C# Web service with Apex Web service with out updating all clients.

 

Any solution?

 

 

Hi,

 

       I am new to Salesforce, Can you please tell me how to use the enterprise.wsdl to search data for a particular user and to fetch the user's leads and campaign data.

 

 

Thanks in Advance.

 

 

How do you switch your .net app between connecting to Produciton and Sandbox web services?

I have code working on my Developer orgI now want to  move to my Sandbox.

I generated the WSDL on my developer org, and just copied the Apex classes to my sandbox and have not regenerated the WSDL for it.


private const string _url = "https://test.salesforce.com/services/Soap/u/10.0";


protected void Button1_Click(object sender, EventArgs e)
{
if (!isConnected())
{
getSessionInfo();
}
MyService ws = new MyService();
ws.Url = Application["_serverUrl"].ToString();
ws.Proxy = getProxy();
ws.SessionHeaderValue = new SessionHeader();
ws.SessionHeaderValue.sessionId = Application["_sessionId"].ToString();
string foo= ws.HelloWolrd("bar");


}

public WebProxy getProxy()
{
System.Net.WebProxy proxy = System.Net.WebProxy.GetDefaultProxy();
proxy.Credentials = CredentialCache.DefaultCredentials;
return proxy;
}


public bool isConnected()
{
bool functionReturnValue = false;
if (Application["_sessionId"] != null )
{
if (DateTime.Now < (DateTime)(Application["_nextLoginTime"]) )
{
return true;
}
}
return false;
}

public void getSessionInfo()
{
SforceService ss = new SforceService();
ss.Proxy = getProxy();
ss.Url = _url;
LoginResult lr = ss.login(_userId, _password);
if (!lr.passwordExpired)
{
Application["SforceService"] = ss;
Application["_sessionId"] = lr.sessionId;
Application["_serverUrl"] = lr.serverUrl;
Application["_nextLoginTime"] = DateTime.Now.AddMinutes(_sessionTime);
}
}

this code works fine on my developer edition, but I cannot get it working on my sandbox.

The value for 

serverUrl = "https://tapp0-api.salesforce.com/services/Soap/u/10.0/00DT0000000Gg4C"


The error I get is:

 

 No operation available for request {http://soap.sforce.com/schemas/class/MyService}HelloWolrd

Message Edited by dke01 on 11-29-2009 03:35 PM
Message Edited by dke01 on 11-29-2009 03:37 PM
  • November 29, 2009
  • Like
  • 0

Hi

In our company we need to support login and self-registration features on a force.com site that we have developed. 

 

In production instance when I go to the site  "login Settings" I see the "edit" button where I can enable login functionality however in sandbox this button "Edit" is not available, we prefer to test everything in sandbox before roll it out to production.

 

How can I try login functionality before deploying it to production?

 

 Thanks

  • September 17, 2009
  • Like
  • 0
I read the Primitive Data Types section in Chapter 2 of the Apex API 15 document. The type 'byte' has been mentioned. But I check the v15 Enterprise WSDL, and did not find the use of xsd:byte. 

So I would like to know, where does this 'byte' used in Apex API. Is it possible if I create a particular field on an sObject, and then the field with type 'xsd:byte' will appear in the Enterprise WSDL? 
  • January 29, 2009
  • Like
  • 0