"Re-opening" DocuSign "Delivered" envelope in embedded view - soap

My question in a nutshell: Using the SOAP API, is there a way to allow the signer to "Re-open" an envelope that is in Delivered Status (Not expired or completed) in an embedded application?
The details: Using the SalesForce SOAP API examples given here https://github.com/docusign/docusign-soap-sdk (thank you to whoever provided these!), I am having great success creating NEW envelopes. However, using the methods provided in the samples, a brand new envelope is created without regard for existing envelopes. I would like to see if there are any unexpired, delivered envelopes and present that before creating a new one. Unfortunately, I'm not seeing any way to fetch an envelope using an Envelope ID (eg: C87908AD-908E-45F6-B4F9-8B6A514XXXXX) and present that to the signer.

Turns out this was pretty simple. If you know the Envelope ID, you can create a new token that can be used to load the envelope into your app. It looks like this:
try {
token = dsApiSend.RequestRecipientToken(
document_status.dsfs__DocuSign_Envelope_ID__c,'1',contact.FirstName + ' ' + contact.LastName,contact.Email,assert,clientURLs);
} catch ( CalloutException e) {
System.debug('Exception - ' + e );
envelopeId = 'Exception - ' + e;
}

Related

SoapUI 5.7.0 mockRequest.requestContent is empty for POST request

I am using SOAP UI 5.7.0 to mock a REST service and it is working fine. Only, when I want to access the body of a POST request with mockRequest.requestContent, the correct content is returned only in the first call, but from then on, it always returns the empty string.
I tried the call in OnRequestScript and in the POST requests own Dispatch script but the behavior is the same in both cases. I have the suspicion, that the Stream of the request is already read somewhere else and so does not return any more content. But I don't know what to do about it.
I wonder what is the correct way to read the content of a POST request.
Thank you
Appears to be a known issue, see posts in the community forum here and here.
this seems to be an old bug of PUT operation in REST mocks.
Unfortunately, this is a bug. There is an internal defect of SOAP-2344 for this issue. This applies for the PUT and DELETE methods for a REST mock service.
I have the same issue with a PATCH request.
Use the following trick to get the body of the PUT and DELETE requests:
mockRequest.with {
if (method.toString() == 'PUT' || method.toString() == 'DELETE') {
InputStreamReader isr = new InputStreamReader(request.getInputStream(), "UTF-8")
BufferedReader br = new BufferedReader(isr)
StringBuilder sb = new StringBuilder()
while ((s=br.readLine())!=null) {
sb.append(s)
}
def requestBody = new groovy.json.JsonSlurper().parseText(sb.toString())
log.info "requestBody: " + requestBody
}
}
I use it on the project but I don't really remember how where I got the snippet from. I had to change some parts to make it work as far as I remember. Give it a try.

Get the first product id in a magento system via soap api (2)?

Question: Is there a way (api call) to get the first product id in a magento install via the soap api.
I'm attempting to download all the products from a magento system and insert them into a different database (I do the conversion myself so that's not a bother) What is hard to understand though is how do I get a list of the product id's without getting all of them, if all I know is that the site is up.
Here's the info I have.
soap end point
soap username
soap apikey (aka password)
Here's what I don't know.
the id of any of the products
the date any of the products were created on or last edited.
For my initial load, I have to do a where product id in, because I expect 20 to 40k product lists won't come back in one soap call.
So I call
where id in (1 -> 100) Nope
where id in (101-> 200) Nope..
Now as you can imagine that code smells something fierce. It works, but I have to think there is a better way..
To expand my question: Is there a better way?
I can post the XML that I'm sending if that helps. The language I'm using to create the soap(xml) is vim, so I don't have code I can paste.
Try This
$client = new SoapClient('http://localhost/magento8/index.php/api/soap/?wsdl');
$session = $client->login('soap username', 'soap apikey');
$filters=array('entity_id'=>array(array('lt'=>'1','gt'=>'100')));//get fist 100 result
$result = $client->call($session, 'catalog_product.list',array($filters));
var_dump($result);
for more attributes check this
http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/using_collections_in_magento

Smack's FileTransferManager.createOutgoingFileTransfer only accepts full JIDs. How can I determine the full JID of a user in Smack?

