Create Client classes with wsgen - wsdl

I have a wsdl reachable through an url. I'd like to generate client classes for using this web service using wsgen. How I can do it using as a parameter the wsdl url only? Thank you!

I believe what you are after is wsimport, not wsgen:
wsimport -Xnocompile -keep -d <directory where you want your client class> <path to the wsdl>
-Xnocompile allows you to keep the source

Related

wsdl schema namespace prefix is changing in different environments - AXIS2

I deployed a component having SOAP webservices in an Open Nebula recently. After deployment, we noticed the WSDL responses to be having a different namespace prefix
Problem: AlertBot was expecting to see
<ax25:response>TEST</ax25:response>
but, it started seeing
<ax21:response>TEST</ax21:response> instead. We compared the build between the new and old host, and saw no differences in config files, or the java package.
We need to figure out why the ax25 part namespace prefix got changed to ax21 on the new host
NOTE: We use AXIS2 library for generating WSDLs

Keycloak Unknown authentication mechanism

I need help with using keycloak in an Errai app. I am getting an error about "unknown authentication method" for "KEYCLOAK" ? I have the keycloak-appliance running (on a different port though), and the Errai app has a with KEYCLOAK in the web.xml file inside WEB-INF
When I run the Errai app with mvn gwt:run, I get : RuntimeException caused by "Unknown authentication mechanism KEYCLOAK". I have no idea how to go around this issue .
Just wanted to add a little more detail to #cfsnyder's answer. In order for your application server to recognize a definition in the web.xml that looks like this:
<login-config>
<auth-method>KEYCLOAK</auth-method>
<realm-name>internal</realm-name>
</login-config>
you'll need to tell jboss (in this instance) how to interpret that particular auth method. At the time of my answer, this is in section 8.2 of the Keycloak docs.
First, download the keycloak adapter (remember, this is not the same as the Keycloak Server). Next, unzip the download in the wildfly home directory. With your application server running, just use the following command to install the Keycloak configuration into the appropriate files:
jboss-cli.sh -c --file=adapter-install.cli
When this script completes, your configuration file will have the new entry added to accommodate the KEYCLOAK entry in your web.xml. The script will add something like this to either a domain.xml or standalone.xml:
<security-domain name="keycloak">
<authentication>
<login-module code="org.keycloak.adapters.jboss.KeycloakLoginModule" flag="required"/>
</authentication>
</security-domain>
Once you have the Keycloak module files provided by the adapter + the security domain configuration to link the KEYCLOAK method to the appropriate LoginModule, you should be all set.
You will need to install and configure the Wildfly adapter in order for your Errai app to recognize the "KEYCLOAK" authentication method. See section 7.2 of the Keycloak documentation.
To add to #josh-cain's answer, you might also need following additions in your domain.xml or standalone.xml:
To <extensions></extensions>, add:
<extension module="org.keycloak.keycloak-adapter-subsystem"/>
To <profile></profile>, add:
<subsystem xmlns="urn:jboss:domain:keycloak:1.1"/>
The adapter installation cli scripts can fail for various reasons so you might need to add these entries manually.

WSO2 ESB Using AuthenticationAdmin

I have a NetBeans Project and tried to creat an Web Service client with the following WSDL from WSO2 ESB 4.6.0 like in this example:
https://localhost:9443/services/AuthenticationAdmin?wsdl
But when NetBeans tries to create the client I get an error:
Why is this happening? I created other Web Service Clients, they are working, but this isn't working and I don't know why...
If I try it with eclipse I also get an error:
IWAB0399E Error in generating Java from WSDL: java.io.IOException: ERROR: Missing <soap:fault> element inFault "AuthenticationAdminAuthenticationException" in operation "AuthenticationAdminAuthenticationException", in binding logout
java.io.IOException: ERROR: Missing <soap:fault> element inFault "AuthenticationAdminAuthenticationException" in operation "AuthenticationAdminAuthenticationException", in binding logout
at org.apache.axis.wsdl.symbolTable.SymbolTable.faultsFromSOAPFault(SymbolTable.java:2858)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populateBindings(SymbolTable.java:2549)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:744)
at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:543)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:518)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:495)
at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
at java.lang.Thread.run(Thread.java:722)
Maybe the WSDL has an error?
The AuthenticationAdmin WSDL file is correct.
The logout operation is defined as a "One-way" operation. If you look at AuthenticationAdmin.java implementation, you can see logout method has following signature.
public void logout() throws AuthenticationException
Note that the return type is "void", which means there is no output.
WSO2 uses Apache Axis2 and there are no problems generating the client with Axis2.
I just tried creating a client with Eclipse & Apache Axis2. I could successfully create the stub.
WSO2 also uses the Service Stub created using AuthenticationAdmin WSDL. See pom.xml for more information about generating the client.
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
<arg line="-uri src/main/resources/AuthenticationAdmin.wsdl
-u -uw -o target/generated-code
-ns2p http://common.core.carbon.wso2.org/xsd=org.wso2.carbon.authenticator.stub.authentication,http://authentication.services.core.carbon.wso2.org=org.wso2.carbon.authenticator.stub,http://authentication.services.core.carbon.wso2.org/xsd=org.wso2.carbon.authenticator.stub"/>
<classpath refid="wsdl2java.classpath"/>
</java>
I'm getting the same error as you have shown, when I try to generate the client using Apache Axis. Therefore please make sure to use Apache Axis2 as the web service runtime. Also make sure you point Axis2 directory in Eclipse Preferences -> Web Services -> Axis2 Preferences.
I also see NetBeans try to use wsimport utility. May be it doesn't support one-way operations properly.
I recommend you to use Apache Axis2 to generate the client.

