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.
Related
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.
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.
I have a Java code for OAuth 1.0 Authentication and each time i have to execute it before testing each request. I am currently working on JSR223 sampler.
But happen to see this OAuth 1.0 Plugin, can someone explain me how this OAuth 1.0 based Authentication in the screenshot works.
I have some parameter value to be passed in the Authorization header output example given below for each request.
For the first URL, I have two parameter
Key
Secret Key
Which give the Access token and secret access token for the Second URL and for the third it will add
request Payload
Email
Status
without these the request will fail.
My output code looks like the below in Eclipse:-
Authorization :OAuth oauth_signature="Dynamic Value",scope="Parameter Value",oauth_version="Dynamic Value",oauth_nonce="Dynamic Value",oauth_signature_method=HMAC-SHA1,oauth_consumer_key="Parameter Value",oauth_token="Dynamic Value",oauth_timestamp="Dynamic Value"
Is there a way that i run the piece of Java code directly with all the Jar files in Jmeter [without doing any changes] is that possible?
OAuth 1.0 Plugin
I would suggest adding OAuth client libraries to JMeter's classpath (just drop them to /lib folder of your JMeter installation)
Also download the latest version of groovy-all.jar and put it to the same /lib folder. Restart JMeter to pick the jars up.
Then add JSR223 Sampler to your Test Plan, choose "groovy" in "Language" drop-down and put your Java code to "Script" area. Valid Java code in 99% of cases will be valid Groovy code so you can run it this way.
See How to Run Performance Tests on OAuth Secured Apps with JMeter guide for more detailed information on the domain.
I am trying to use Intellij Idea to generate some java classes from a wsdl url which requires authentication. I have tried everything in the said "Generate Java Code from WSDL" window but the only option where I can actually click OK is using Apache Axis (because it is the only option where there is a user/pass to be filled), but then I receive "Server returned HTTP response code: 401 for URL: https://example.com/basic?wsdl" even though I am passing a valid user/password (tried it on the browser and it works).
Everything else than Apache Axis, a red message saying "WSDL url is not valid" is showed and the OK button is kept disabled.
What else can I try to generate the classes I need?
Thanks.
Generate classes using a maven plugin, see plenty of examples here: https://github.com/krasa/krasa-jaxb-tools-example , there are many more, but cxf-codegen-plugin should be all you need.
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