Error accessing Web Services from WSDL - java

After hours of working I have found a way to create a SOAP client that performs calls to web servers. I did two tests on public web servers and everything went okay. When I did a project with another server I got an error:
Web Service Client can not be created by JAXWS:wsimport utility.
Reason: 'Any' Property already defined. Use <jaxb:property> to
resolve this conflict
I am using Java EE 7 and Netbeans to create the web service client.
The problem maybe is that this web server requires a username and password to download the WSDL file.
How I can resolve this, and how can I enter a username and password to request the WSDL file?
EDIT:
The problem is not related to SSL, beacause I can access to WSDL from browser.

Related

Java ServiceLoaders, Tomcat, Apache CXF and Metro

I have to get some information from an external SOAP web service using a web application deployed on Tomcat 7. This external web service requires TLS with mutual authentication.
As a starting point, I have installed Tomcat 7.0.96 in my desktop computer and, using the external web service wsdl file, I have put a dummy web service up, that mimmicks the real one, returning some hardcoded objects when queried. I have used Apache CXF 3.3.8 .
I also have a web application that acts as a proxy for another web app, and as a client for the external (test and production), and dummy (local) web services.
Proxy web app requests objects from dummy web service. Mutual TLS authentication is assured using keystores present in CXF 3.3.8 samples.
In my desktop computer, everything works fine, my dummy web service serves the objects as expected.
Problem arises when I ask to deploy the proxy web app on a test server that I do not control. This server runs Tomcat 7.0.76 over CentOS 7. When the proxy web app tries to create the external web service client, an exception throws:
java.lang.ClassCastException: com.sun.xml.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy
I have searched for documentation about Java proxies and service loaders. Test server has three jaxws-xxx.jars in /tomcat/lib folder. AFAIK these jars are Metro web services API and implementation. I have a copy of these at my local tomcat/lib folder, and I can reproduce the problem.
I have included a Context.xml file in my proxy web app. Depending upon I include an Loader element in Context.xml, setting Loader attribute delegate to true or false, I am able to reproduce or solve the problem.
But when I deploy the proxy web app in test server, including Context.xml as explained, the aforementioned exception always arises.
I have included some lines in proxy web app printing to log implementation classes showed in ServiceLoader Java class iterator. At my local PC, com.sun.xml.ws.spi.Providerimpl appears before of after org.apache.cxf.jaxws.spi.ProviderImpl depending upon Loader "delegate" attribute value, as expected.
But using the same Context.xml webapp file, at the test server, sun's spi appears always before cxf's.
Has anybody faced this problem? Any suggestions? Thanks in advance
You should ask the external Tomcat admin, why did he include JAX-WS RI libraries in the common classloader. IMHO opinion they shouldn't be there, but in the applications that use it.
Nevertheless your application classloader should pick the CXF implementation of JAX-WS unless:
the <Host> container has deployXML="false" and it ignores the META-INF/context.xml file in your application. If this is the case you can copy it manually to $CATALINA_BASE/conf/<enginename>/<hostname>/<contextname>.xml
the $CATALINA_BASE/conf/context.xml has a <Loader> component with delegate="true".

How to deploy webService and get access to wsdl?

I have got a webService without ui. It simple jax-ws app that will allow to manage users via soap requests. I tried to deploy it on websphere. It was deployed, But! my app doesn't appear in Service Providers and i can't get access to wsdl file via url that i pass in wsdlsoap:aderess location. It haven't got any servlets and other stuff. I create my app using template that deploy with success, it appear in Service Providers. I research all internet, but idk what go wrong.
P.S: Template project was eclipse project. I just add maven and has no idea why it wouldn't work.
The fact that your web service hasn't appeared in the Service Providers section means you've deployed it the wrong way.
Check whether you've selected the "Deploy web-services" option during deployment.
You probably got an issue in your trace.log file which possibly references to the ffdc, check it to investigate the problem.
You also haven't mentioned if you using servlet or EJB-based web services.

Generate WSDL from Java Web Service in Eclipse

I have a GAE web service with a few GETs and POSTs, I am required to have a WSDL of the web service.
I have found several pages and posts about generating a web service from WSDL but how would I generate a WSDL from an already created web service? I was told this is possible with only a few clicks in Eclipse.
Typically the WebService producer gives you the WSDL. Most web services you are able to get to the WSDL by postfixing ?WSDL to the URL. Keep in mind that, some web service providers disable this feature.
That is if you have a web service here
http://hostname:1234/webservice
you can use
http://hostname:1234/webservice?wdsl
to retrieve the WSDL

Does a WSDL file need to be published on a server to consume its services?

I had a WSDL file locally for a service. I used it to generate the my java proxy client using eclipse.
Now when I invoke this service, it fails. The error i get is that java client is looking for the same WSDL (from which I generated proxy client) file published on the web server. (looks for https://myservice.com/xyz?wsdl type URL for WSDL)
so, what I want to clarify is that does it require to publish WSDL file on web server to use the service? How can I get my client working with the service?

Generated web service client doesn't match wdsl

After developing a web service on Eclipse, based on Axis1 and JBoss, I deploy it and test it with soapUI. It works perfectly.
Eclipse generates a wsdl file which I use in Eclipse's new web service client wizard to create an application client that consumes the web service. It generates the client code perfectly, but when I invoke some operations, I get the following error:
org.xml.sax.SAXException: Invalid element int ClassX - variableName.
How's that even possible? Everything was done using Eclipse's webservices tools for both generating the web service and the client. How can I check that my web service is getting generated correctly? What conditions should a complex object that is sended over a web service follow?
https://issues.apache.org/jira/browse/AXIS-2545
Is this along the same lines as your problem? I remember the wsdl axis tool sometimes mismatches element names, so instead of
elemField.setFieldName("**EventID**");
elemField.setXmlName(new javax.xml.namespace.QName("", "EventID"));
it comes out as
elemField.setFieldName("**eventID**");
elemField.setXmlName(new javax.xml.namespace.QName("", "EventID"));

Categories