wsimport for Onvif wsdl - no service definition - soap

There are several questions along similar line but none answers this definitively.
I'm using wsimport to generate code from a .wsdl file (Onvif's wsdl files). Running
wsimport -keep https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl -extension -Xnocompile
outputs
At least one WSDL with at least one service definition needs to be provided.
Based on this SO answer I added this service declaration, locally downloaded the onvif.xsd, and common.xsd, modified the path specified for these Onvif files, which then generated the code.
Is there a more straightforward way to run the wsimport command on each of these Onvif URLs? There are over 20 wsdl files, and I find it silly to manually download, then make the above changes in each file to be able to run wsimport.

You should make these changes in your WSDL file:
add name="DeviceService" in line 11 which starting with <wsdl:definitions...
add
<wsdl:service name="DeviceService">
<wsdl:port name="DevicePort" binding="tds:DeviceBinding">
<soap:address location="http://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl"/>
</wsdl:port>
</wsdl:service>
at the end of file after </wsdl:binding>
Then run the generating command.

Related

WildFly: jboss-cli's add module creates a wrong folder

I am taking my very first steps with WildFly application server. I want to create a database driver.
I had a look at https://www.adam-bien.com/roller/abien/entry/installing_oracle_jdbc_driver_on on how to do it manually. And now I want to do it by jboss-cli.sh. I read about these commands e. g. here and here.
So I am typing...
wildfly-26.0.0.Final/bin$ ./jboss-cli.sh -c
[standalone#localhost:9990 /] module add --name=com.oracle --resources=/home/user/Downloads/ojdbc8.jar --dependencies=javax.api,javax.transaction.api
The command is going to be executed without error.
I would expect it to
create the module-subfolders (step 2 in the linked tutorial by Adam Bien)
copy the JAR file to the newly created folder (step 3)
create the module.xml file (step 4)
maybe even to add the necessary <driver /> tag in the standalone.xml (do not know if that should be part of the add module command?) (step 5)
Basically it does a lot of that, but different than I expect.
It creates the subfolder in a wrong(?) location. It is not created in [WILDFLY_HOME]/modules/system/layers/base/com/oracle/main like it is decribed by Adam Bien but it is created [WILDFLY_HOME]/modules/com/oracle/main. The JAR file is correctly copied, the module.xml file is created but the folder seems to be wrong. And the standalone.xml is not altered at all.
If I start the web management console I do not see the driver next to the default H2 one.
So my question is what am I doing wrong with the command so that the folder is created in the correcy localtion? Or does this work as designed and the location is not that relevant and I am making other mistakes that it does not show in management console nor in standalone.xml?
By the way, I also tried to change the command module add --name=system.layers.base.com.oracle .... Now the folder was correct, but in the module.xml the name of the module was also system.layers.base.com.oracle.
I tested with WildFly 26.0.0 and WildFly-preview 26.0.0 under Ubuntu.
It should not be created in modules/system/lasers/base. That is for components provided by the container. Having the module off the root $JBOSS_HOME/modules directory is correct.

WSDL service location base URL will be different in each environment and how to not build the same jar over and over again

I have a wsdl file, which contains service-tag and partial view of it:
<service name="EXFlowers">
<port binding="getflowers:EXFlowersGetflowers" name="EXFlowersGetflowersService">
<soap:address location="http://dev.example.com:67857/EXFlowers/getflowers" />
</port>
</service>
My problem is in this part:
<soap:address location="http://dev.example.com:67857/EXFlowers/getflowers" />
I am using wsdl2java which creates .java files from the wsdl file (then I compile the generated files and make a jar file out of it for using it in WebSpehere).
As it is now I can't promote a .jar file from one environment to another (for example: development -> test -> staging -> production), because the location in each environment has different base url. I hate to run wsdl2java for each environment (basically create the same jar 5 times with just different string values in some of the class files). I want "build once, run anywhere" workflow and I found this from IBM's support page https://www.ibm.com/support/pages/accommodating-different-wsdl-urls-between-environments which explains how it could be done.
So my question is:
Can a kindly soul explain me with syntax examples how option 2 can be done:
Use a file:// based WSDL URL. Store the WSDL file itself in the same file path in each environment, but use different contents with
custom hostnames and/or endpoint URLs therein.
I don't understand it, how will it look like:
<soap:address location="file://tmp/myendpointfile.txt and what about this part -> /EXFlowers/getflowers" />
and how will the content of the file be ?
cat /tmp/myendpointfile.txt
http://dev.example.com:67857
I would appreciate any help or if you guys know a better way of accomplishing this task.

Unable to create a client stubs for a web service

I am trying to learn web service development using JAX-WS.
I am trying out this tutorial.
I am able to create and run web service correctly and I got WSDL file when I hit the link http://localhost:8080/WS/Greeting?wsdl. However at step 5 of creating client stub using wsimport as follows:
CD %CLIENT_PROJECT_HOME%\src
wsimport –s . http://localhost:8080/WS/Greeting?wsdl
I am getting error as follows:
Let's see this are the options and meanings:
-s: Specifies where to generate the SOURCES
-d: Specifies where to generate the CLASSES
-keep: Says to KEEP the sources
-p: Specifies a package
Now, you were using a "." to specify the source output, that may generate the problem. If your output folder is the current one, specify nothing.
Read here for wsimport documentation and for other tutorial for its usage use this.

WCF: SvcUtil.exe with imports issue

One of the requirement in our project is as follows:
We got from client WSDL and XSD files only. Our task is to generate SOAP messages based on these WSDL and XSD files and extract SOAP bodies.
First step we should undertake is to generate client proxy files from given WSDL and XSD files. Main WSDL file has mulitple imports and imported XSD files also have some imports. I've tried to accomplish client proxy files generation by using SvcUtil.exe utility, but the error came up.
I ran SvcUtil.exe in this way:
E:\Projekti\WCF\XSD>svcutil /noconfig rosrazna.ru.xsd.SmevUnifoService.wsdl roskazna.ru.xsd.ResponseTemplate.xsd roskazna.ru.xsd.PGU_ImportRequest.xsd roskazna.ru.xsd.PGU_DataRequest.xsd roskazna.ru.xsd.PGU_ChargesResponse.xsd roskazna.ru.xsd.ExportPaymentsResponse.xsd roskazna.ru.xsd.ExportIncomesResponse.xsd roskazna.ru.xsd.ExportQuittanceResponse.xsd roskazna.ru.xsd.Ticket.xsd
But, this error came up:
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation. All rights reserved.
Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata docu
ments did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assembl
ies. Verify that you passed all the metadata documents to the tool.
Warning: If you would like to generate data contracts from schemas make sure to
use the /dataContractOnly option.
I have to mention I did not put imports from XSD files imported in main WSDL file in SvcUtil.exe command. I don't know how to put them.
So, how to solve this?
Thank you in advance.
Goran
#Goran, copy all the referenced xsd files to the same location as the wsdl. Then, when using the svcutil from command prompt, list all the xsds there, or put a *.xsd, like this:
E:\Projekti\WCF\XSD>svcutil /noconfig goransWsdl.wsdl *.xsd
PS: You already seem to be mentioning all the xsds though.

.NET 2.0 app on Windows Server 2003 doesn’t load a .config file

I can’t made my .NET 2.0 applications (and services) to load their appname.exe.config files on Windows Server 2003 Standard Edition SP2,
I tried to create manifest like this but it didn’t worked
EDIT:
Appname.config is located in the same dir,
App works without any changes on Windows XP, once we move files or use setup to install it on 2003 it fails to load .config file.
The "working directory" of the executable IS the same as it's path! We didn’t change anything while moving it from XP to 2003
I’ve tried process monitor, it says for operations CreateFile and QueryOpen: name not fount, like this file would not exists, but I assure, it is!
I think it might be something wit manifest files under 200, according to this thred on MS Connect
but I don’t know how to solve the problem.
This might be the solution:
http://blogs.msdn.com/junfeng/archive/2006/08/09/692996.aspx
To workaround the bug, add an assemblyIdentity to the SxS manifest.
<?xml version="1.0" encoding="utf-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
name="Foo"
type="win32"
/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Two things come to mind:
First, is the config file located in the same directory as the executable?
Second, is the "working directory" of the executable the same as it's path? If the working directory isn't correct, then it won't be able to locate the file.
One more thing to do would be to get a copy of sysinternals, specifically the process explorer tool to see what file (and path) it's trying to load.
What do you mean by cannot load? Any exception message .Net throws at you? Or it just dies silently?
Your app should load yourexe.exe.config, i.e., mainform.exe.config, where mainform.exe is your app name.