After hours of debugging and trying to find out why the file transfer was not working using aSmack, while normal messaging was, I finally managed to pin it down to this.
The Openfire server is sending the Rosters' JID missing the / at the end when I follow the method given in the Smack documentation to get a user's Roster list.
Collection<RosterEntry> entries = roster.getEntries();
for (RosterEntry r : entries) {
Log.v("Gabriel","Receiving: " + r.getUser());
}
For example if I receive a message from the user gabriel, I get the "From" as:
gabriel#dragonov/Smack
But the r.getUser() returns to the user as
gabriel#dragonov
Even
connection.getRoster().getPresence(contactName).getFrom()
is returning is as "gabriel#dragonov".
This is causing the File transfer to fail, but oddly not the regular messaging. However when I manually add the /Smack at the end of
OutgoingFileTransfer transferr = manager.createOutgoingFileTransfer(contactJID+"/Smack");
it works.
My question is, how can I receive the full JID with the resource part included or configure the file transfer so that it doesn't fail when using a bare JID?
Edit:
I have tried the following method:
Log.v("Gabriel", entries.size() + " buddy(ies):");
for (RosterEntry r : entries) {
Log.v("Pat","adding: " + r.getType() + " " + r.getName());
contacts.add(r.getUser());
}
for (String contact : contacts){
Iterator<org.jivesoftware.smack.packet.Presence> presences = connection.getRoster().getPresences(contact);
Log.v("Gabriel", contact+" has: ");
while(presences.hasNext()){
Log.v("Gabriel",presences.next().getFrom());
}
}
But I am still getting the bare ID.
The output:
gabriel#dragonov has:
gabriel#dragonov
Use Iterator<Presence> Roster.getPresences(String user) to get the presence information from all known resources of a user. For this Presence instances getFrom() should return a full JID which you can use in FileTransferManager.createOutgoingFileTransfer().
I have created SMACK-430, regarding the use of a full JID in createOutgoingFileTranfer(). It really should throw an exception so that smack users don't have to debug hours to find the reason (although it's stated in the method javadoc). SMACK-430 also explains why FileTransferManager needs a full JID and can not be used with a bare JID.

The definitive guide to posting a Facebook Feed item using pure C#

Does anyone have a definitive way to post to a user's wall, using nothing but the .NET Framework, or Silverlight?
Problems deriving from people's attempts have been asked here on SO, but I cannot find a full, clear explanation of the Graph API spec and a simple example using WebClient or some similar class from System.Net.
Do I have to send all feed item properties as parameters in the query string? Can I construct a JSON object to represent the feed item and send that (with the access token as the only parameter)?
I expect its no more than a 5 line code snippet, else, point me at the spec in the FB docs.
Thanks for your help,
Luke
This is taken from how we post to a user's wall. We place the data for the post in the request body (I think we found this to be more reliable than including all the parameters in the query part of the request), it has the same format as a URL encoded query string.
I agree that the documentation is rather poor at explaining how to interact with a lot of resources. Typically I look at the documentation for information on fields and connections, then work with the Graph API Explorer to understand how the request needs to be constructed. Once I've got that down it's pretty easy to implement in C# or whatever. The only SDK I use is Facebook's Javascript SDK. I've found the others (especially 3rd party) are more complicated, buggy, or broken than rolling my own.
private void PostStatus (string accessToken, string userId)
{
UriBuilder address = new UriBuilder ();
address.Scheme = "https";
address.Host = "graph.facebook.com";
address.Path = userId + "/feed";
address.Query = "access_token=" + accessToken;
StringBuilder data = new StringBuilder ();
data.Append ("caption=" + HttpUtility.UrlEncodeUnicode ("Set by app to describe the app."));
data.Append ("&link=" + HttpUtility.UrlEncodeUnicode ("http://example.com/some_resource_to_go_to_when_clicked"));
data.Append ("&description=" + HttpUtility.UrlEncodeUnicode ("Message set by user."));
data.Append ("&name=" + HttpUtility.UrlEncodeUnicode ("App. name"));
data.Append ("&picture=" + HttpUtility.UrlEncodeUnicode ("http://example.com/image.jpg"));
WebClient client = new WebClient ();
string response = client.UploadString (address.ToString (), data.ToString ());
}
I don't know much about .net or silverlight, but the facebook api works with simple http requests.
All the different sdks (with the exception of the javascript one) are mainly just wrappers for the http requests with the "feature" of adding the access token to all requests.
Not in all requests the parameters are sent as querystring, in some POST requests you need to send them in the request body (application/x-www-form-urlencoded), and you can not send the data as json.
If the C# sdk is not to your liking, you can simply create one for your exact needs.
As I wrote, you just need to wrap the requests, and you can of course have a method that will get a json as parameter and will break it to the different parameters to be sent along with the request.
I would point you to the facebook documentation but you haven't asked anything specific so there's nothing to point you to except for the landing page.

Sales Force Exposing Custom Objects via REST API

I am new to sales force and I have a problem. I would like to manipulate (created,update,delete and select) data from my custom objects using the REST API.
I have managed to get the sample working and it is sending me the data for accounts. Details
Now I would like to do the same for the Custom Object I have created.
I have tried this code but it is not working.
HttpClient httpclient = new HttpClient();
GetMethod get = new GetMethod(instanceUrl + "/services/data/v22.0/sobjects/Employee__c/EC-1000");
get.setRequestHeader("Authorization", "OAuth " + accessToken);
httpclient.executeMethod(get);
System.out.println("Status:" + get.getStatusCode());
System.out.println("Status Text:" + get.getStatusText());
Output is:
Status:404
Status Text:Not Found
I created an object with name employee and ID EC-1000.
The above works for the default objects that is Account.
It works exactly the same way, except you use your custom object's API name instead of the standard object name, e.g. If you have a custom object called Handsets, its api name will be Handsets__c, and you can do a POST to /services/data/v22.0/sobjects/Handsets__c to create a new one.
To access a particular record you need the 18 character record Id, just like for the account (or you need an externalId field setup).