Howto access registry in WSO2 ESB - wsdl

Howto reference WSDL files from the registry when defining a new proxy service? I am using WSO2 ESB.
Q1: Can I use the localEntry element to define the WSDL in my proxy service? For example:
localEntry key="my_wsdl" src="file:/wsdl/MyServiceSOAP.wsdl"
Provided that I have previously used Management Console > Add Collection > create "wsdl", and Add Resource > MyServiceSOAP.wsdl.
I have a problem with the "src" value, both
"/wsdl/MyServiceSOAP.wsdl"
and
"wsdl/MyServiceSOAP.wsdl"
do not work. I follow the documentation but they do not show howto upload WSDLs into the registry.
Q2: What if MyServiceSOAP.wsdl imports MyService.wsdl? I need to use Add Resource for MyService.wsdl as well but do I need to do anything else to make the Proxy compile?

I think you are referring to the registry here. The Registry space in each product contains three major partitions.
Local
Configuration
Governance
The configuration registry contains product specific configuration that can be shared across multiple instances of the same product (a cluster of ESB nodes for example). So you can create the WSDL collection inside the Config registry and refer to it like..
"conf:/wsdl/MyServiceSOAP.wsdl"
By uploading the resources to Registry, you can pick them easily when creating the proxy service too.
I think you can refer to resources as "file:/wsdl/MyServiceSOAP.wsdl" only when they are inside a directory named 'wsdl' in the local file system.
BTW, about the error messages.. If you look at ESB server logs you'll see the following error when you try to update the proxy referring to a non existing file.
Caused by: java.io.FileNotFoundException: ./wsdl/MyServiceSOAP.wsdl (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:120)
at java.io.FileInputStream.<init>(FileInputStream.java:79)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
at org.apache.synapse.config.SynapseConfigUtils.getObject(SynapseConfigUtils.java:197)
... 46 more

I found a simple solution for it from a blog:
In my Scenario I had a wsdl, that imported another wsdl that imported a xsd. The actual structures were in the second wsdl.
Import line in the original wsdl:
<wsdl:import namespace="http://www.somedomain.com/interface/v1_0" location="service_interface_1_0.wsdl"/>
Import line in the second wsdl:
<xsd:import namespace="http://www.somedomain.com/data/v1_0" schemaLocation="data_types_1_0.xsd"/>
Required xml on the proxy:
<publishWSDL key="file_required_service_1_0.wsdl">
<resource location="service_interface_1_0.wsdl"
key="file_service_interface_1_0.wsdl"/>
<resource location="data_types_1_0.xsd"
key="file_data_types_1_0.xsd"/>
Where I have local entries for "file_required_service_1_0.wsdl" etc named local entries that contain the original wsdl and xsd files.

Related

how to make MuleSoft webconsumer connector fields get dynamic values

Invalid wsdl location.
The property key is not being read.
Steps that I've done so far
1. create dev.properties file
2. inside dev. properties file
Web Service configuration
ccms.web.location=http://[host_name]:[port]/CreateSegmentDEV/CreateSegmentServiceimpl?WSDL
I put the ${ccms.web.location} in wsdl location
Got error ${ccms.web.location} should be a valid URL or in a file classpath. Please see screenshot that I will upload.
I expected that no error but there is error, invalid wsdl location.
The property key is not being read.
Did you configure the configuration properties in the global elements and specifiy the property file (dev)?

Jmeter parametrize WebSocket variable

