I have Quickbooks Desktop Enterprise 18.0. I already created connection using qwc file through web connector.when I click Update selected option from web connector the result says okay. But If I include customer data in web service and click Update selected it shows error in status bar i.e Description:
Error message received from application via getLastError(): Error!.
I pasted code below Please review it and Guide if there anything wrong. Thank you.
public ArrayList buildRequest() {
string strRequestXML ="";
XmlDocument inputXMLDoc = null;
// CustomerQuery
inputXMLDoc = new XmlDocument();
inputXMLDoc.AppendChild(inputXMLDoc.CreateXmlDeclaration("1.0",null, null));
inputXMLDoc.AppendChild(inputXMLDoc.CreateProcessingInstruction("qbxml", "version=\"4.0\""));
XmlElement qbXML = inputXMLDoc.CreateElement("QBXML");
inputXMLDoc.AppendChild(qbXML);
XmlElement qbXMLMsgsRq = inputXMLDoc.CreateElement("QBXMLMsgsRq");
qbXML.AppendChild(qbXMLMsgsRq);
qbXMLMsgsRq.SetAttribute("onError", "stopOnError");
XmlElement CustomerAddRq = inputXMLDoc.CreateElement("CustomerAddRq");
qbXML.AppendChild(CustomerAddRq);
qbXMLMsgsRq.SetAttribute("requestID", "1");
XmlElement CustomerAdd = inputXMLDoc.CreateElement("CustomerAdd");
CustomerAddRq.AppendChild(CustomerAdd);
XmlElement Name = inputXMLDoc.CreateElement("Name");
CustomerAdd.AppendChild(Name);
CustomerAdd.AppendChild(Name).InnerText = "Naga";
XmlElement FirstName = inputXMLDoc.CreateElement("FirstName");
CustomerAdd.AppendChild(FirstName);
CustomerAdd.AppendChild(Name).InnerText = "Nagarajan";
XmlElement MiddleName = inputXMLDoc.CreateElement("MiddleName");
CustomerAdd.AppendChild(MiddleName);
XmlElement LastName = inputXMLDoc.CreateElement("LastName");
CustomerAdd.AppendChild(LastName);
CustomerAdd.AppendChild(Name).InnerText = "Varatharajan";
XmlElement BillAddress = inputXMLDoc.CreateElement("BillAddress");
CustomerAdd.AppendChild(BillAddress);
XmlElement Addr1 = inputXMLDoc.CreateElement("Addr1");
BillAddress.AppendChild(Addr1);
BillAddress.AppendChild(Addr1).InnerText = "33/33 st";
XmlElement City = inputXMLDoc.CreateElement("City");
BillAddress.AppendChild(City);
BillAddress.AppendChild(City).InnerText = "Chennai";
XmlElement State = inputXMLDoc.CreateElement("State");
BillAddress.AppendChild(State);
BillAddress.AppendChild(State).InnerText = "TN";
XmlElement Phone = inputXMLDoc.CreateElement("Phone");
CustomerAdd.AppendChild(Phone);
CustomerAdd.AppendChild(Phone).InnerText = "4545455";
//XmlElement customerQueryRq = inputXMLDoc.CreateElement("CustomerQueryRq");
//qbXMLMsgsRq.AppendChild(customerQueryRq);
//customerQueryRq.SetAttribute("requestID", "1");
// XmlElement maxReturned=inputXMLDoc.CreateElement("MaxReturned");
// customerQueryRq.AppendChild(maxReturned).InnerText="1";
strRequestXML = inputXMLDoc.OuterXml;
req.Add(strRequestXML);
}
Related
I am using soap service to authenticate request by sabre as in the document https://developer.sabre.com/docs/read/soap_basics/Authentication.
I generate the proxy classes using wsdl. i put authentication credential in the code. This is my Code for test purpose:
using ConsoleApplication1.SessionReference1;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
[STAThread]
static void Main(string[] args)
{
try
{
// Set user information, including security credentials and the IPCC.
string username = "my-username";
string password = "my-password";
string ipcc = "not-understand";
string domain = "EXT";
string temp = Environment.GetEnvironmentVariable("tmp"); // Get temp directory
string PropsFileName = temp + "/session.properties"; // Define dir and file name
DateTime dt = DateTime.UtcNow;
string tstamp = dt.ToString("s") + "Z";
//Create the message header and provide the conversation ID.
MessageHeader msgHeader = new MessageHeader();
msgHeader.ConversationId = "TestSession"; // Set the ConversationId
From from = new From();
PartyId fromPartyId = new PartyId();
PartyId[] fromPartyIdArr = new PartyId[1];
fromPartyId.Value = "WebServiceClient";
fromPartyIdArr[0] = fromPartyId;
from.PartyId = fromPartyIdArr;
msgHeader.From = from;
To to = new To();
PartyId toPartyId = new PartyId();
PartyId[] toPartyIdArr = new PartyId[1];
toPartyId.Value = "WebServiceSupplier";
toPartyIdArr[0] = toPartyId;
to.PartyId = toPartyIdArr;
msgHeader.To = to;
//Add the value for eb:CPAId, which is the IPCC.
//Add the value for the action code of this Web service, SessionCreateRQ.
msgHeader.CPAId = ipcc;
msgHeader.Action = "SessionCreateRQ";
Service service = new Service();
service.Value = "SessionCreate";
msgHeader.Service = service;
MessageData msgData = new MessageData();
msgData.MessageId = "mid:20001209-133003-2333#clientofsabre.com1";
msgData.Timestamp = tstamp;
msgHeader.MessageData = msgData;
Security security = new Security();
SecurityUsernameToken securityUserToken = new SecurityUsernameToken();
securityUserToken.Username = username;
securityUserToken.Password = password;
securityUserToken.Organization = ipcc;
securityUserToken.Domain = domain;
security.UsernameToken = securityUserToken;
SessionCreateRQ req = new SessionCreateRQ();
SessionCreateRQPOS pos = new SessionCreateRQPOS();
SessionCreateRQPOSSource source = new SessionCreateRQPOSSource();
source.PseudoCityCode = ipcc;
pos.Source = source;
req.POS = pos;
SessionCreatePortTypeClient s = new SessionCreatePortTypeClient();
SessionCreateRS resp = s.SessionCreateRQ(ref msgHeader, ref security, req);
//SessionCreateRQService serviceObj = new SessionCreateRQService();
//serviceObj.MessageHeaderValue = msgHeader;
//serviceObj.SecurityValue = security;
//SessionCreateRS rs = new SessionCreateRS();
//SessionCreateRS = serviceObj.SessionCreateRQ(req); // Send the request
if (resp.Errors != null && resp.Errors.Error != null)
{
Console.WriteLine("Error : " + resp.Errors.Error.ErrorInfo.Message);
}
else
{
// msgHeader = serviceObj.MessageHeaderValue;
// security = serviceObj.SecurityValue;
Console.WriteLine("**********************************************");
Console.WriteLine("Response of SessionCreateRQ service");
Console.WriteLine("BinarySecurityToken returned : " + security.BinarySecurityToken);
Console.WriteLine("**********************************************");
string ConvIdLine = "convid=" + msgHeader.ConversationId; // ConversationId to a string
string TokenLine = "securitytoken=" + security.BinarySecurityToken; // BinarySecurityToken to a string
string ipccLine = "ipcc=" + ipcc; // IPCC to a string
// File.Delete(PropsFileName); // Clean up
// TextWriter tw = new StreamWriter(PropsFileName); // Create & open the file
// tw.WriteLine(DateTime.Now); // Write the date for reference
// tw.WriteLine(TokenLine); // Write the BinarySecurityToken
// tw.WriteLine(ConvIdLine); // Write the ConversationId
// tw.WriteLine(ipccLine); // Write the IPCC
// tw.Close();
//Console.Read();
}
}
catch (Exception e)
{
Console.WriteLine("Exception Message : " + e.Message);
Console.WriteLine("Exception Stack Trace : " + e.StackTrace);
Console.Read();
}
}
}
}
Please Help me
I didn't check the sequence of the code in detail, but checking the values you set for organization and domain:
string ipcc = "not-understand";
string domain = "EXT";
Unless you did it intentionally to mask the values, you should have received your ipcc value from Sabre after getting a SOAP webservices account.
The value for SOAP APIs domain is normally "DEFAULT".
Registering on dev studio only gives you REST test credentials (not SOAP), so you can use this form to request SOAP test credentials:
https://developer.sabre.com/contact
Finally, I don't quite see the environment/target url you're using to test the SessionCreate service...CERT one is: https://sws3-crt.cert.sabre.com/
I have a application which is in sharepoint 2010. actually application users works in that application from multiple locations.. and if one user is working for 15 days in IST time (UTC+5:30) and for next 10 days goes to US then he works in CST or EST timezone... so my user changes his timezone as per his location... but now problem is.. when he go to generate his report.. which does not show correct for date time fields....
if he is correctly selected IST timezone then all data shows by IST timezone... the EST and CST doest not show correct also user can not segregate his different - 2 timezone data...
actually i have provided a report by asmx webservices.. Please find below code which i have written..
using System;
using System.Collections;
using System.Text;
using System.Data;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.Security.Principal;
using System.Net;
using System.Xml;
public class SharePointActivities
{
[SqlFunction(SystemDataAccess = SystemDataAccessKind.Read, FillRowMethodName = "GetActivitiesItemInfo")]
public static IEnumerable GetActivitiesItems(SqlString url, SqlString listName, SqlString viewName, SqlString Query)
{
DataTable t = new DataTable();
WindowsImpersonationContext ctx = null;
WindowsIdentity id = SqlContext.WindowsIdentity;
try
{
ctx = id.Impersonate();
WSS.Lists svc = new WSS.Lists();
svc.Url = url.ToString();
//svc.Credentials = new NetworkCredential("krishna", "google#123", "WKS10953");
//Or
//svc.Credentials = new System.Net.NetworkCredential("krishna", "google#123", "WKS10953");
//Or
svc.Credentials = CredentialCache.DefaultNetworkCredentials;
//Or
//svc.UseDefaultCredentials = true;
//svc.PreAuthenticate = true;
//Or
//oServices.Credentials = new NetworkCredential("krishna", "google#123", "wks10953");
//Query
XmlDocument xmlDoc = new XmlDocument();
XmlNode query = xmlDoc.CreateElement("Query");
query.InnerXml = Query.ToString();//"<Where><Gt><FieldRef Name=\"ID\" /><Value Type=\"Counter\">3</Value></Gt></Where>";
//ViewFields
XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
viewFields.InnerXml = "";// "<FieldRef Name=\"Title\" />";
//QueryOptions
XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
queryOptions.InnerXml = "";
XmlNode node = svc.GetListItems(listName.ToString(), viewName.ToString(), query, viewFields, "500000", queryOptions, null);
XmlTextReader rdr = new XmlTextReader(node.OuterXml,
XmlNodeType.Element, null);
DataSet ds = new DataSet();
ds.ReadXml(rdr);
t = ds.Tables[1];
}
finally
{
if (ctx != null)
ctx.Undo();
}
return t.Rows;
}
public static void GetActivitiesItemInfo(
object obj,
out SqlString ID,
out SqlString Title,
out SqlString RecordDate,
out SqlString ClientVertical,
out SqlString Client,
out SqlString StoreUnits,
out SqlString Process,
out SqlString MainActivity,
out SqlString SubActivity,
out SqlString PeriodStartDate,
out SqlString PeriodEndDate,
out SqlString NoOfPeriod,
out SqlString EntryType,
out SqlString StartTime,
out SqlString StopTime,
out SqlString TimeTaken,
//out SqlString VolumeCount,
//out SqlString InputMode,
//out SqlString Category,
out SqlString Remarks)
{
DataRow r = (DataRow)obj;
ID = new SqlString(Convert.ToString(r["ows_ID"]));
Title = new SqlString(Convert.ToString(r["ows_Title"]));
RecordDate = new SqlString(Convert.ToString(r["ows_RecordDate"]));
ClientVertical = new SqlString(Convert.ToString(r["ows_ClientVertical"]));
Client = new SqlString(Convert.ToString(r["ows_Client"]));
StoreUnits = new SqlString(Convert.ToString(r["ows_StoreUnits"]));
Process = new SqlString(Convert.ToString(r["ows_Process"]));
MainActivity = new SqlString(Convert.ToString(r["ows_MainActivity"]));
SubActivity = new SqlString(Convert.ToString(r["ows_SubActivity"]));
PeriodStartDate = new SqlString(Convert.ToString(r["ows_PeriodStartDate"]));
PeriodEndDate = new SqlString(Convert.ToString(r["ows_PeriodEndDate"]));
NoOfPeriod = new SqlString(Convert.ToString(r["ows_NoOfPeriod"]));
EntryType = new SqlString(Convert.ToString(r["ows_EntryType"]));
StartTime = new SqlString(Convert.ToString(r["ows_StartTime"]));
StopTime = new SqlString(Convert.ToString(r["ows_StopTime"]));
TimeTaken = new SqlString(Convert.ToString(r["ows_TimeTaken"]));
//VolumeCount = new SqlString(Convert.ToString(r["ows_VolumeCount"]));
//InputMode = new SqlString(Convert.ToString(r["ows_InputMode"]));
//Category = new SqlString(Convert.ToString(r["ows_Category"]));
Remarks = new SqlString(Convert.ToString(r["ows_Remarks"]));
}
}
in this code for my report gets parameters start date and end date from Recorddate field.. but if user selected currently IST timezone.. then CST and EST recorded data shows 1 day before which does't work..
so may i know record created timezone and utc value of record data to find in every timezone... or any other solution to find actual date..
I'm trying to write an application that would work with the EWS proxy classes. To generate proxy classes I used gsoap (compiled OpenSSL).
I have implemented a library that works with EWS, but. Net.
The problem is this: I have no idea how to implement a connection to the server.
Doing the following:
ExchangeServiceBindingProxy *proxy = new ExchangeServiceBindingProxy("https://192.168.0.49/EWS/exchange.asmx");
soap *pSoap = proxy->soap;
pSoap->userid = "user1";
pSoap->passwd = "password1";
pSoap->recv_timeout = 300;
pSoap->send_timeout = 300;
SOAP_ENV__Header *header = new SOAP_ENV__Header();
header->ns3__RequestServerVersion = new _ns3__RequestServerVersion();
header->ns3__RequestServerVersion->soap = pSoap;
header->ns3__RequestServerVersion->Version = ns3__ExchangeVersionType__Exchange2010;
pSoap->header = header;
//get root folder ID
ns3__DistinguishedFolderIdType *dfit = new ns3__DistinguishedFolderIdType();
dfit->Id = ns3__DistinguishedFolderIdNameType__inbox;
//set the props that we want to retrieve
ns3__FolderResponseShapeType *frst = new ns3__FolderResponseShapeType();
frst->BaseShape = ns3__DefaultShapeNamesType__AllProperties;
//get folder
ns1__GetFolderType *gftRoot = new ns1__GetFolderType();
gftRoot->FolderIds = new ns3__NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType = new __ns3__union_NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType->union_NonEmptyArrayOfBaseFolderIdsType.DistinguishedFolderId = dfit;
gftRoot->FolderShape = frst;
__ns1__GetFolderResponse response;
int error = proxy->GetFolder(gftRoot, response);
As a result, getting the error: SLL_ERROR.
I know, that i`m doing something wrong. But what? What i should to do, to use proxy classes functions?
I resolved it by myself:
Added to project LibNTLM and added to preprocessor WITH_NTLM.
Also changed code, a little bit:
ExchangeServiceBindingProxy *proxy = new ExchangeServiceBindingProxy(endpoint.c_str());
soap *pSoap = proxy->soap;
pSoap->userid = "Ivan1";
pSoap->passwd = "1";
pSoap->ntlm_challenge = "";
pSoap->authrealm = "Ursa-Minor";
pSoap->ssl_flags = SOAP_SSL_NO_AUTHENTICATION;
//pSoap->keep_alive = true;
pSoap->mode = SOAP_IO_KEEPALIVE;
//get root folder ID
ns3__DistinguishedFolderIdType *dfit = new ns3__DistinguishedFolderIdType();
dfit->Id = ns3__DistinguishedFolderIdNameType__inbox;
//set the props that we want to retrieve
ns3__FolderResponseShapeType *frst = new ns3__FolderResponseShapeType();
frst->BaseShape = ns3__DefaultShapeNamesType__AllProperties;
//get folder
ns1__GetFolderType *gftRoot = new ns1__GetFolderType();
gftRoot->FolderIds = new ns3__NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__size_NonEmptyArrayOfBaseFolderIdsType = 1;
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType = new __ns3__union_NonEmptyArrayOfBaseFolderIdsType();
gftRoot->FolderIds->__union_NonEmptyArrayOfBaseFolderIdsType->union_NonEmptyArrayOfBaseFolderIdsType.DistinguishedFolderId = dfit;
gftRoot->FolderIds = (ns3__NonEmptyArrayOfBaseFolderIdsType*)dfit;
gftRoot->FolderShape = frst;
__ns1__GetFolderResponse response;
int qq = proxy->GetFolder(gftRoot, response);
return true;
But now i have enother problems: Error 500: Internal Server Error
I'm going crazy here with DCRM web services,
I'm trying to create a Connection between two leads dynamically.
I'm getting the following error:
"0x80040216
An unexpected error occurred.
Platform
An unexpected error occurred.
Type:Microsoft.Crm.CrmException ErrorCode:0x80040216
Object reference not set to an instance of an object."
Here is my code:
Guid connectionRoleID = new Guid("64f33a74-0342-e211-b55e-00155d00041e");
connectionroleobjecttypecode connroleobjecttypecode = new connectionroleobjecttypecode() { connectionroleid = new Lookup(){Value = connectionRoleID}, associatedobjecttypecode = EntityName.lead.ToString()};
connection conn = new connection();
List<Property> list = new List<Property>();
Lookup lookup = new Lookup();
lookup.Value = customers[i].ID.Value.Value;
lookup.name = EntityName.lead.ToString();
Lookup lookup2 = new Lookup();
lookup2.Value = customers[j].ID.Value.Value;
lookup2.name = EntityName.lead.ToString();
conn.record1roleid = new Lookup() { name = "duplicate", Value = new Guid("64f33a74-0342-e211-b55e-00155d00041e") };
conn.record2roleid = new Lookup() { name = "duplicate", Value = new Guid("64f33a74-0342-e211-b55e-00155d00041e") };
list.Add(new LookupProperty(){Name = "record1id", Value = lookup});
list.Add(new LookupProperty(){Name = "record2id", Value = lookup2});
list.Add(new LookupProperty(){Name = "record1roleid", Value = conn.record1roleid});
list.Add(new LookupProperty() { Name = "record2roleid", Value = conn.record2roleid });
I've tried tracing (which did not help), and in the eventviewer I get an error, but there is no helpful information.
I'm dying here! Please help... :-)
I think its because you are doing:
conn.record1roleid = new Lookup() { name = "duplicate", Value = new Guid("64f33a74-0342-e211-b55e-00155d00041e") };
name should be the name of an entity, e.g. contact, lead, incident. In this case I believe you should be using: connectionrole.
conn.record1roleid = new Lookup() { name = "connectionrole", Value = new Guid("64f33a74-0342-e211-b55e-00155d00041e") };
I would suggest having at Sample: Create a Connection (Early Bound).
Add type for the entity to lookup
Lookup lookup2 = new Lookup();
lookup2.Value = customers[j].ID.Value.Value;
lookup2.name = EntityName.lead.ToString();
**lookup2.type = "lead";**
I'm fairly new to webservices and working through a SAAJ example of sending and recieving attachments (binary files). I can get it to work when the client sends the file but not when it requests it. I get an exception on the client side:
ERROR: 'Content is not allowed in prolog.'
24-Oct-2012 13:59:28 com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory createEnvelope
SEVERE: SAAJ0511: Unable to create envelope from given source
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source
Anybody have any ideas???my client code is as follows:
SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
SOAPConnection con = scf.createConnection();
SOAPFactory soapFactory = SOAPFactory.newInstance();
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage msg = mf.createMessage();
SOAPHeader header = msg.getSOAPHeader();
header.detachNode();
SOAPBody body = msg.getSOAPBody();
Name bodyName = soapFactory.createName(
"remoteOpen", "remoteOpen",
"http://schemas.remoteOpen.com/remoteOpen");
SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
SOAPElement projectName = bodyElement.addChildElement("projectName");
projectName.addTextNode("filename");
msg.saveChanges();
// create the endpoint and send the message
URL endpoint = new URL("http://localhost:8080/RemoteSaveProject/OpenServlet");
SOAPMessage response = con.call(msg, endpoint);
con.close();
SOAPBody responseBody = response.getSOAPBody();
SOAPElement ackElem = (SOAPElement)responseBody.getFirstChild();
String acknowledgement = ackElem.getValue();
the server code looks like this:
MimeHeaders mimeHeaders = new MimeHeaders();
Enumeration en = request.getHeaderNames();
while (en.hasMoreElements())
{
String headerName = (String)en.nextElement();
String headerVal = request.getHeader(headerName);
StringTokenizer tk = new StringTokenizer(headerVal, ",");
while (tk.hasMoreTokens()){
mimeHeaders.addHeader(headerName, tk.nextToken().trim());
}
}
SOAPMessage message = mf.createMessage(mimeHeaders, request.getInputStream());
SOAPBody body = message.getSOAPBody();
Name bodyName = soapFactory.createName(
"remoteOpen", "remoteOpen",
"http://schemas.remoteOpen.com/remoteOpen");
Iterator projects = body.getChildElements(bodyName);
SOAPElement project = (SOAPElement)projects.next();
Iterator projectNameIter = project.getChildElements(soapFactory.createName("projectName"));
SOAPElement projectNameEle = (SOAPElement)projectNameIter.next();
String projectName = projectNameEle.getValue();
File file = new File(projectName);
SOAPMessage reply = mf.createMessage();
SOAPHeader header = reply.getSOAPHeader();
header.detachNode();
SOAPBody replyBody = reply.getSOAPBody();
SOAPBodyElement bodyElement = replyBody.addBodyElement(soapFactory.createName("ack"));
bodyElement.addTextNode("OK");
DataHandler dh = new DataHandler(new FileDataSource(file));
AttachmentPart attachment = reply.createAttachmentPart(dh);
attachment.setContentId("123");
reply.addAttachmentPart(attachment);
reply.saveChanges();
response.setStatus(HttpServletResponse.SC_OK);
putHeaders(reply.getMimeHeaders(), response);
response.setContentType("text/xml");
ServletOutputStream replyOS = response.getOutputStream();
reply.writeTo(replyOS);
replyOS.flush();
replyOS.close();
putHeaders looks like:
Iterator it = headers.getAllHeaders();
while (it.hasNext())
{
MimeHeader header = (MimeHeader) it.next();
String[] values = headers.getHeader(header.getName());
if (values.length == 1)
{
res.setHeader( header.getName(), header.getValue());
}
else
{
StringBuffer concat = new StringBuffer();
int i = 0;
while (i < values.length)
{
if (i != 0)
{
concat.append(',');
}
concat.append(values[i++]);
}
res.setHeader(header.getName(), concat.toString());
}
}
If you are using Google app engine, like me, the problem is that GAE doesn't support com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ParameterList which is used internally somewhere in the call chain of javax.xml.soap.SOAPConnection.call(). So you must use a workaround.
I personally did it by using java.net.HttpURLConnection instead of javax.xml.soap.SOAPConnection and manually sending and parsing SOAP messages.