how to unlock objects in IBM content navigator from a SOA webservice call - oracle12c

In my SOA, there are two apps trading document information back and forth. One of them is IBM's filenet/content navigator. Now the other app cannot call upon documents in filenet when these document are checked out in filenet. This usually is solvable by manually logging into Filenet and right clicking the document and selecting to undo the checkout.
Since the holdup really screws with my SOA integration I want to be able to perform this "undo checkout" action in filenet through a webservice call in my SOA. This would save a lot of time spent on manual actions unlocking the documents. I am using Oracle's SOA suite 11g (and 12c), and my process is heavily carried by BPELs. I already have a nice webservice interacting with Filenet. However, I will need to create a new operation "UnlockDocument" to interact and perform this action in filenet.
What I need: I need to have the code that would cover the "UnlockDocument" operation in a filenet environment, or some similar trick that would get the job done. Any information (also non-code!) on how I could proceed is very welcome, and I´ll keep updating my post if I find more info myself!
Thank you for your help!
Jesper

It turns out there is no possible "UnlockDocument" or "CancelCheckout" operation in filenet's webservice. However, I have found a neat workaround that let's you do just that.
When a document is checked out in filenet through the client or through a webservicecall of the operation:
"CheckoutAction".
A copy of the document is made internally in filenet with the same VersionSeriesId as the original document, but with the property Isreserved = 'true'. If you perform a "DeleteAction" on this copy, you essentially recreate the manual "Cancel Checkout" step available in the filenet client. "DeleteAction" requires an ObjectIdand doesn't work on the VersionSeriesId. In order to get this ObjectID through a webservice call, you need to make a SOAPCall that obtains this ObjectID. To cancel the initial checkout, a second SOAPCall should be made that deletes the document with the in the previous step obtained ObjectID, aka: "the copy". Herefollows two examples of usable SOAPCalls:
ExecuteSearchRequest SoapCall:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:sch="http://www.filenet.com/ns/fnce/2006/11/ws/schema">
<soap:Header>
<sch:Localization>
<sch:Locale>en_EN</sch:Locale>
<sch:Timezone/>
</sch:Localization>
</soap:Header>
<soap:Body>
<sch:ExecuteSearchRequest xsi:type="RepositorySearch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sch:SearchScope xsi:type="ObjectStoreScope" objectStore="ObjectStoreXXX"/>
<sch:SearchSQL>SELECT [Id] FROM Document WHERE VersionSeries = {"enter the VersionSeriesID of the initial document without quotes"} AND IsReserved = true</sch:SearchSQL>
</sch:ExecuteSearchRequest>
</soap:Body>
</soap:Envelope>
DeleteActionRequest SoapCall:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:sch="http://www.filenet.com/ns/fnce/2006/11/ws/schema">
<soap:Header>
<sch:Localization>
<sch:Locale>en-EN</sch:Locale>
<sch:Timezone/>
</sch:Localization>
</soap:Header>
<soap:Body>
<sch:ExecuteChangesRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sch:ChangeRequest>
<sch:TargetSpecification classId="Document" objectId="{"enter the objectId of the previously obtained document without quotes"}" objectStore="ObjectStoreO7"/>
<sch:Action xsi:type="sch:DeleteAction"/>
</sch:ChangeRequest>
</sch:ExecuteChangesRequest>
</soap:Body>
</soap:Envelope>
Now in order to get this to work from a SOA, you'll need to invoke filenet's webservice twice from your BPEL. First with the first operation: ExecuteSearchRequest, which yields you the ObjectId required to cancel the checkout, afterwards with the second operation ExecuteChangesRequest, which deletes the correct document, undoing the initial checkout. These operations are listed in the above SOAP examples. Additionally you need to add WS-security in your outgoing header with working credentials to access the Filenet service. Otherwise you won't be able to connect with filenet.
This has cost me a lot of time so I hope this helps someone besides me. Enjoy your mastery of filenet checkout deletion!

Related

Which is current / legacy: <soapenv:Envelope> or <soap:Envelope>

