Savon SOAP client finds 0 operations on this WSDL - soap

I'm using Savon v 2.3.3 as my Rails application's SOAP client, and it appears to find zero operations on one of the wsdls which I query. (I've had no problems on for other wsdls which my application queries.) When I view the wsdl manually, it appears well formatted, and I find the operations that I seek:
http://dev.service.xrae.com/direct.svc?wsdl
Can you tell me what I need to change or what's unusual about this wsdl?

This wsdl doesn't have 'binding' section. Articles that can help:
http://predic8.com/wsdl-reading.htm
http://www.w3schools.com/webservices/ws_wsdl_binding.asp
Adding
<wsdl:binding name="WSHttpBinding_XraeDirectApi" type="tns:XraeDirectApi">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="AddCase"/>
</wsdl:binding>
can fix it.

Related

Is it possible to pass schemalocation as relative path in wsdl?

I'm using WsdlPull library to parse the WSDL file.
Is it possible to provide relative path in the schemaLocation whiling importing external XSD inside WSDL?
e.g.
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://myprovider/namespace1/namespace1" schemaLocation="schema1.xsd"/>
</schema>
</types>
Schemas should be resolved relative to the containing document (in this case the WSDL's Url), so this should work. In fact we have WSDL files that do exactly what you appear to be trying to do.
However the implementation is given quite a lot of freedom during the resolution process (for example allowing it to transform the url causing it to load from a cache rather than the actual url).
As your positing this I assume this is not working?

WSDL binding - soapAction value

In the following excerpt of a WSDL, at the line
<soap1:operation style="document" soapAction="petition"
what is the difference between specifying
soapAction="petition"
vs
soapAction="/Services/ReincarnationPermitService.serviceagent/ReincarnationRequestPortTypeEndpoint/petition"
<wsdl:service name="ReincarnationPermitService">
<wsdl:port name="ReincarnationRequestPortTypeEndpoint" binding="tns:ReincarnationRequestPortTypeEndpointBinding">
<soap1:address location="http://sheol:666/Services/ReincarnationPermitService.serviceagent/ReincarnationRequestPortTypeEndpoint"/>
</wsdl:port>
</wsdl:service>
<wsdl:portType name="ReincarnationRequestPortType">
<wsdl:operation name="acceptRequest">
<wsdl:input message="tns:ReincarnationParticulars"/>
<wsdl:output message="tns:PetitionResponse"/>
<wsdl:fault name="denied" message="tns:Rejection"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ReincarnationRequestPortTypeEndpointBinding" type="tns:ReincarnationRequestPortType">
<soap1:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="acceptRequest">
<soap1:operation style="document" soapAction="petition" soapActionRequired="true"/>
<wsdl:input>
<soap1:body use="literal" parts="ReincarnationParticulars"/>
</wsdl:input>
<wsdl:output>
<soap1:body use="literal" parts="Approved"/>
</wsdl:output>
<wsdl:fault name="denied">
<soap1:fault use="literal" name="denied"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
This is what I have discovered ... so answering my own question.
The soapAction attribute is an indication of intent of the service provider, which is most probably framed by the service framework.
The soapAction helps the service provider to map the soap operation to an intent resolver. Which for any intent and purpose, would be the routine being called to service the operation.
The soapAction attribute is a way for a service provider framework to uniquely identify which entry point or routine to call to service the operation.
Therefore soapAction attribute can be any value, whose pattern may be dictated by the framework. In the framework that I am using, it does not matter to the framework what the value of soapAction is, where soapAction attribute value is simply the reference to the entry point to process the call.
The soapAction="petition" attribute of the soap1:operation element, will be included in the HTTP request message, as in:
POST /StockQuote HTTP/1.1
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
SOAPAction: "petition"
The SOAPAction HTTP request header field can be used to indicate the intent of the SOAP HTTP request. The value is a URI identifying the intent. SOAP places no restrictions on the format or specificity of the URI or that it is resolvable. An HTTP client MUST use this header field when issuing a SOAP HTTP Request.
The presence and content of the SOAPAction header field can be used by servers such as firewalls to appropriately filter SOAP request messages in HTTP. The header field value of empty string ("") means that the intent of the SOAP message is provided by the HTTP Request-URI. No value means that there is no indication of the intent of the message.
Examples:
SOAPAction: "/Services/ReincarnationRequestPortTypeEndpoint/petition"
SOAPAction: "petition"
SOAPAction: ""
SOAPAction:
We were faced with similar situation when consumer was using soapAction property for a particular purpose and when we updated the WSDL(mainly the soapAction field), it broke the consumer code.
Basically since soap 1.1, there is no use of soapAction except its just used for documentation and it can be empty.
As mentioned in another answer, it can describe the intent of the operation but again for documentation purpose.
The way we have used it is like below;
<soap:operation soapAction="http://company.com.au/hub/services/NotificationApplication/GenerateDocumentNotification?applicationVersion=NotificationApplication_v1.8.9"/>
P.S. soapAction is completely removed in soap 1.2, so better don't depend on this one a lot!

Differ REST from XML-RPC by WSDL

Here is the WSDL - http://www.webservicex.com/globalweather.asmx?WSDL
I see bindings for Soap 1.1 & 1.2, and 2 others, to retrieve data via HTTP get & post.
I want to know if the last 2 stand for REST or XML-RPC.
Thanks in advance.
You probably mean these lines:
<wsdl:port name="GlobalWeatherHttpGet" binding="tns:GlobalWeatherHttpGet">
<http:address location="http://www.webservicex.com/globalweather.asmx"/>
</wsdl:port>
<wsdl:port name="GlobalWeatherHttpPost" binding="tns:GlobalWeatherHttpPost">
<http:address location="http://www.webservicex.com/globalweather.asmx"/>
</wsdl:port>
These are part of the WSDL document. From Wikipedia:
Defines the address or connection point to a Web service. It is typically represented by a simple HTTP URL string.
They have nothing to do with REST or XML-RPC which are not defined by a WSDL document.

At least one WSDL with at least one service definition needs to be provided

I have defined my service on the WSDL file this way:
<wsdl:service name="guestbook">
<wsdl:port binding="tns:guestbookSOAP" name="guestbookSOAP">
<soap:address location="http://localhost:8080/soapguestbook"/>
</wsdl:port>
Still I am getting the following error message when running wsimport on it:
At least one WSDL with at least one service definition needs to be provided.
Is there anything else I need to add?
The problem in your case is that the definitions element is missing, which is like a root.
WSDL has a specific structure, for which the root element should be the DEFINITIONs, under it various other elements are present like types, messages, portType, binding, services etc.
The structure is like the below:
<definitions>
<types> data type definitions........ </types>
<message> definition of the data being communicated.... </message>
<portType> set of operations...... </portType>
<binding> protocol and data format specification.... </binding>
</definitions>
For the meaning of each WSDL element look into the link:
https://www.w3schools.com/xml/xml_wsdl.asp

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