I am getting the following error when using CXF to consume a web service. The exception message is:
No binding factory for namespace http://schemas.xmlsoap.org/wsdl/http/ registered.
The WSDL service which I am trying to consume is:
<wsdl:service name="MyService">
<wsdl:port name="MyServiceHttpport" binding="impl:MyServiceHttpBinding">
<http:address location="http://localhost:80/ip/services/MyService"/>
</wsdl:port>
</wsdl:service
As seen above, there us http:address instead of soap:address
CXF doesn't support the WSDL http binding. The cxf-rt-bindings-http module has been removed from the recent CXF releases as it was relatively proprietary and is now replaced with all the REST goodness of the JAX-RS frontend.
Related
I'm trying to write a client for Outlook.com mail. I've successfully connected and authenticated, and downloaded the WSDL. However, the WSDL has no service element, which the specification requires.
I dutifully checked all the imports per the question "wsdl has no service element" even though they're called messages.xsd and types.xsd, and found no service elements.
This page on Google Code describes the issue.
The service element is missing, presumably so they can distribute a single Services.wsdl that will work on all servers without having to customize it. I'm not sure of the reasoning.
The net effect is that you have to add the element yourself to the end of the file:
...
<wsdl:service name="ExchangeServices">
<wsdl:port name="ExchangeServicePort" binding="tns:ExchangeServiceBinding">
<soap:address location="https://my.exchange.com/EWS/Exchange.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I have to generate a client for a Liferay web service. But this client only accepts Document/Literal web services.
When I generate a WS with Liferay, it is created as RPC/Encoded, as you can see in the next code:
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
Is it possible to generate the WS with Document/Literal format?
Thanks.
I am having problems accessing a web service using Apache CXF generated classes (wsdl2java).
Everything was working fine until the web service provider suddenly changed a rule on their firewall and hosed us. What they are saying is they no longer allow http traffic, we have to start using https. The funny thing is, up until now we thought we were using https. This is inherited, legacy code. But we are pretty much using word for word the ssl example on the Apache CXF web site.
Here's a chunk of the wsdl:
...
<wsdl:portType name="GetMessagesSoap">
<wsdl:operation name="GetInfo">
<wsdl:input message="tns:GetInfoSoapIn" />
<wsdl:output message="tns:GetInfoSoapOut" />
</wsdl:operation>
</wsdl:portType>
...
<wsdl:service name="GetMessages">
<wsdl:port name="GetMessagesSoap" binding="tns:GetMessagesSoap">
<soap:address location="http://127.0.0.1/GetMessages.asmx" />
</wsdl:port>
</wsdl:service>
Basically we generate all the Java classes using wsdl2java. Then in our Gateway class we do the following:
private GetMessagesSoap getInstance() {
GetMessages getMessages = new GetMessages(wsdlUrl);
GetMessagesSoap getMessagesSoap = getMessages.getMessagesSoap();
setupTransportLayerSecurity(getMessagesSoap);
}
private void setupTransportLayerSecurity(final Object port) {
HTTPConduit httpConduit =
(HTTPConduit) ClientProxy.getClient(port).getConduit();
TLSClientParameters tlsCP = new TLSClientParameters();
KeyStore keyStore = ...
KeyManager[] myKeyManagers = getKeyManagers(keyStore ...
tlsCP.setKeyManagers(myKeyManagers);
KeyStore trustStore = ...
TrustManager[] myTrustStoreKeyManagers = getTrustManagers(trustStore);
tlsCP.setTrustManagers(myTrustStoreKeyManagers);
tlsCP.setDisableCNCheck(true);
tlsCP.setSecureSocketProtocol("SSL");
httpConduit.setTlsClientParameters(tlsCP);
}
Then we call getInfo(). This is where the error occurs.
public void getInfo() {
GetMessagesSoap getMessagesSoap = getInstance();
InfoResponse response = getMessagesSoap.getInfo()
}
The error we get is rather generic:
javax.xml.ws.WebServiceException: Could not send Message.
The ws provider says it's failing because we're trying to come in using http. All this despite all the fancy SSL stuff we're doing in the setupTransportLayerSecurity() method.
My fundamental doubt in all this is, is that really the reason it's failing? I mean, obviously it started failing when the rule was removed from the firewall. But, what I don't understand is, if the url in the GetMessages service in the wsdl is http, even if I say to use SSL, how in the world is it ever going to use https?
We've put a sniffer on the network and sure enough it's only using http. But ... isn't this normal?? I am by no means a SOAP expert, obviously. Can someone shed some light on this problem?
CXF HttpConduit only uses the TlsClientParameters when the address url is start with https.
Can you change the WSDL file?
If not, you can change service url at the runtime.
This problem is present in mule 1.3.2-201212121943
WSDL soap:address location is not correctly rewritten by web-service-proxy with .NET WS
<mule ...>
<https:connector name="HTTP_HTTPS" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" clientSoTimeout="10000" serverSoTimeout="10000" doc:name="HTTP\HTTPS">
<https:tls-client path="xyz\keystore.jks" storePassword="mulepassword"/>
</https:connector>
<pattern:web-service-proxy name="xyz-ws-proxy" >
<http:inbound-endpoint address="http://localhost:8081"/>
<https:outbound-endpoint followRedirects="true" address="https://xyz/g2g/BPM#[header:inbound:http.request.path]" connector-ref="HTTP_HTTPS" />
</pattern:web-service-proxy>
</mule>
http://localhost:8081/xyz.asmx?wsdl returns wsdl with
<wsdl:port name="XYZEndpointSoap" binding="tns:XYZEndpointSoap">
<soap:address location="http://xyz/g2g/BPM/xyz.asmx" />
</wsdl:port>
<wsdl:port name="XYZEndpointSoap12" binding="tns:XYZEndpointSoap12">
<soap12:address location="http://xyzg2g/BPM/xyz.asmx" />
</wsdl:port>
With another jax-ws service, this configuration works - there was only one soap:address hmm.
This is .NET WS.
Thank you
PS: I have read google results and closed mule issues but nothing works for this service.
I have checked and pattern:web-service-proxy has no problem rewrite all the addresses of a WSDL that contains both a soap:address and a soap12:address.
The issue could actually be due to the way you get the WSDL: with the HTTP inbound endpoint bound to http://localhost:8081 with no path (something I would advocate against: it's better to have a path), the WSDL is available at http://localhost:8081/?wsdl, not http://localhost:8081/xyz.asmx?wsdl.
I'm trying to create the stub of the wsdl http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl using AXIS2/C (c++), using the following command:
./WSDL2CPP.sh -uri http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl
and I get the following answer:
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:153)
at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
at org.apache.axis2.wsdl.WSDL2CPP.main(WSDL2CPP.java:19)
Caused by: org.apache.axis2.AxisFault: **`No service was not found in the WSDL at http://www.onvif.org/onvif/ver10/device/wsdl/devicemgmt.wsdl with targetnamespace http://www.onvif.org/ver10/device/wsdl`**
at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateAllServices(WSDL11ToAllAxisServicesBuilder.java:115)
at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:147)
... 2 more
I used the hack used on python-zeep, but it helps with axis2/c as well:
Add this to devicemgmt.wsdl, just before the close tag "</wsdl:definitions>":
<wsdl:service name="DeviceService">
<wsdl:port name="DevicePort" binding="tds:DeviceBinding">
<soap:address location="http://192.168.1.100/onvif/device_service"/>
</wsdl:port>
</wsdl:service>
However, I'm still having problems generating the code with any of the variable bindings ("XSD complexType with mix content not supported in ADB"). I had to disable it as follows:
./WSDL2C.sh -o ../axis2c-test/gen -d none -uri devicemgmt.wsdl
This error normally coming because of the tool cannot find a service element in the WSDL. Because in WSDL definition it has to have a endpoint defined. Please check your WSDL whether it has a service element included or any other imported WSDL has the service element.
So basically to get rid of this you have to define a endpoint in this WSDL.