I have to tool to generate soap requests and it can do so in two ways. Either generating the request beginning with:
<soapenv:Envelope xmlns:ns="http://…" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
or with:
<soap:Envelope xmlns:ns="http://…" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
I suspect that one is the current technique and the other is the legacy technique. But since only one has something resembling a date in the url I can't figure out which is.
Which of the two it the current version to be used for new requests?
SOAP1.1 is Older.
It uses namespace as http://schemas.xmlsoap.org/soap/envelope/.
SOAP1.2 is latest.
It uses namespace as http://www.w3.org/2003/05/soap-envelope.
Refer links for more details.
Which one should be used for new services?
SOAP1.2 should be used for new services as its latest and greatest, more cleaner and robust. Though now a days trend is more for Restfull Services then SOAP.

PingFederate IdP startSSO.ping: How to pass data to be placed into SAML attributes?

I have a need to pass data from one system to another, during SSO using PingFederate.
Currently my link looks like this:
https://pingfederate.myexample.org/startSSO.ping?TargetResource=https%3A%2F%2Fwebapp.othercompany.org%3FkeepParam%3DkeepThisOnURLparamOne%3DvalueOne%26paramTwo%3DvalueTwo
TargetResource, decoded, looks like this:
https://webapp.othercompany.org?
keepParam=keepThisOnURL
&paramOne=valueOne
&paramTwo=valueTwo
After pingfederate processes the request, it ends up making a post to othercompany, copying the entire TargetResource into RelayState, params and all:
POST https://sso.othercompany.org
SAMLResponse: {paramOne: valueOne; paramTwo: valueTwo} //(in actual saml format)
RelayState: https://webapp.othercompany.org?keepParam=keepThisOnURL&paramOne=valueOne&paramTwo=valueTwo
My goal is to pass paramOne and paramTwo into SAML attributes somehow, but NOT carry those params over onto RelayState, keeping only keepParam=keepThisOnURL:
POST https://sso.othercompany.org
SAMLResponse: {paramOne: valueOne; paramTwo: valueTwo} //(in actual saml format)
RelayState: https://webapp.othercompany.org?keepParam=keepThisOnURL
Is this possible to do with PingFederate?
E.g., is there any other way to pass data into startSSO.ping from a browser request besides sneaking them into TargetResource?
Or if they can only be appended to TargetResource, can the value be modified (strip off most params) before copying into RelayState?
The reason that the parameters were tacked into the Relay State is because you URLEncoded them, So PingFed thought they were just part of the TargetResource.
Instead, you would do something like this:
https://pingfederate.myexample.org/idp/startSSO.ping?
paramOne=valueOne&
paramTwo=valueTwo&
TargetResource=https%3A%2F%2Fwebapp.othercompany.org%3FkeepParam%3DkeepThisOnURL
I should point out two things, the first being a showstopper:
fulfilling attributes via parameters passed in the startSSO.ping calls is not supported and won't work properly until at least one of two current feature requests are fulfilled, PPQ-1141 and PPQ-2815. Neither of these are currently scheduled (low request volume) in the development trains, so if this is critical to your work, get in touch with your Ping account executive to have your needs communicated.
I should point out that this overall methodology probably doesn't make a whole lot of sense from an operational standpoint, simply because it means that you will be dependent on an IdP initiated transaction because you have no way of fulfilling this with an SP-initiated transaction.
Based on those, I would recommend trying to architect another solution by which you could set those attributes, which I recognize may be difficult - especially if they are only derived at runtime, rather than via query to a datastore.

Customer Address Field is Mandatory?

