I am using windows application to connect with Microsoft Dynamics CRM . Here I can login using online federation and on-Premise types but when I try to login with Live Id credentials, I am getting security error like "An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail."
So pls tell me how can I get login using with live id details.
Note: I am using SDK authenticationwithnohelp code for login
The best way to troubleshoot this kind of thing is to look at the inner fault details that are generated when a call to the CRM web service fails. The exception type thrown is usually:
System.ServiceModel.FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>
Wrap your code in a try / catch block and examine the exception Detail and Detail.InnerFault objects:
try
{
// Connection code here
}
catch (System.ServiceModel.FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault> ex)
{
string exceptionMessage = ex.Message;
int errorCode = -1;
// Check for fault detailed information
if (ex.Detail != null)
{
// Check for the Detail InnerFault
if (ex.Detail.InnerFault != null)
{
// Get the inner fault message and code - this is where the useful information is
exceptionMessage += " - " + ex.Detail.InnerFault.Message;
errorCode = ex.Detail.InnerFault.ErrorCode;
}
else
{
// No InnerFault was defined, get the Detail message and code
if (exceptionMessage != ex.Detail.Message)
{
// The Detail.Message will usually be the same as the outer exception
exceptionMessage += " - " + ex.Detail.Message;
}
errorCode = ex.Detail.ErrorCode;
}
}
// Output exceptionDetails and errorCode here
Trace.WriteLine("Exception message: " + exceptionMessage);
Trace.WriteLine("Exception code: " + errorCode);
}
The exception error code property can also be helpful. The error code is returned as a format decimal, for example -2147167730
You can cross-reference this against the list of error codes returned by the CRM web service on MSDN here: http://msdn.microsoft.com/en-us/library/gg328182.aspx
However, first you need to convert the error code from decimal to the hex format used on MSDN.
Using the example error code -2147167730:
Open the Windows Calculator
Select Programmer mode (Alt + 3)
Select Dec (Decimal) and paste in the error code (-2147167730)
Select Hex, and the code will be converted to 'FFFFFFFF8004D20E'
Remove the leading FFFFFFFF characters, and then look on the MSDN error code page for '8004D20E'
Related
I'm using ibmmq module https://github.com/ibm-messaging/mq-mqi-nodejs
I need to get an xml message from a queue and than make an xsl-transformation.
I put messages to the queue with JMeter and if I browse messages in rfhutil I can see them as is on the Data tab.
But when I get it in the code
function getCB(err, hObj, gmo,md,buf, hConn ) {
// If there is an error, prepare to exit by setting the ok flag to false.
if (err) {...
} else {
if (md.Format=="MQSTR") {
console.log("message <%s>", decoder.write(buf));
} else {
console.log("binary message: " + buf);
}
}
I get my message with some service information:
buf=RFH �"�MQSTR � <mcd><Msd>jms_text</Msd></mcd> X<jms><Dst>queue://MY_QM/MY_QUEUE</Dst><Tms>1657791724648</Tms><Dlv>2</Dlv></jms> ...My_message...
How can I get only My message like I do in rfhutil?
I can get it with string methods, but it looks like crutches.
That message has the headers created by a JMS application. There are various ways of dealing with it. You can
Have the sending app disable sending that structure (setting the targClient property)
Use GMO options to ignore the properties (MQGMO_NO_PROPERTIES)
Have your application deal with the RFH2 stucture. See for example the amqsget.js sample in the Node.js repo which includes this fragment:
switch (format) {
case MQC.MQFMT_RF_HEADER_2:
hdr = mq.MQRFH2.getHeader(buf);
I have created a webmethod in a C# webservice that listens for Docusign to call when an Envelope status changes:
[WebMethod]
public void DocuSignConnectUpdate(DocuSignEnvelopeInformation DocuSignEnvelopeInformation)
{
//Check if null
if (DocuSignEnvelopeInformation == null)
{
File.WriteAllText("C:\\websites\\DataAPI\\datalog.txt", "Data: " + "Data is null");
}
else
{
string envelopeId = "";
try
{
//Write a line in a file
File.WriteAllText("C:\\websites\\DataAPI\\datalog.txt", "Data: " + DocuSignEnvelopeInformation.ToString());
//Get some data out
envelopeId = DocuSignEnvelopeInformation.EnvelopeStatus.EnvelopeID;
//Write Data to a file
File.WriteAllText("C:\\websites\\DataAPI\\innerdatalog.txt", "Data: " + DocuSignEnvelopeInformation.ToString());
}
catch (Exception ex)
{
// could not serialize
File.WriteAllText("C:\\websites\\DataAPI\\errorlog.txt", "Exception: " + ex.Message);
throw new SoapException(ex.Message, SoapException.ClientFaultCode);
}
}
The issue I am having is that DocuSignEnvelopeInformation argument is not being set when called, so the code keeps terminating at the if==null statement. When I run the envelope data to the API using SoapUI everything works correctly. Any ideas what I'm missing would be appreciated.
EDIT: I wanted to Add the Interface here too since I forgot it originally
[ServiceContract(ConfigurationName = "IOperations", Namespace = "https://www.docusign.net/API/3.0")]
public interface IOperations
{
[OperationContract(Action = "DocuSignConnectListener/Operations/DocuSignConnectUpdate")]
[XmlSerializerFormat]
string DocuSignConnectUpdate(DocuSignEnvelopeInformation DocuSignEnvelopeInformation);
}
When a DocuSign webhook is set to use SOAP mode, the notification is sent as a SOAP request to your server (your listener).
If SOAP mode is off, then the notification is sent as a regular POST request with an XML body.
In your question, you say that
When I run the envelope data to the API using SoapUI everything works correctly
So it sounds like everything is worked as designed.
Ok I finally figured this out, turns out it just wasn't pretty enough so I added a decoration specifically:
[SoapDocumentMethod("http://tempuri.org/DocuSignConnectUpdate",
RequestNamespace = "http://tempuri.org",
ResponseNamespace = "http://tempuri.org",
Use = System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
on the method and now everything works like its supposed too. Now that I look at it, it makes a lot more sense.
I have researched for days and not found an answer. I have used both google and Stack and MDSN so I finally thought it is time to ask the question. I am a new developer I completed my first assignment and my computer died. I got Win 8.1 pro and IIS 8.5 and now I am tasked with making that work with SQL 2012. I have it so I can load up the localhost to the first page of the app which is a login and then when I am debuging using Visual Studio after I start to log in
the first call to the db this comes up
An exception of type 'System.ServiceModel.ProtocolException' occurred in mscorlib.dll but was not handled in user code
Additional information: The remote server returned an unexpected response: (405) Method Not Allowed.
Then I get the same message again and then it sends me to the error page.
I am an IIS newbie, but I have ensured IUSER has the correct authorization and I have checked all of the web.configs, as well as the applicationHost file. This has to be a IIS problem is what I have come up but I would gladly be wrong if someone told me I was wrong and corrected. Thanks for the help.
Code Example
The first call to db where the first error pops up
MYapp.GlobalDataService.GlobalDataServiceClient gdc = new Myapp.Proxy.GlobalDataService.GlobalDataServiceClient();
ReadLogosResult result = gdc.GetLogos(_customerId, region_id, branch_id);
if (result != null)
{
logoContent = result.Logo;
}
This is after clicking login
public static int GetUserId(IIdentity contextIdentity)
{
FormsIdentity identity = contextIdentity as FormsIdentity;
if (identity == null)
{
throw new ApplicationException("cannot cast context identity to FormsIdentity type");
}
return Convert.ToInt32(identity.Ticket.UserData.Split(';')[0]);
}
Then this
for (int i = 0; i < ContextKeys.Length; i++)
{
string ContextKey = ContextKeys[i];
if (ContextKey == "appErr")
{
obj = (Exception)HttpContext.Current.Application["appErr"];
HttpContext.Current.Application.Remove("appErr");
}
if (ContextKey == "userId")
{
user = (int)HttpContext.Current.Application["userId"];
HttpContext.Current.Application.Remove("userId");
}
}
errors out Object reference not set to an instance of an object
then goes to our customer error page
I got it figured out. I needed to install HTTPActivation in WCF.
On an xpage I run the following code:
function setPersonInfoCommon(x) {
//print("test printing to console value: " + x)
var serv = getPreferenceField("tx_server");
//e.g. "Development1";
var dbname = getPreferenceField("tx_loc_personal_common");
//e.g. "CustomerX\\Personnel.nsf"
var db:NotesDatabase = session.getDatabase(serv,dbname);
if (db == null) {
requestScope.status = "Database not found.";
return;
}
var vw:NotesView = db.getView("LookUpUsersUNID");
if (vw == null) {
requestScope.status = "View not found.";
return;
}
var doc:NotesDocument = vw.getDocumentByKey(x);
if (doc == null) {
requestScope.status = "Document not found.";
return;
}
else{
requestScope.status = "Document created:" + getCreated();
}
}
This freezes my XPage and in the log I see the following notation:
2014-08-19 12:46:11 HTTP JVM: com.ibm.xsp.webapp.FacesServlet$ExtendedServletException: com.ibm.xsp.FacesExceptionEx: java.io.NotSerializableException: lotus.domino.local.DateTime
2014-08-19 12:46:11 HTTP JVM: CLFAD0134E: Exception processing XPage request. For more detailed information, please consult error-log-0.xml located in E:/Domino/data/domino/workspace/logs
The XPage resides in a different NSF than the one I perform the getDocumentByKey method in. However I do not get any indication that the database (db) or view (vw) can not be found. If I check it by outputting the filepath or something I get the correct values returned.
I tested to run the code from within the NSF I perform the getDocumentByKey method and then the code runs just fine.
What can be the cause?
I am logged in via the web and have the proper rights.
Please always look at those more detailed logs in the location specified before posting a question. Those messages give much more information which will help identify the code causing the problem and usually a more detailed explanation.
In this particular case, the message on the console logs includes "java.io.NotSerializableException: lotus.domino.local.DateTime". Assuming this is relating to the line requestScope.status = "Document created:" + getCreated(); (the detailed logs will confirm) and that getCreated() is actually doc.getCreated(), that returns a NotesDateTime object.
NotesDateTime objects and any other Domino objects cannot be put in any scoped variable (there are various blogs explaining that Domino objects are not serializable).
If you want to put a date/time in a scope, you can get the Java date equivalent using NotesDateTime.toJavaDate(), so doc.getCreated().toJavaDate().
This is my first time ever with Sharepoint. Here is the scenario
I have a stand alone web application
I also have a stand alone sharepoint server.
Both are on different servers.
I need to upload a file from web application to sharepoint
I found 2 methods online,
Using the webservice provided by Sharepoint (CopyIntoItems)
Using jQuery library of Sharepoint webservice
After searching the web, I think the jQuery part will not work (you can correct me).
I am looking for a method that takes username/password and uploads a pdf file to Sharepoint server. The following is my C# code that tries to upload but ends up in error
public bool UploadFile(string file, string destination)
{
bool success = false;
CopySoapClient client = new CopySoapClient();
if (client.ClientCredentials != null)
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
try
{
client.Open();
string filename = Path.GetFileName(file);
string destinationUrl = destination + filename;
string[] destinationUrls = { destinationUrl };
FieldInformation i1 = new FieldInformation { DisplayName = "Title", InternalName = "Title", Type = FieldType.Text, Value = filename };
FieldInformation[] info = { i1 };
CopyResult[] result;
byte[] data = File.ReadAllBytes(file);
//uint ret = client.CopyIntoItems(filename, destinationUrls, info, data, out result);
uint ret = client.CopyIntoItems(file, destinationUrls, info, data, out result);
if (result != null && result.Length > 0 && result[0].ErrorCode == 0)
success = true;
}
finally
{
if (client.State == System.ServiceModel.CommunicationState.Faulted)
client.Abort();
if (client.State != System.ServiceModel.CommunicationState.Closed)
client.Close();
}
return success;
}
I am calling the above function like this
UploadFile(#"C:\temp\uploadFile.txt", "http://spf-03:300/demo/Dokumente").ToString();
Error that i get:
Error Code: Destination Invalid
Error Message: The service method 'Copy' must be called on the same domain that contains the target URL.
There is the 3rd option with SharePoint 2010 and that is to use the Client Side object model. The client side object model a a sub set of the larger Sharepoint API, but it does cover uploading documents. Below is blog post with an example of uploading.
Upload document through client object model
As with most things in SharePoint you will need to authenticate against it the site, so find out if your site collection is forms based or claims based and then you should be able to find sample code for your situation.
Solution to the problem:
The problem was that the "security token webservice" was not working and it was giving some error when we manually ran the webservice.
The server was unable to process the request due to an internal error.
For more information about the error, either turn on
IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute
or from the configuration behavior) on the server in order to send the
exception information back to the client, or turn on tracing as per
the Microsoft .NET Framework 3.0 SDK documentation and inspect the
server trace logs.
The above exception is a generic one. To view the exact exception we enabled remote error viewing from the web.config file of the webservice(link) and saw the exact exception.
We found the solution for the exception and the service started. After that everything was working fine.