Coldfusion - error when making SOAP request to Neolane - soap

I am trying to make webservice SOAP requests to Neolane using Coldfusion and CFHTTP.
I have copied the SOAP request directly from Neolane's documentation, so I think that is okay.
The error message returned is :
SOAP-ENV:ClientLe message XML SOAP est incorrect (service '', méthode 'POST').Le nom de méthode 'ExecuteQuery' du paquet SOAP ne correspond pas à celui du paramètre 'action' de l'en-tête 'Content-Type' ('')
which translates to :
SOAP-ENV: clientle SOAP XML message is incorrect (service'' method 'POST'). The method name 'ExecuteQuery' SOAP package does not match the parameter 'action' in the header 'Content-type '('')
Is the action parameter in the Content-type header set by Coldfusion in the CFHTTP?
Is there something that should be added with cfhttpparam?
Any guidance would be appreciated.
Thanks,
Gary
Update: Found solution. Needed to add SOAPAction using cfhttpparam and use an alternative authentication method that was different from the example in the documentation.

Found solution. Needed to add SOAPAction using cfhttpparam and use an alternative authentication method that was different from the example in the documentation.

Related

URL Encoding with ISO8859-15 is converted to Unknown format

I have Rest API which sends SMS.
Content of the SMS is in French “Afin d'établir le tiers-payant pour votre traitement d'immunothérapie allergénique”
As SMS provider except the msg in IS08859-15 ,So I converted the msg into
Afin%20d%27%E9tablir%20le%20tiers-payant%20pour%20votre%20traitement%20d%27immunoth%E9rapie%20allerg%E9nique%2C
Here the final call which sends msg
https://xxxx.xxxx.com/xxxxxx/xx/SendMTRequest.jsp?UserName=xxxxxx&Password=xxxxxxx$&Content= %20d%27%E9tablir%20le%20tiers-payant%20pour%20votre%20traitement%20d%27immunoth%E9rapie%20allerg%E9nique%2C%&DA=Mobileno&Flags=0&SenderAppId=3410
with header
Content-Type ISO8859-15
What is received on the Server side is
20Afin%20d%27%ef%bf%bdtablir%20le%20tiers-payant%20pour%20votre%20traitement%20d%27immunoth%ef%bf%bdrapie%20allerg%ef%bf%bdnique%2c%
Can someone tell me why %E9 which is ISO88591-15 format for é is changed to %ef%bf%bd ?
and also a way to solve this.
Thank you

SOAP message without header - how to process?

I've tried web search to find answer to my question but found only articles like how to create SOAP message without header.
In wikipedia on SOAP:
SOAP header : A collection of one or more header blocks targeted at
each SOAP receiver. SOAP body : Contains the body of the message
intended for the SOAP receiver. The interpretation and processing of
SOAP body is defined by header blocks.
And:
A SOAP message is an ordinary XML document containing the following
elements:
Element - Required
Header - No
Body - Yes
...
How can be a message without header if processing of body is defined in header?
The SOAP header is optional. If a header is required, it is mainly mentioned in the WSDL file, that is bound to the webservice. The WSDL defines the functions of a webservice and the types, that are bound to the functions. It depends on how a function is defined. Some definitions need an action attribute in the soap header. Others are used by directly mentioning them in the SOAP Body. To keep it short: how a SOAP message should look like is more or less strictly defined in the webservice definition (wsdl).

Trouble with addAttachment method using JSON-RPC in Confluence

I haven't used REST services in combination with JSON-RPC that much, so I could use some help here.
I am trying to add an attachment to a page in Confluence using a JSON-RPC call. I am testing my calls using soapUI 5.0.0.
The URI of my REST call is:
https://{sitename}/rpc/json-rpc/confluenceservice-v2/addAttachment
I have constructed the following JSON code, which should create a very simple text file:
[ 2339970
, { "fileName" : "Testfile.txt"
, "contentType" : "text/plain"
, "comment" : "to be ignored"
}
, "VGhpcyBpcyBhIHRlc3QuClRvIENvbmZsdWVuY2Ugb3Igbm90IHRvIENvbmZsdWVuY2U/Cg=="
]
The third parameter is a base64 encoded string.
Unfortunately I get an error message from the server:
<error>
<code>-32602</code>
<data null="true"/>
<message>Request parameter types did not match method parameter types (method addAttachment taking 3 parameters)</message>
</error>
Any idea what I'm doing wrong here?

WSO2 API Manager - Publishing API with non-XML response

I am trying to proxy the following call through WSO2 API Manager
http://api.qrserver.com/v1/create-qr-code/?data=HelloWorld&size=100x100
which returns a QR code image. I published the API using http://api.qrserver.com/v1/ as endpoint, no problem there. But when I perform the call through the API Manager, I get the following error:
curl -H 'Authorization:Bearer 7q6W4LteX9idveFWbSa_oaGPhVsa' 'http://ec2-xx-xx-xx-xx.eu-west-1.compute.amazonaws.com:8280/qrcode/1.0.0/create-qr-code/?data=HelloWorld&size=100x100'
<Exception>Unexpected response received. HTTP response code : 200 HTTP status : OK exception : com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 start byte 0x89 (at char #1, byte #-1)</Exception>
when performing the call directly the response header seems good to me (the mime type image/png is correctly set), but the WSO2 API proxy refuses the response... what I am doing wrong? Setting a wadl file with response mediaType="image/png" does not seem to help either.
Thanks in advance
I have a similar problem in wso2 esb. Seems that the response works with short xml files but not with a big one.
This problem is due to not having match message builders and formatters by default in API manager's axis2.xml. Please add following parameters to axis2.xml.
<messageBuilder contentType=".*" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageFormatter contentType=".*" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
Thanks.
Sanjeewa.

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);