A client of our IA app just reported a slew of IDS synch error messages like:
Error updating customer in Intuit Data Services. Error message was: empty addresses not allowed party_id = 679598
I looked at your new online docs and see that the Object Reference indicates that the customer address is "mandatory". Is this something new? If so, since when? Customers have been synching successfully with empty addresses up to now, this change took us completely unaware (if indeed it is a change). Is there some way you can apprise us of upcoming changes so we can act proactively? Also, what exactly qualifies as an "empty" address? What fields exactly, at a minimum, need to be non-empty? For example, if "State" is filled in is that enough?
BTW, what is party_id and how can I use it to identify the customer object?
Thanks in advance.
It's not a required field to add/update a customer but if you are including the XML address fields tag in your request, then you must enter a value for it. If you don't want to update the address then leave it out.
thanks,
Jarred
Example:
<?xml version="1.0" encoding="UTF-16"?>
<Mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" RequestId="7699faaff20f4e16987e26bddbbf9461" xmlns="http://www.intuit.com/sb/cdm/v2">
<ExternalRealmId>156234822</ExternalRealmId>
<Object xsi:type="Customer">
<Id>43497400</Id>
<SyncToken>1</SyncToken>
<MetaData>
<CreatedBy>app</CreatedBy>
<CreatedById>1</CreatedById>
<CreateTime>2010-06-18T03:48:36</CreateTime>
<LastModifiedBy>app</LastModifiedBy>
<LastModifiedById>1</LastModifiedById>
<LastUpdatedTime>2010-06-18T03:48:36</LastUpdatedTime>
<MetaData>
<Synchronized>false</Synchronized>
<PartyReferenceId>51077676</PartyReferenceId>
<TypeOf>Person</TypeOf>
<Name>Jane Doe</Name>
<ShowAs>Jane</ShowAs>
</Object>
</Mod>

WSDL empty <types> tag and YAWS SOAP support

I am trying to invoke a WebService through SOAP using Erlang and YAWS (yaws_soap_lib module specifically). The examples published on http://yaws.hyber.org/soap_intro.yaws work for me.
However, when trying to invoke my own web service YAWS fails. The first problem were partner links in the WSDL that were put there because of BPEL is befind this service. I deleted them (for now).
Unfortunately, I've come across another problem: mentioned WSDL has an empty <types> tag. Now, I am not very familiar with WSDL specification and SOAP so my question is whether it is
Erlang SOAP library issue that cannot handle empty <types> tag or
badly generated WSDL?
Does anyone know any better Erlang library for handling SOAP? I have taken a look at erlsoap but it does not support WSDLs.
EDIT: error caused by mentioned WSDL:
::error:function_clause
in function erlsom_add:add_model/2
called as add_model({model,[{type,'_document',sequence,
[{el,[{alt,'soap:Envelope','soap:Envelope',...},
{alt,'soap:Header',...},
{alt,...},
{...}],
1,1,1}],
[],undefined,undefined,1,1,1,false,...},
{type,'soap:detail',sequence,
[{el,[{alt,'#any',...},{alt,...},{...}|...],0,unbound,1}],
[],
{anyAttr,"lax","##any",[...]},
undefined,2,1,1,...},
{type,'soap:Fault',sequence,
[{el,[{alt,...}],1,1,...},
{el,[{...}],1,...},
{el,[...],...},
{el,...}],
[],undefined,undefined,5,1,...},
{type,'soap:Body',sequence,
[{el,[{...}|...],0,...}],
[],
{anyAttr,[...],...},
undefined,2,...},
{type,'soap:Header',sequence,
[{el,[...],...}],
[],
{anyAttr,...},
undefined,...},
{type,'soap:Envelope',sequence,[{el,...},{...}|...],[],{...},...}],
[{ns,"http://schemas.xmlsoap.org/soap/envelope/","soap"},
{ns,"http://www.w3.org/2001/XMLSchema","xsd"}],
"http://schemas.xmlsoap.org/soap/envelope/",[]},undefined)
in call from yaws_soap_lib:initModel2/5
For those who are familiar with the source code: The problem is the Xsds array returned by getXsdsFromWsdl function is empty.
My XML schema fu is a bit rusty, but as far as I can see the schema permits empty <types/> elements. That would suggest the first alternative, though it's hard to be sure. What error message do you get?
I would guess given the function clause error that erlsom is not handling some particular function input as being undefined. But I assume you've already validated your WSDL to make sure it's OK? Also, any chance of posting the WSDL somewhere so we can see it?
The issue has been resolved in latest YAWS version. In order to construct mentioned WSDL model following command has to be invoked:
yaws_soap_lib:initModel(WSDL_FILE_URL, [{include_fun, {erlsom_lib, find_xsd}}])

