Web service client cannot be created error - java

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.

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.

OneLogin java-saml-tookit-jspsample crashes while parsing response

Has anyone tried using the OneLogin Java Toolkit JSP sample successfully?
I have downloaded and tried "java-saml-tookit-jspsample". I was able to follow the instructions and get it setup the Eclipse with JDK8. I was able to configure "onelogin.saml.properties" in the sample and the SAML Test Connector in my OneLogin Account.
When I run the application, I get the login link, and it is able to connect one Login and get back the Authentication response. I can also see the XML received when I debug, but the program crashes while processing the response.
It crashes at following source line in Util.java.
docfactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", XMLConstants.W3C_XML_SCHEMA_NS_URI);
With error
"java.lang.IllegalArgumentException:
http://java.sun.com/xml/jaxp/properties/schemaLanguage"
I tried adding a xercesImpl.jar and xml-apis.jar to see if its an XML parser issue, but it did not help either.
I'm the author of java-saml and I tested it with Oracle Java8 and had no issues.
This post suggest that the issue is related with how xerces.jar was installed.

Access Web service from java when wsdl file is known

I am trying to access a web service in the remote system by using java code. I take the WSDL URL from the XMethods registry and download the WSDL file from that location. I parse the WSDL file and display the list of operations and their Input and Output parameters and type. I will get the Input from the user according to the Information I got from the WSDL file. Now What I am need is I need to display the user the corresponding output from the Webservice. For this what is the easiest method to consume the Webservice. I dont have any Idea. Please anyone can help me??? Thanks in advance.
you can user axis2 jar framework to consume the webservice. Axis2 jar's generate the dependency files to consume the web service. Use this link to create client files.
http://javapapers.com/web-service/axis2-web-service-using-eclipse/

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.

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

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

Categories

Resources