I doing test backend application (also Java and Node JS, communication: WebSocket in NodeJs part and http in Java part) in JMeter
I must parametrize url, to switch between development url, production and prepod
I did it by CSV file. I created folder CSV, in folder where I have Jmeter 5.0. I prepare 3 csv file
1.development are:
protocol, host
http, 10.219.227.66
2.prepod
protocol, host
https, prepod.myprepod.io
3.production
protocol, host
https, production.myproduction.io
I set this that:
CSV Data Set Config
Filename ${_P()/usr/local/Cellar/jmeter/5.0/libexec/CSV/development,development}.csv
variable Names ; protocol,host
WebSocket Open Connection
Server name or IP ${host}
Switch Controller
Switch Value ${protocol}
HTTP Request Default - server name or ip ${host}, protocol http ${protocol}
User defined variables
name value
protocol . ${_P(protocol,)}
host . ${_P(host,)}
Questions are:
What is wrong in my set this? what and how i must improve?
I project test save in desktop,but Jmeter 5.0 i have in others places in my computer - in users is folder jmeter 5 - if this could be a problem?
Does anyone know why it does not work for me and how to fix it?.
Everything is wrong
Given you defined protocol and host variables in the CSV file you don't need to declare them in the CSV Data Set Config, just leave the field blank
JMeter supports CSV files which have a header line defining the column names. To enable this, leave the "Variable Names" field empty. The correct delimiter must be provided.
Don't use full paths to CSV files as most probably it will make running tests on other machines, in distributed mode or in continuous integration server impossible.
so go for something like ${__P(environment,development)}.csv
Double check that protocol and host variables have expected values using Debug Sampler and View Results Tree listener combination
If you don't see them - check jmeter.log file for any suspicious entries, most probably JMeter cannot find .csv file and read variables from it. See How to Debug your Apache JMeter Script article for more details.
I fail to see any WebSocket URL schema (ws or wss) in your CSV files so I doubt your WebSocket Open Connection Server will ever be successfully executed.

Get access to yaml external file in Thorntail

I want to get access to external YAML file which I specify through command-line argument:
java -jar target/app-thorntail.jar -s./test.yaml
This file I need to use to get my custom properties tree by SnakeYaml.
You can use #Inject #ConfigurationValue for your custom properties, and you can #Inject a ConfigView to read the entire configuration tree. I believe that should be enough for your usecase. This approach will also provide correct values in case multiple configuration files are used.
I'm not sure if you can get access to the file itself, except maybe provide a custom main method and parse the command-line arguments yourself.

Ejb jar for Jboss PER environment

I am trying to read the attributes from a properties file into a field in ejb-jar.xml via ANT.
I have one properties file PER environment which contains an IP address which must be written into ejb-jar.xml when ANT is building the ear.
How would I accomplish that ?
please refer https://ant.apache.org/manual/Tasks/replace.html
check this : if you have someDirectory/cofiguration.properties in which you have IP configuration as per your environments and in that property file ipAddress.key is the key and want to replace with the value of it.
ejbIPAddress will be replaced by ipAddress.key value of someDirectory/cofiguration.properties

Hiding WSDL in JAX-WS

I'm, using JAX-WS in order to build and deploy web-services.
Everything is working properly, however I need to hide the WSDL. In other words, If the user goes to the following URL: http://foo.com/wm-ws/WMService2?wsdl, i don't want the WSDL to show.
I read that we could use the #WSDL annotation so i did that as follows:
#WebService(serviceName = "WMService2",
targetNamespace = "http://test.wmservice.soap/",
portName = "WMService2")
#WSDL(exposed = false)
public class WMService2
{
...
}
But this doesn't change anything..The WSDL is still showing. I've seen work-around where a filter is created, but i think it's an overkill.
Any ideas?
For starters, your client will likely require the WSDL at runtime. It is possible to get around this with hand-crafted client code or by including a local copy of the WSDL (which requires a bit of magic in an EE environment, namely packaging the WSDL in your artifact and specifying a wsdl-location in your wsimport (I can provide more info if desired; this is also a valid solution: JAX-WS client : what's the correct path to access the local WSDL?). This explains more about the dependency but it's also a good idea to have it available for interoperability: Why is WSDL required for Java Client at runtime?
With that said, it sounds like what you're actually trying to accomplish is restrict access to web resources, which is easily accomplished with a web.xml. Specifically you can add a security constraint,
<security-constraint>
<web-resource-collection>
<url-pattern>*?wsdl</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</security-constraint>
although this will mean that you must set up authentication in your container and authenticate in your client (what is your container? client?). The url-pattern can be anything and the role-name * indicates any authenticated user may access the resource.
About security contraints: http://docs.oracle.com/cd/E19798-01/821-1841/bncbk/index.html

Resources