Updating a value RESTfully with Post

I'm rather new to REST so forgive me if this is a stupid question.
So, I have a customer resource. A customer has many credits. So, I imagine a URL for getting customer credits would be
customer/21/credits
(where 21 is a customer ID)
Now, how do I add to the credits, if I don't have the full amount of credits? E.g. a customer has 10 credits and I want to add 5. As I understand, if I'm using post I would do something like:
customer/21/credits?amount=15 (is this even correct?)
However, what if I just want to add to the existing credits? That is I want to send 5 credits and say add them to whatever the customer currently has? Do I define a kind of phantom resource such as addedCredits?
customer/21/addedCredits?amount=5
then behind the scenes, I just do credits += 5?
You need to define how you're going to treat "credits" in your system; it matters whether or not you intend to define them as resources or as an attribute of your customer resource.
In the examples below, I'm going to use XML to represent the resources/entities. This may work for you, but you'll need to have some consistent way of representing your resources in requests and responses - this will help you avoid using query parameters (e.g. http://example.com?foo=bar) to define data that belongs in the request body.
A couple of ways of representing credits:
If a "credit" is an attribute of your "customer":
<customer id="21">
<balance>10</balance><!-- aka credit -->
</customer>
Then you might as well just GET the customer, update the credit/balance with your client, and then PUT the <customer> back to /customer/21.
If a "credit" is its own resource:
You can POST the following to /credit:
<credit>
<dateApplied>2009-10-15 15:00:00</dateApplied>
<customer href="/customer/21"/>
<amount>5</amount>
</credit>
Or you can POST the following to /customer/21/credits (assuming that URI is a list of all of the <credit>s applied to the customer):
<credit>
<dateApplied>2009-10-15 15:00:00</dateApplied>
<amount>5</amount>
</credit>
This would "append" a new <credit> to the existing list. And also eliminates the need to provide the <customer> in the entity, since it's already present in the URI.
I would use the same URL.
POST to customer/21/credits with a POST variable called extraCredit set to 5. POST is supposed to be used for annotation of existing resources (or creating subordinate resources). There is no reason why you should need a new URL.
If an individual credit is a resource in your system that deserves its own URL, then the response URL from POSTing to customer/21/credits should include the URL of the new credit resource e.g. customer/21/credit/12.
You could define an XML representation of credits to POST to customer/21/credits, but I would not consider it worthwhile in this simple example. REST payloads do not have to be XML.
A URL like customer/21/addedCredits?amount=5 doesn't make sense to me because it doesn't really identify a resource. If someone issues a GET to customer/21/addedCredits?amount=5 what would you return to them?
The one thing you should definitely not do is change the state of the customer resource when someone GETs a URL like customer/21/addedCredits?amount=5. Since the title of your question acknowledges that you will need to use POST your probably realise this. GET is supposed to be safe, which means that issuing a GET shouldn't change a resource's state.
Ultimately the implementation is up to you. WHile URI query parameters are generally frowned upon, it doesn't mean you can't use them. Personally I would make the post URI something like:
customer/21/credits/add/5
but nothing says you can't do something like what you have or :
customer/21/credits/add?value=5
For starters using the URI query parameters should be a "bad smell" to you. Second you need to look at defining some mime types that your clients and server can talk in so for instance with your credit example:
If I do a GET on customer/21/credits I might get a document like this:
Content-type : application/vnd.creditstore+xml
<credits>
<user>21</user>
<credits>10</credits>
Add credits to this account
</credits>
This tells a client who understands your vocab that if they want to add credits to this user they need to post something to that link. This is HATEOAS (god I hate that acronym, I probably even spelled it wrong).
Now this is all completely off the top of my head, and I probably butchered that XML example but it should get you thinking in the right direction.