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

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.

Related

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

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!

Cisco AXL 8.5 WSDL Java Import TranslationPattern

This question is very specific. If CUCM, AXL and SOAP doesn't tell you anything, there's no need to read further. Except you're interested.
Has anyone been successful at wsimporting the current WSDL file for Cisco AXL and supporting the AddTransPattern-Request? I'm talking about version 8.5 or "current" (as in Cisco UCM 8.6.2).
The import was successful, but adding a translation pattern doesn't work anymore.
I tested it by writing my SOAP request by hand, using soapUI in eclipse.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/8.5">
<soapenv:Header/>
<soapenv:Body>
<ns:addTransPattern sequence="?">
<transPattern>
<pattern>MYPATTERN</pattern>
<description>MYDESCRIPTION</description>
<routePartitionName>MYPARTITION</routePartitionName>
<calledPartyTransformationMask>MYDESTINATION</calledPartyTransformationMask>
<provideOutsideDialtone>false</provideOutsideDialtone>
<callingSearchSpaceName>MYCALLINGSEARCHSPACE</callingSearchSpaceName>
</transPattern>
</ns:addTransPattern>
</soapenv:Body>
The response is as follows:
<axlcode>-391</axlcode>
<axlmessage>Cannot insert a null into column (numplan.tkpatternusage).</axlmessage>
<request>addTransPattern</request>
soapUI tells me that putting usage is optional. Even if I put a value for usage, e.g. <usage>3</usage>, it tells me the value wouldn't exist even though I know it does.
Any idea is appreciated
Finally, I figured out what was wrong.
The value for <usage> needs to be a string, like in this case Translation. Then it works without any problem.

WSO2 ESB adding namespace to SOAP Envelope

I need to add a new Namespace to the SOAP Envelope.
At the moment it's looking like that:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
But what I need is this:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style">
Maybe you can give me the code for the header mediator.
WSO2 ESB Documantation isn't working at the moment. I get a Synthax error there....
Use the XSLT mediator with the source attribute having the period value for its xpath. This will make the full SOAP message be processed by the XSLT template instead of the payload only.
<xslt key="yourXsltTemplate" source=".">
Using header mediator you can add soap headers not the namespace at envelope element AFAIK.
Anyway documentation should work.Please check. To add a namespace in the middle of sequence, you could use xslt mediator

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}}])

SOAP Action WSDL

I'm trying to implement a client for National Rail Enquiries' SOAP Service (http://www.livedepartureboards.co.uk/ldbws/).
I stick the WSDL (http://realtime.nationalrail.co.uk/ldbws/wsdl.aspx) into http://soapclient.com/soaptest.html, but I get back the error message "Unable to handle request without a valid action parameter. Please supply a valid soap action."; what on earth should the action be?
Thanks,
Stewart
edit:
I just used soapclient.com as a quick example. In my software, I send the following XML; I still get that I'm missing an action.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://thalesgroup.com/RTTI/2008-02-20/ldb/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:ldbt2="http://thalesgroup.com/RTTI/2008-02-20/ldb/types" xmlns:ldbt="http://thalesgroup.com/RTTI/2007-10-10/ldb/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ct="http://thalesgroup.com/RTTI/2007-10-10/ldb/commontypes" >
<SOAP-ENV:Body>
<ldbt2:GetDepartureBoardRequest xmlns:ldbt2="http://thalesgroup.com/RTTI/2008-02-20/ldb/" >
<ldbt2:numRows>5</ldbt2:numRows>
<ldbt2:crs>WAT</ldbt2:crs>
<ldbt2:filterCrs>GLD</ldbt2:filterCrs>
<ldbt2:filterType>to</ldbt2:filterType>
<ldbt2:timeOffset>0</ldbt2:timeOffset>
</ldbt2:GetDepartureBoardRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
If its a SOAP 1.1 service then you will also need to include a SOAPAction HTTP header field:
http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383528
I have come across exactly the same problem when trying to write a client for the National Rail SOAP service with Perl.
The problem was caused because the Perl module that I'm using 'SOAP::Lite' inserts a '#' in the SOAPAction header ...
SOAPAction: "http://thalesgroup.com/RTTI/2008-02-20/ldb/#GetDepartureBoard"
This is not interpreted correctly by .NET servers. I found this out from Example 3-19 in O'Reilly's Programming Web Services with SOAP . The solution was given below in section 3-20, namely you need to explicitly specify the format of the header with the 'on_action' method.
print SOAP::Lite
-> uri('urn:Example1')
-> on_action(sub{sprintf '%s/%s', #_ })
-> proxy('http://localhost:8080/helloworld/example1.asmx')
-> sayHello($name)
-> result . "\n\n";
My guess is that soapclient.com is using SOAP::Lite behind the scenes and so are hitting the same problem when talking to National Rail.
The solution is to write your own client so that you have control over the format of the SOAPAction header ... but you've probably done that already.
SOAPAction is required in SOAP 1.1 but can be empty ("").
See https://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383528
"The header field value of empty string ("") means that the intent of the SOAP message is provided by the HTTP Request-URI."
Try setting SOAPAction=""
When soapAction is missing in the SOAP 1.2 request (and many clients do not set it, even when it is specified in WSDL), some app servers (eg. jboss) infer the "actual" soapAction from {xsd:import namespace}+{wsdl:operation name}.
So, to make the inferred "actual" soapAction match the expected soapAction, you can set the expected soapAction to {xsd:import namespace}+{wsdl:operation name} in your WS definition (#WebMethod(action=...) for Java EE)
Eg. for a typical Java EE case, this helps (not the Stewart's case, National Rail WS has 'soapAction' set):
#WebMethod(action = "http://packagename.of.your.webservice.class.com/methodName")
If you cannot change the server, you will have to force client to fill soapAction.
I've just spent a while trying to get this to work an have a written a Ruby gem that accesses the API. You can read more on it's project page.
This is working code in Ruby:
require 'savon'
client = Savon::Client.new do
wsdl.document = "http://realtime.nationalrail.co.uk/LDBWS/wsdl.aspx"
end
response = client.request 'http://thalesgroup.com/RTTI/2012-01-13/ldb/GetDepartureBoard' do
namespaces = {
"xmlns:soap" => "http://schemas.xmlsoap.org/soap/envelope/",
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
"xmlns:xsd" => "http://www.w3.org/2001/XMLSchema"
}
soap.xml do |xml|
xml.soap(:Envelope, namespaces) do |xml|
xml.soap(:Header) do |xml|
xml.AccessToken do |xml|
xml.TokenValue('ENTER YOUR TOKEN HERE')
end
end
xml.soap(:Body) do |xml|
xml.GetDepartureBoardRequest(xmlns: "http://thalesgroup.com/RTTI/2012-01-13/ldb/types") do |xml|
xml.numRows(10)
xml.crs("BHM")
xml.filterCrs("BHM")
xml.filterType("to")
end
end
end
end
end
p response.body
Hope that's helpful for someone!
We put together Web Services on Windows Server and were trying to connect with PHP on Apache. We got the same error. The issue ended up being different versions of the Soap client on the different servers. Matching the SOAP versions in the options on both servers solved the issue in our case.
the service have 4 operations:
1. GetServiceDetails
2. GetArrivalBoard
3. GetDepartureBoard
4. GetArrivalDepartureBoard
I have solved this problem, in Java Code, adding:
MimeHeaders headers = message.getMimeHeaders();
headers.addHeader("SOAPAction", endpointURL);