How to create a webservice client to a secure webservice at localhost - java

I have created a webservice and it has deployed on localhost. When I browse the WSDL using browser https://localhost:8181/Test/TestOne?wsdl it shows me the WSDL.
But when I try to create client program (I am using NetBeans 7.0) and give this URL for the WSDL URL, it shows me error message that wsdl Problem with downloading wsdl or schema file..... I tried editing the proxy to use system proxy settings also but no luck. Am I doing something wrong or is this a bug in NetBeans?

I think your server doesn't use a certificate signed by CA. So, you need to create a keystore with certificate and pass "-Djavax.net.ssl.trustStore=" parameter to NetBeans.

Open the wizard for setting the attributes for the WebService: right mouse click on the Web Service reference in the client application, choose Edit WebService Attributes, go to Wsimport options tab, and correct the property wsdlLocation as follows:
from: https://<address>:8181/<ws-url>?wsdl
to: /META-INF/wsdl/<address>_8181/<ws-url>.wsdl
more info here

Related

Generate java code from WSDL when HTTP authentication is enabled

I have custom wsdl url. Now in Intelij I am trying to generate java classes using this wsdl. I tried to use Tools->WebServices->Generate Java Code From Wsdl. When **http-auth is disabled on my wsdl url, this option Apache axis 2 works good, But it's required that http-auth to be enabled. There is no option under Axis 2 to enter username and password. I've also tried Apache axis option. I entered user/password after that ok button enabled but after clicking on it I got an error: Server returned HTTP response code: 401 for URL: mywsdlurl. There is also Glassfix/Jax-WS 2.2 RI /Metro 1.X / JWSDP 2.2 option which worked fine before enabling http-auth. Can someone suggest correct way how to generate Java code from WSDL when http authentication is enabled?
You could try to set up proxy (like tinyProxy) that adds authroziation header to the requests with proper credentials encoded and configure your IDE to work throughout that proxy.
After trying 3 hours I found this solution. I created file someFile.txt with the content http://user:pass#host:port/ws/mywsdl.wsdl. And then in the same directory opened cmd and executed command:
wsimport -Xauthfile "someFile.txt" -keep -p com.demo.my_package_name "http://host:port/ws/mywsdl.wsdl"
And then generated package/classes copied into my project.
Take into account that you have to add C:\Program Files\Java\java_version\bin into your EnvironmentVariables->path section. Otherwise wsimport won't work.
Hope this helps to someone.

Web service client cannot be created error

I am making a currency converter using netbeans, using a wdsl/soap
http://currencyconverter.kowabunga.net/converter.asmx?op=GetConversionAmount
Whenever i try to retrieve the information i get the error shown on the picture above, does anyone know what the problem is?
As I am not using Netbeans so I cannt tell about the perticular issue.
But if you want to generate the client side code for webservice.
Just run the following commend
wsimport -keep wsdlUrl
for wsdl url deploy your application and open in browser the copy the url from browser.
this will generate all the source code for client java file as well as .class files.
wsimport commend has many other options check if you want more.

Cannot import WSDL file in SOAPUI - NT authentication pop up (Error loading WSDL)

I never faced similar problem before,
I tried with SOAP 4.0.1 and also with SOAP 5.1.2.
I tried it on my windows but also and on Windows Server 2008
I try to import WSDL:
NT Authentication dialog is presented:
Specify NT Authentication Credentials
to populate Username,Password,Domain
I am able to open the WSDL definition in Firefox:
http://192.168.0.242/SO/Services/ScheduleService.svc?wsdl
after entering username and password
but when trying to import WSDL file or when trying to import wsdl file using location URL
Error loading WSDL
There was something wrong with the WSDL you are trying to import
Error loading
[http://192.168.0.242/SO/Services/ScheduleService.svc?wsdl=wsdl0]: org.apache.xmlbeans.XmlException:
org.apache.xmlbeans.XmlException: error: Reference to undefined entity: raquo
I got same error using latest Soap UI 5.3. No hacking with configuration helped (proxy none, authenticate preemptively etc). In the end I imported WSDL from disk. Calling of operations through NTLM then worked without any problems. It seems like a bug in SoapUI when importing WSDL through NTLM in some environments.
Update: tested that enabling anonymous auth and disabling windows auth in IIS resolves the issue with import in SoapUI. So it is definitely some kind of bug in SoapUI during import through NTLM.
You change the proxy settings under Preferences>Proxy Setting> to none this should solve the authentication issue which you are facing.
Try to open this WSDL with any XML validator and see if it passes thru. The error message say
Reference to undefined entity: raquo
so you need to be sure that this entity is presented in your WSDL or imported schemas.
If your WSDL is 100% correct and "raquo" is there then I can only suggest you to download WSDL to local file with all schemas, change schemaLocation to local relative paths and try importing this local file.
had the same problem here, with a WSDL that works on a different system.
It was the proxy setting that was causing the problem,
and as I don't need the proxy server, just disabling it through the browser menu solved it for me.
I had the same problem. Providing proxy credentials solved the issue for me.
I too faced this issue. Solution - Connect to Open Network (Non office network) and sent the Proxy setting in SOAPUI as None.

Unable to test web service deployed on server

I have developed and published a Java web service on Glassfish server using Netbeans. I can test and use the wsdl file properly using my local application. When I deployed the war file on the server (temporarily I am using jelastic.com as my server), I can access the wsdl file using the URL
http://fesdvi.jelastic.servint.net/FESWebService/Diagnose?WSDL
But cannot test the web service using url
http://fesdvi.jelastic.servint.net/FESWebService/Diagnose?Tester
It gives me following error message
Error generating artifacts for the following WSDL (removed http:// as cannot post more than 2 links) fesdvi.jelastic.servint.net/FESWebService/Diagnose?WSDL
Possible causes can be invoking https when the application is not configured for security
PS: I am not using secured http.
Please help me to sort out this problem.
Following is the extract from the server-instance.log
[ERROR] Connection refused
Failed to read the WSDL document: because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not .
Could not find wsdl:service in the provided WSDL(s):
At least one WSDL with at least one service definition needs to be provided.|#]
Failed to parse the WSDL.|#]
wsimport failed|#]
Moreover I am trying to find the wsdl on the server but I am not able to find, I am still exploring the application deployment structure in jelastic..
It looks like the root cause of the issue is wrong endpoints settings,
since you have uploaded your project with local machine settings.
It is possible to see list of all Web Service endpoints at the Admin Console. After you have logged to it, look at tree in the left, find item "Applications" expand it and click on your WebApplication. You will see the table, in action column you will find "View Endpoint" links (They should contain the URL of your environment and correct ports).
Also, I think that the Eclipse plugin from Jelastic (http://docs.jelastic.com/eclipse-plugin-user-manual) will help you to solve this issues.
P.S. If this will not help, you should to contact with your Hosting Provider Support and ask them about the help.

Generate client from http authenticated wsdl

I'm trying to generate a web service client with the eclipse Web Service Client wizard. However, the wsdl needs http authentication, and haven't found a way to enter the authentication information.
Open the wsdl in a browser and enter the login information when prompted. Once the wsdl opens save it to a file on your hard drive. Use the file with eclipse to generate your code. Then you may have to replace the endpoint value in the java code created because it will contain the location of the file instead of the deployed wsdl. I've had to do it this way a couple of times to get around the authentication piece.

Categories

Resources