Unable to deploy a osgi bundle containing a camel route defined via aries blueprint in Websphere 8.5

I created an .eba file (enterprise bundle archive) that contains one osgi bundle having a apache camel route (Java DSL). The camel context definition is done via a blueprint xml file. When I tried to deploy the .eba file in Websphere Application Server 8.5, I got the following exception:
org.apache.aries.application.modelling.ModellerException: CWSAL0126E: An exception occurred while modelling bundle ib-base_0.0.1.SNAPSHOT: org.apache.aries.application.modelling.ModellerException: org.osgi.service.blueprint.container.ComponentDefinitionException: Unsupported node namespace: http://camel.apache.org/schema/blueprint.
My blueprint xml file is as follows:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-
blueprint.xsd">
<camel:camelContext id="cbrContext" trace="false">
<camel:packageScan>
<camel:package>a.b.c.d</camel:package>
</camel:packageScan>
</camel:camelContext>
</blueprint>
I am not too sure why this fails in Websphere. The same .eba file gets successfully deployed in Karaf 3.0.0-SNAPSHOT. (This version of Karaf uses Aries Blueprint version 1.0.0).
I guess the same is used or a forked version of the Aries Blueprint 1.0.0 is used in Websphere 8.5.
As per the OSGi specs, any blueprint extension handlers for custom namespaces like camel: are retrieved from the OSGi Service Registry under the key (osgi.service.blueprint.namespace). The value element tells the actual namespace uri .
eg:
<service interface="org.apache.aries.blueprint.NamespaceHandler">
<service-properties>
<entry key="osgi.service.blueprint.namespace" value="http://camel.apache.org/schema/blueprint"/>
<entry key="osgi.service.blueprint.namespace" value="http://camel.apache.org/schema/blueprint/cxf"/>
</service-properties>
<bean class="org.apache.camel.blueprint.handler.CamelNamespaceHandler">
</bean>
</service>
I am not too sure why IBM does not honor this spec.
Another interesting point to ponder over is the fact that when I tried to create a blueprint .xml file using Websphere Application Developer Tool, it shows only 4 extensions as shown below:
IBM Blueprint Extension
JPA Blueprint Support
Blueprint Transaction Support
Blueprint Resource Reference support
I ensured that both the camel-core and camel-blueprint bundles are deployed in the internal repository in websphere.
I tried to deploy the .eba file as an asset.
Not too sure, if I have missed something. I would be glad if someone can point me in the right direction.
best regards,
Sriraman.
WebSphere does not support custom namespace extension (other than the one provided by IBM). The main reason being it runs on Aries (Blueprint container) isolated runtime. There are two options
Use camel api instead of blueprint tags
Use other container (for e.g. Karaf) which supports custom namespace extension
Karaf is a friendly container for camel.

How can Grails load config external to WAR via HTTP?

I've seen questions and answers about how to specify external .groovy and .properties files for Grails config that are outside of the WAR file using grails.config.locations, but we need external config that isn't on the server on which the container (Tomcat) is running.
(It does have a local FS, but it is not persistient and is identical for all deployment environments - hence the need to override it external to the WAR, container and server).
So, can I use http: URLs for grails.config.locations ?
Yes. The following works:
Add this in Config.groovy and pass PARAM1 using -D to the JVM to specify the external URL for the config file.
grails.config.locations = ["url:" + System.properties["PARAM1"]]
I am not aware of any built in functionality that would allow you to specify URL for grails.config. However, it seems like something that you could implement yourself:
define your URL(s) that you want to use to d/l the Congif.groovy file that is included in your WAR
in that same Config.groovy script, write code to download the file to a specific location on your server's file system (see this article)
set your grails.config.locations to point to the file system location that you wrote the Config.groovy file to.
I haven't tried it but seems like it would work.

Resources